1. Home
  2. Docs
  3. Tutorials
  4. Linux CLI commands

Linux CLI commands

Print

Navigating Linux using CLI

You can use the CLI to perform various tasks such as navigating the file system, managing files and directories and executing commands. This is a useful skill that is beneficial when using Linux and sometimes in IT. Here are some essential commands for navigating Linux using CLI:

  1. pwd
    1. Print out the working directory eg, if you are in Documents the output is Documents
    2. Usage: pwd 
  1. ls
    1. Lists the contents of the Directory
    2. Usage:
      • ls
      • ls -l  #detailed list
      • ls -a #show hidden files
      • ls -ls  # detailed list with hidden files
  2. cd 
    1. Change the current directory or move to the specified directory
    2. Usage:
      • cd /path/to/directory eg cd /home/Documents
      • cd ..   # Move up one directory
      • cd ~    # Move to the home directory
  3. mkdir
    1. Create a new Directory
    2. Usage:
      • mkdir dirname 
      • dirname is the name of the new directory
  4. touch
    1. Creates an empty file
    2. Usage:
      • touch filename
      • Filename  is the name of the empty file
  5. cp
    1. Copies files or directories
    2. Usage:
      • cp source destination
  6. mv
    1. Moves or renames files or directories
    2. Usage:
      • mv source destination
      • mv oldname newname #renaming
  1. rm
    1. Removes files or directories
    2. Usage:
      • rm filename
      • rm -r dirname           
  2. cat 
    1. Display the content of a file
    2. Usage:
      • cat filename 
  3. echo
    1. Prints out a message on the terminal
    2. Usage:
      • echo “Hello World!”
      • Output ‘Hello World!’
  4. chmod
    1. Changes the file permissions
    2. Usage:
      • chmod permissions filename
      • Where permissions can be in numeric  or Symbolic notation and the filename is the target file
      • Example: Numeric notation 
    3. Print out the working directory eg, if you are in Documents the output is Documents
  5. chown
    1. Change the owner of a file
    2. Usage:
      • chown newowner filename
      • chown user:group filename
      • chown :newgroupowner filename
  6. df 
    1. Displays the  disk space usage 
    2. Usage:
      • df -h #displays in human-readable format
  7. nano or vim
    1. Used as text editors in CLI for creating or editing files
    2. Usage:
      • nano filename
      • vim filename
      • If the file does not exist, a new file is created with the filename
  1. wget or curl
    1. Used to download files or access data from the internet 
    2. Usage:
      • wget URL
      • curl -O URL
  2. man
    1. Displays the manual pages for the different commands 
    2. Usage:
      •  man command_name

How can we help?