Sitemap

Most commonly used Linux commands

4 min readMar 3, 2022

--

Press enter or click to view image in full size
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

Press enter or click to view image in full size
  • cd

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

Press enter or click to view image in full size
  • echo

To print anything to the terminal

Press enter or click to view image in full size
  • whoami

Gives the name of the current user

Press enter or click to view image in full size
  • 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

Press enter or click to view image in full size
  • 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

Press enter or click to view image in full size
  • mkdir

Creates a new directory

Press enter or click to view image in full size
  • rmdir

Removes an existing empty directory

Press enter or click to view image in full size
  • cat

Shows the contents of a text file

Press enter or click to view image in full size
  • grep

Looks for a text in a text file

Press enter or click to view image in full size
  • 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

Press enter or click to view image in full size

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

Press enter or click to view image in full size
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

Press enter or click to view image in full size
  • 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.

Press enter or click to view image in full size

The details for the numbers is given below:

Press enter or click to view image in full size
Press enter or click to view image in full size
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.

--

--