|
The Shell
The command line
The shell interprets and executes a command when you type it at its
prompt.
After your press enter the shell scans the command line for proper syntax
Arguments
Arguments can be filename, string of text, number or some other object
that a command requires or act on. Options
An option is an argument that modifies the effects of a command
IE. ls –la Processing the command line
CONTROL-H
(erase a character)
CONTROL-U (kill
a line)
CONTROL-W (erase a word)
$ls $/bin/ls Standard input and standard output
Your terminal is a device file under /dev, if you type tty and it shows
/dev/pts/3 it would be the pathname to your terminal.
Standard output would be the terminal
cat
command can be used as both Standard
input and standard output IE.
cat (by itself will
echo what you type. CTRL-D sends an end of file)
cat filename cat
< filename (redirecting standard input) Other commands lpr, sort, grep cat
> filename cat
firstfile secondfile > thirdfile Appending Standard output to a file
cat pear >> orange
[wmorales@rc33uxas01
wmorales]$ date > whoison [wmorales@rc33uxas01
wmorales]$ cat whoison Wed Feb
2 12:21:11 PST 2000 [wmorales@rc33uxas01
wmorales]$ who >> whoison [wmorales@rc33uxas01
wmorales]$ cat whoison Wed Feb
2 12:21:11 PST 2000 klulla
pts/0 Feb
2 10:14 (PPPa2-ResalePortlandOr4-3R7161.saturn.bbn.com) klulla pts/5 Feb 2 10:49 (PPPa61-ResalePortlandOr2-3R7170.saturn.bbn.com) jtaylor
pts/2 Feb
2 11:50 (216-99-207-77.cust.aracnet.com) bjensen
pts/6 Feb
2 12:11 (198.106.33.106) ehumphre
pts/1 Feb
2 10:27 (fw1.tek.com) wmorales
pts/3 Feb
2 09:42 (198.106.33.204) dmichels
pts/9 Feb
2 11:07 (198.106.33.210) klulla
pts/4 Feb
2 12:27 (PPPa10-ResalePortlandOr2-3R7170.saturn.bbn.c om) [wmorales@rc33uxas01 wmorales]$ /dev/null
place to redirect output that you do not want PIPES
ls | more
tr
sting1 sring2 (translate
utility) A common
use of tr is to convert lowercase characters to uppercase.
This can be done in many ways. Here
are three of them:
tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
tr a-z A-Z
tr '[:lower:]' '[:upper:]'
cat abastract | tr abc ABC
ls | lpr FILTER
A command that processes an input stream of data to produce an output
stream of data
who | sort | lpr tee
utility
read from standard input and write to standard output and files
[wmorales@rc33uxas01
wmorales]$ who | tee whoison.out | grep wmorales wmorales pts/3
Feb 2 09:42 (198.106.33.204) [wmorales@rc33uxas01
wmorales]$ cat whoison.out klulla
pts/0 Feb
2 10:14 (PPPa2-ResalePortlandOr4-3R7161.saturn.bbn.co m) klulla
pts/5 Feb
2 10:49 (PPPa61-ResalePortlandOr2-3R7170.saturn.bbn.c om) jreynold pts/7
Feb 2 12:32 (pdx10-7-58.transport.com) ggrassma pts/2
Feb 2 13:00 (198.106.33.161) bjensen
pts/6 Feb
2 12:11 (198.106.33.106) ehumphre pts/1
Feb 2 10:27 (fw1.tek.com) wmorales pts/3
Feb 2 09:42 (198.106.33.204) mmcgillv pts/8
Feb 2 12:49 (atropos.jf.intel.com) [wmorales@rc33uxas01 wmorales]$ |
Back to
CS140U Homepage |