Skip to content

Unix Tutorial Practice

Jeanie Lim edited this page Sep 11, 2016 · 1 revision

Recap: Unix Commands

Navigating Files and Directories

Command Description
echo $HOME
ls list files and directories
ls -a list all files and directories
mkdir make a directory
cd change to named directory
cd change to home-directory
cd ~ change to home-directory
cd .. change to parent directory
pwd display the path of the current directory

Working With Files and Directories

Command Description
cp file1 file2 copy file1 and call it file2
mv file1 file2 move or rename file1 to file2
rm file remove a file
rmdir <directory> remove a directory

Closer Look into Files

Command Description
cat file display a file
less file display a file a page at a time
head file display the first few lines of a file
tail file display the last few lines of a file
grep _'keyword'_ file search a file for keywords
wc <file> count number of lines/words/characters in file

Redirection and Piping

Command Description
command > file redirect standard output to a file
command >> file append standard output to a file
command < file redirect standard input from a file
`command1 command2`
cat file1 file2 > file0 concatenate file1 and file2 to file0
sort sort data
who list users currently logged in
Clone this wiki locally