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
- 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:
There are many more, but these should be enough to get anyone started with Linux.