Archive for the ‘Uncategorized’ Category
Reference for c# stuff
Sunday, October 19th, 2008Can’t remember everything? Sometimes you just need to be refreshed!
Removing lines bash style
Wednesday, October 15th, 2008
sed '/^$/d' input.txt > output.txt
grep -v '^$' input.txt > output.txt
acer users forum
Wednesday, October 15th, 2008Vi Reference
Wednesday, October 8th, 2008As I don’t use vi very often I seem to forget many of the commands - I know what it can do but sometimes I forget how to do it!
Apache / Site administration - some useful commands
Tuesday, September 30th, 2008This brief introduction for configuring sites and modules in Debian’s Apache 2 package explains how to add and remove sites using the supplied tools, along with adding and removing modules.
The main source of confusiong comes from the various directories stored beneath /etc/apache2:
- sites-available
- A list of configuration files - one per site. A blank install will contain the file default. The system admin can have as many sites here as they need - however - they will not all be active.
- sites-enabled
- A list of symlinks to configuration files in sites-available. A blank install will contain a symlink 000default to sites-available/default. The sites listed here are the sites which will be active. The site to be used if no virtual hosts match will be the first file found (hence the 000 on 000default).
- mods-available
- A list of configuration files - one or more per module. Each dpkg installed module will add files here. e.g. php4.conf and php4.load are added with the libapache2-mod-php package. Again - the system admin can install whatever modules they wish - however - until they are set available they will not be active.
- mods-enabled
- A list of symlinks to configuratioon files in modes-available. Only modules linked in here will be activated on the webserver.
Now - several discussions on #debian IRC channel on freenode recently have had people advising others to either copy files from the available to the enabled directories or to manually symlink them. The user has, however, a better option - the four commands a2ensite, a2dissite, a2enmod and a2dismod
- a2ensite
- Will create the correct symlinks in sites-enabled to allow the site configured in sitefilename to be served
- a2dissite
- Will remove the symlinks from sites-enabled so that the site configured in sitefilename will not be served
- a2enmod
- e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user
- a2dismod
- Will remove the symlinks from mods-enabled so that the module cannot be used
Another approach to inline validation
Friday, August 29th, 2008Unix referance
Monday, August 25th, 2008| wildcard characters | |
| * |
|
| ? |
|
| dir | |
| Change | cd dir Change to directory d |
| Make | mkdir dir Create new directory d |
| Move | mv dir1 dir2 Rename directory d1 as d2 |
| Remove | rmdir dir Remove directory d |
| file | |
| list , no details only names | ls filename , filename with wildcard character/s. |
| list , details | ls -1 filename , filename with wildcard character/s. |
| move to directory | mv filename dirname (wildcard character/s supported) |
| copy file to other/current directory | cp file directory/newfile or cp directory/oldfile . |
| Delete the file | rm file , rm -rf directory - Recursively remove files & directly without any warning. |
| file | file filename , file command tries to determine the file type , text , executable etc after comparing the values in /etc/magic . |
| File edit/create/view | |
| vi - vi full screen editor | vi filename , Opens a existing file or creates |
| ed - Line Text editor | ed filename |
| count - Line, word, & char | wc filename |
| Text content display - List contents of file at once | cat filename |
| Text content display by screen : List contents of file screen by screen | more filename |
| Concatenate - file1 & file2 into file3 | cat file1 file2 >file3 |
| File operation | |
| Change read/write/execute mode of fil | chmod mode file |
| chown | chown [-R] [-h] owner[:group] file |
| move (rename ) file | mv file1 file2 Rename file file1 as file2 |
| Remove | rm file Delete (remove) file f |
| Compare two files | cmp file1 file2 |
| Copy file file1 into file2 | cp file1 file2 |
| Sort Alphabetically | sort file |
| Sort Numerically | sort -n file |
| Split f into n-line pieces | split [-n] f |
| match pattern | grep pattern file Outputs lines that |
| Lists file differences | diff file1 file2 |
| head f Output beginning of file | head file |
| Output end of file | tail file |
| PROCESS | |
| Suspend current process | CTRL/z * |
| Interrupt processes | CTRL/c * |
| Stop screen scrolling | CTRL/s * |
| Resume screen scrolling | CTRL/q * |
| Sleep for n seconds | sleep n |
| Print list of jobs | jobs |
| Kill job n | kill % |
| Remove process n | kill -9 n |
| status process status stats | ps |
| Resume background job n | bg [%n] |
| Resume foreground job n | fg [%n] |
| Exit from shell | exit |
| User admin | |
| add a new user login to the system | # useradd -u 655 -g 20 -d /home/ttes testlogin loginname
#useradd testlogin will create a user by the name ‘testlogin’ with all default values . |
| password Change | passwd <user> |
| alias (csh/tcsh) - Create command | alias name1 name2 |
| alias (ksh/bash) - Create alias command | alias name1=”name2″ |
| alias - Remove alias | unalias name1[na2...] |
| printer | |
| Output file f to line printer | lp -d printer file |
| System Status | |
| Display disk quota | quota |
| Print date & time | date |
| List logged in users | who |
| Display current user | whoami |
| Output user information | finger [username] |
| Display recent commands | history |
| Environment Variable | |
| set | set command alone displays the environment variables, it is used to set options in ksh like set -o vi |
| export | export variable , export makes variable visible in sub shells. |
| Set environment variable (csh/tcsh) to value v | sentenv name v |
| Set environment variable (ksh/bash) to value v | export name=v example : export TERM=vt100 |
| Connectivity | |
| Connecting to a remote host | $telnet hostname/ip address or $telnet Telnet brings up the login prompt of remote host and expects you to enter your user name & password .Without argument it enters command mode (telnet>) and accepts command listed by ? at telnet> prompt. Communication is not encrypted between two hosts. |
| Securely connecting to a remote host |
|
| Copy files from/to remote host |
|
| Securely copy files from/to remote host | sftp username@hostname:remotefile localfile Communication is encrypted between two hosts. |
| Test the tcp/ip connectivity between two hosts |
|
| Backup and Restore | |
| backup and restore using tar , TApeaRchive |
|
| backup and restore using cpio , CopyInputOutput |
|
| Find files , directories | |
| find files , directories |
|