Free Domain Sign up for PayPal and start accepting credit card payments instantly.

Monday, July 12, 2010

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

1. cat 123.txt ; ls -l - this runs first command, then second command without regards for exit status of the first command

2. cat 123.txt && ls -l - this runs second command, if first command is successful
3. cat 1234.txt && ls -l

4. cat 123.txt || ls -l - this runs second command, if first command fails


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

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

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

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

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

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

30. file - determines file type
a. file /var/log/messages

No comments:

Post a Comment