20 Main Linux commands that you will need daily
In the previous post, we discussed how to install Linux; now, we are going to talk about the most powerful features in Linux, which are Linux commands or shell commands.
For the complete documentation of Linux Commands, you can check Linux Documentation.
The power of Linux is in the power of commands that you can use.
I’m going to talk about the main Linux commands with their main parameters that you might use daily.
List files and folders in the current directory.
to list the content as a detailed list.
Display all files (hidden + non-hidden).
You can combine parameters like this:
Change directory from the current directory to another one.
Will go to the home directory
Copy the source to target.
Interactive mode means waiting for the confirmation if there are files on the target, it will be overwritten.
Recursive copy means include subdirectories if they found.
cp –ir sourcedir targetdir
Move the source to target and remove the source.
Interactive mode means to wait for the confirmation if there are files on the target, it will be overwritten.
mv –i sourceFile targetFile
Delete file or directory, and you must use –r in case you want to delete a directory.
Recursive delete means delete all subdirectories if found.
Interactive means wait till confirmation
Create a new directory.
Delete a directory
Change the owner of a file or directory.
Capital R here means to change ownership of all subdirectories if found, and you must use this parameter if you use the command against a directory.
chown –R root:root myDir
Change the permission of a file or directory.
The mode which consists of 3 parts, owner, group, and others means what will be the permissions for these modes, and you must specify them.
The permission is one of the followings:
Write = 2
Every permission represented by a number as shown, and you can combine permissions.
chmod 755 myfile
That means set permission for the file named myfile as follows:
owner: set it to 7, which means 4+2+1 means read+write+execute.
group: set it to 5, which means 4+1 means read+execute.
other: set it to 5, which means 4+1 means read+execute.
Note: execute for a folder, means opening it.
To find a file in your system, the locate command will search the system for the pattern you provide.
updates the database used by the locate command.
Simply prints today’s date. Just type date on the shell.
Combines several files into an archive and compression if you want.
Create a new archive.
Compress the archive using gzip package.
Compress the archive using the bzip2 package.
Verbose mode means showing the processed files.
Write the output to a file and not to screen.
Unpack files from an archive.
tar –czvf myfiles.tar.gz myfiles
This command will pack and compress all files in folder myfiles to a compressed archive named myfiles.tar.gz.
This command will decompress the archive.
Display file content to screen without limits.
Displays file content with a scroll screen so you can navigate between pages using PgUp, PgDn, Home, and End.
Searches for a string in the specified files and displays which line contains the matched string.
Recursive search inside subdirectories if found.
Insensitive search and ignore case.
Displays file name, not the text lines.
grep –Ril mystring /home
Used to change your user password.
Calculates the disk usage of a file or a directory.
Display human-readable form.
Summarize the output total size.
du –hs /home
Reboot the system immediately. Just type reboot.
Shuts down the system, but make sure to close all of your files to avoid data loss.
That was just some of the leading Linux commands.
Notice that, if you forget any command parameters, just type the command with – -help as a parameter, and it will list the used parameters, so you don’t have to remember all those parameters at the beginning.
To be continued.
Mokhtar is the founder of LikeGeeks.com. He works as a Linux system administrator since 2010. He is responsible for maintaining, securing, and troubleshooting Linux servers for multiple clients around the world. He loves writing shell and Python scripts to automate his work.
6 thoughts on “20 Main Linux commands that you will need daily”
nice well explained for a beginer
Really helpful !
Thanks a lot!
Very helpful. Thanks.
You’re welcome. Thanks!