Basic Terminal Commands

From Grundy
Jump to navigation Jump to search

A list of commonly used commands:

  • sudo - Stands for SuperUser Do. One of the most powerful commands in linux, helps you run other commands with elevated privileges or in other words allow a user with proper permissions to execute a command as another user, such as the superuser.
  • ls - Stands for “list files” and will list all the files in your current directory.
  • pwd - Means “print working directory” and will tell you the exact working directory you are currently in.
  • cd <path> - change the directory to path.
  • mkdir <dir-name> - Use the mkdir command when you need to create a folder or a directory.
  • tree <path> (need to be installed) - display files and directories as a tree structure.
  • rm <filename> ("-rf" danger!!!) - removes a file. -r flag removes all files in a directory.
  • apt - Use apt to work with packages in the Linux command line. Use apt-get to install packages
  • lspci - prints ("lists") detailed information about all PCI buses and devices in the system.
  • su - <username> - Used to switch to a different user. This prompts for the password of the user you switch to.
  • unzip - Use zip to compress files into a zip archive, and unzip to extract files from a zip archive.
  • gunzip - Used to extract the .gz file
  • tar -xvzf - Used to extract the .tar.gz file
  • touch - Used to create a file. It can be anything, from an empty txt file to an empty zip file. For example, “touch new.txt”.
  • pip - Tool for installing and managing Python packages, such as those found in the Python Package Index.
  • echo - Outputs the strings it is being passed as arguments.
  • cat - Used to open a file in terminal in read-only format.
  • more - Used to view the text files in the command prompt, displaying one screen at a time in case the file is large (For example log files).
  • less - Used to view the contents of a text file one at a time. It is similar to more, but has the extended capability of allowing both forward and backward navigation through the file.
  • nano - Nano is a good text editor that denotes keywords with color and can recognize most languages.This command is used to open a file in this text editor.
  • gedit - opens a file in Gedit.
  • vi - Used to open a file in vi.It is also a text editor installed in the Linux. vi is simpler than nano.
  • wget - Wget command is a Linux command line utility that helps us to download the files from the web.
  • curl - The curl command transfers data to or from a network server, using one of the supported protocols.
  • chmod - Use chmod to make a file executable and to change the permissions granted to it in Linux.


An extended list of useful Terminal Commands is available on the "Terminal Commands Beginner" repository by Akash Trehan.

See also