Back to labs/answer key page

Here are some basic Unix/Linux commands

cd dir
 change current directory to dir
cd ..
 change current directory to the parent directory
cd
 change current directory to home directory
pwd
 print working (current) directory
ls
 list the files and subdirectories in the current directory
ls -l
 ... and some information about the files
cat
 print a file to the standard output
head
 `print' the first 10 lines of a file
head -n
 `print' the first n lines of a file
tail
 `print' the last 10 lines of a file
tail -n
 `print' the last n lines of a file
tail +n
 `print' a file starting from line n
more, less
 `print' a file one screenful at a time
cp pathname1 pathname2
 copy the file in pathname1 to pathname2.
mv pathname1 pathname2
 move the file in pathname1 to pathname2.
rm pathname
 remove the file in pathname
command1 | command2
 use the output of command1 as input to command2
command > file
 write the output of command to file (new file)
command >> file
 append the output of command to file
command < file
 take the information in file as input to command
history
 `print' the commands you've given the system
!string
 rerun the last command starting with string
 previous command in the history list
 next command in the history list

Back to labs/answer key page

-----

Emily M. Bender
Last modified: Fri Dec 8 11:57:03 2000