Monday, 2 November 2026

Unix Commands

Unix Commands 

 

1) clear - to clear up your shell 
 
2) echo "Welcome"
 
3) pwd - print the working directory
 
4)  cd - change directory
 
5) ls - list of files and folders
 
6) cd ..  - which changes the working directory to the folder above the current working directory 
 
7) cd ~  -  takes you to your home directory. 
 
8) mkdir  - make a directory
 
9) touch - create a blank file 
 
10) ls -l   - long listing of files in a directory
 
11)  wc <filename> - word count in a file (displays the number of lines in a file followed by the number of words and then the number of characters.)
 
12) cat <filename> - print text files to the terminal
 
13)  less <filename> - large file we should use less, which is a program designed for viewing multi-page files.
(use the spacebar to go to the next page and the b key to go to the previous page. In order to quit less and go back to the prompt press the q key.) 
 
14) head  <filename> - head prints the first ten lines of the file to the terminal. 
 You can specify the number of lines printed with the -n option followed by the number of lines you’d like to see:   head -n 4 <filename> (prints first four line)
 
15)  tail <filename> - tail prints the last ten lines of the file to the terminal. 
tail -n 15 <filename> (prints last 15 lines)

 

Notes

  • The root directory (/) contains all of the folders and files on your computer.