AIX 5L Basics (Unit 08) – Shell Basics

? – single character
* – zero or multiple characters
[] – single character (inclusive list)
[!char] – Not single character
[1-5] – Range of characters

ls ne[stw]
ls *[1-5]
qprt [!tn]*

Standard Files:
Standard In(0) “<" - Keyboard Standard Out(1) ">” – Screen
Standard Error(2) “2>” – Screen

< - Input > – Output
>> – Append

Input Redirection:
mail wltest
mail wltest < letter - Input comes from the file not the keyboard, the file letter is emailed to wltest Output Redirection: ---------------------------- ls > ls.out
who >> whos.there – Redirecting and appending output to a file

Error Redirection:
cat filea fileb 2>errfile
cat filea > /dev/null – Send output to the AIX black hole

Association: (Always redirect output first with associations)
—————— (since the association has to be specified first)
command > outfile 2>&1 – Send errors to same place as output

Note: the &1 refers to standard out(1) above.

A sequence of one or more commands separated by a verticle line |. The standard output of each command becomes the standard input of the next command.

who | wc -l

Filters: (grep, tee)
A filter is a command that reads from standard input, transforms the input in some way, and then writes to standard output.
ls -l | grep “^d” | wc -l

Split Outputs:
tee – The tee command reads standard input and sends the output to both standard output and a file.

ls | tee /tmp/ | wc -l

Command Groupings:
Multiple commands can be entered on the same line separated by a semi-colon ; waits for the 1st command to finish before executing the 2nd command.

ls -R > outfile ; exit

Line Continuation:
When running out of space on the command line you can continue on the following line instead of pressing Enter which executes the command.

\Enter – The backslash tells the shell to ignore the Enter
> – secondary prompt indicating a continuation of the previous line

$ cat … … … \enter
> /home/filename

Leave a Reply

Your email address will not be published. Required fields are marked *