Most commonly used Linux commands

Prakhar S
4 min readMar 3, 2022
Photo by Cornelius Ventures on Unsplash

If you are starting out in any branch of computer science, whether software development, data science, software, and data engineering, should at the least become familiar with basic Linux commands.
Here I am listing a few of them:

  • man

Short for ‘manual’: it provides the details about any command in Linux, for example, to know about ‘cp’ command in Linux:

$ man ls
  • pwd

Short for ‘present working directory’, gives the directory the user is in currently

  • cd

Stands for ‘change directory’, to change the current directory to another

  • echo

To print anything to the terminal

  • whoami

Gives the name of the current user

  • sudo

This allows making admin-level changes, which the current user might not have permission to do.

  • ls

List all files in the current directory.

  • touch

Create a new file in the current directory

  • nano or vi

Opens any text file in edit mode.

  • cp

Copies a file from one directory to another

  • mv

Moves a file from one directory to another

  • rm

Removes a file from the current directory

  • mkdir

Creates a new directory

  • rmdir

Removes an existing empty directory

  • cat

Shows the contents of a text file

  • grep

Looks for a text in a text file

  • ls -l

Lists all the files and folders along with the permissions of the Users, Groups, and Others

Users : The user who creates the files.

Groups: The group the users belong to.

Other: Any other user who is not the user and not in the group

The first part above specifies the permissions of the file/folder.

‘d’ denotes a directory. For files, this will be shown as ‘-’.

The first three letters after ‘d’ denote the User level permissions, where

‘r’ denotes the read permissions

‘w’ denotes the write permission

‘x’ denotes execute permissions

The next three letters denote Group level permissions

and the last three letters before @ denote other’s permissions

https://www.guru99.com/file-permissions.html#:~:text=Linux%20divides%20the%20file%20permissions,ownership%20of%20a%20file%2Fdirectory.
  • chown

Stands for ‘change owner’. Changes the owner of a file as shown below

  • chmod

Changes the read-write-execute permissions of a file. For example, ‘chmod 777’ changes the permissions of the file to give read-write-execute access to all the users.

The details for the numbers is given below:

https://www.guru99.com/file-permissions.html#:~:text=Linux%20divides%20the%20file%20permissions,ownership%20of%20a%20file%2Fdirectory.

There are many more, but these should be enough to get anyone started with Linux.

--

--