This preview shows page 1. Sign up to view the full content.
Unformatted text preview: en y ou run "ls .." ?
How do y ou go bac k to the parent direc tory ? Tab completion
Another us eful c ommand line tric k is tab c ompletion. W henever y ou're ty ping a pa th into the terminal, y ou c an jus t enter the firs t
few c harac ters , hit the tab k ey , and the s hell will attempt to c omplete the res t for y ou. You c an us e this tric k as often as y ou lik e in
a c ommand. On s ome better s hells , hitting tab twic e will als o s how y ou a lis t of pos s ible c ompletions .
Try going to part1 and entering "c d y " and then hitting tab to s ee tab c ompletion in ac tion. The s hell s hould fill in "y ears " – the
direc tory y ou made at the beginning of the lab us ing the GUI. mkdir
This program c reates new direc tories (s hort for "mak e direc tory ").
ki ietr .
Us e m kdir to c reate a new direc tory ins ide "part1" c alled "tes t". Note that on the c ommand line, no output is often a s ign of
s uc c es s . If there was an error, the program will us ually print out an error mes s age giving a hint as to the problem. Us e ls or the GUI
to verify that y ou s uc c eeded. touch
This program c reates a new empty file (or "touc hes " ex is ting files to update their modific ation time).
oc ie .
Us e touch to c reate a new file ins ide "part1" c alled "notes .tx t" mv
This program m ove s files and direc tories to new loc ations .
m suc dsiain
v ore etnto
s ourc e c an be a file or direc tory . des tination c an be an ex is ting direc tory , or a path to a new file that does n't ex is t y et. If the
des tination is a direc tory , then the s ourc e file or direc tory will be moved into it. If the des tination does n't y et ex is t, then the s ourc e
will be moved and renamed to the des tination.
If the des tination already ex is ts , it will be overwritten! Be c areful when us ing mv
Us e m v to move "notes .tx t" into "tes t". cp
This program copie s files and direc tories .
c [r suc dsiain
p -] ore etnto
The "c p" program behaves the s ame as m v, ex c ept that it duplic ates files and direc tories rather than moving them. The optional "-r"
flag is needed when y ou want to c opy direc tories and their c ontents .
If the des tination already ex is ts , it will be overwritten!
Us e cp to mak e a c opy of "tes t" c alled "tes t_c opy ". rm
This program re m ove s files and direc tories .
r [r fl1..
m -] ie . Be very c areful when us ing the "rm" program. Onc e a file is gone, it's gone; there is no rec y c le bin to find y our removed
As with the cp program, the "-r" flag is us ed to a remove a direc tory and its c ontents .
Us e "rm" to remove "tes t_c opy " and its c ontents . Getting help
To get very detailed s y ntax for a partic ular program, us e the m a n utility :
a scin rga
For ex ample, to get help on us ing "rm", run:
To s c roll down, hit the return k ey . *To ex it, hit "q".* On better c onfigured s y s tems , y ou c an als o s c roll with the arrow k ey s .
Note that we're us ing s ec tion 1. This is the s ec tion for programs us ed on the CLI; all CLI programs (inc luding the ones we've
introduc ed in this lab) c an be found in s ec tion 1. W hen we get into C programming, we'll be look ing at other s ec tions for C
func tions , but for now, every thing c an be found in s ec tion 1. T ext editing
For the purpos es of ECE 198 work , we s...
View Full Document
- Fall '14