Skip to main content
Logo image

Section 14.12 List of Linux Commands

The Linux operating system provides a wealth of commands that are extremely useful. Below you will find some of the most commonly used commands that will be useful in this course, along with descriptions and information on how and when to use them.
ls:
  • lists content of a directory
  • switches modify behavior:
    • -l: long listing
    • -t: sort by date
    • -a: show all files
    • -S: sort by size
    • -r: sort in reverse order
    • -lta: long, sorted by date, all files
    • man ls:gives information on ls and all possible switches
cd:
  • changes working directory
  • cd .. moves up a directory
    • . is the current directory, .. is one directory up, etc.
  • can change to a directory with path
    • i.e. cd ~/engs20/workspace
  • cd ~ or simply cd changes to home directory
pwd:
  • prints working directory
  • alternatively, looks at your command prompt to determine your current location
mkdir:
  • creates a new directory
    • will only work in a directory for which you have write permission
rm:
  • removes (deletes) a file
    • does not check whether you mean it
    • demonstrate in a shell and file browser with a test file to delete
rmdir:
  • removes a directory, provided it contains no files or directories
less:
  • displays contents of a file, one screen-full at a time
  • space bar advances one page
  • Ctrl+b goes back one page
  • q quits less and returns you to the command prompt
mv:
  • moves a file to a new location
  • can also use mv to simply rename a file
cp:
  • makes an independent copy of a file
man:
  • tells you about the a given command and its switches (options)
    • i.e. man cp