Thursday, December 31, 2009

COMMAND CHAINING

COMMAND CHAINING
Features:
1.Permits the execution of multiple commands in sequence
2.Also permits execution based on the success or failure of a previous command
3.cat 123.txt ; ls -l - this runs first command, then second command
without regards for exit status of the first command
4.cat 123.txt && ls -l - this runs second command, if first command
is successful
5.cat 1234.txt && ls -l
6.cat 123.txt || ls -l - this runs second command, if first command fails

1. more|less - paginators, which display text one-page @ a time
1.1)more /etc/fstab
1.2)less 1thousand.txt

2. seq - echoes a sequence of numbers
seq 1000 > 1thousand.txt - creates a file with numbers 1-1000

3. su - switches users
su - with no options attempts to log in as 'root'

4. head - displays opening lines of text files
head /var/log/messages

5. tail - displays the closing lines of text files
tail /var/log/messages

6. wc - counts words and optionally lines of text files
wc -l /var/log/messages
wc -l 123.txt

7. file - determines file type
file /var/log/messages

No comments:

Post a Comment