Linux is an operating system kernel which was released on 17th September 1991 by Linus Torvalds who initially worked on it for his college thesis and later released it as an open-source under the Free Software Foundation.
We can see these days that there are numerous distributions of Linux such as Debian, Fedora, Ubuntu and many more. Red Hat Enterprise is one of the widely used commercial operating systems in which we are going to work on implementing several commands.
Here we are going to learn 10 most essential commands in Linux for personal as well as commercial use.
Software: - Virtual Box, Linux OS (RedHat, Ubuntu)
This is perhaps the most versatile command that can be used by developers to launch and use several shell sessions from a single ssh login. The working is as follows it follows two processes detach and reattach. Detach is you have started some task in that particular session then you need not have it processing on your screen, just Detach it and it will keep running in the background. Once you want to check the progress just reattach the session and you will find the progressed task. This helps in managing several tasks simultaneously for an instance we can put a file to unzip using screen command and start working on other tasks instead of waiting for it to finish to continue with other work.
1) Yum install screen (REDHAT)
Sudo apt install screen (UBUNTU)
2) screen -S file → Give name to the screen within the window
3) Screen -ls → we can monitor the screens of both the categories here as you can see in the screenshot.
4) screen -d 1111 → Detaches screen with 1111 id
5) screen -r 1111 → Reattaches screen with 1111 id
The top command gives real-time information about the CPU processes and the memory being used. It is a continuous task and press q to exit the command.
The kill command is used to abruptly kill a process that might lead to data corruption or data loss. The syntax to kill command is:
-9 → The process is killed instantly and it does not take into reference whether any subprocess associated with it is currently running in background.
-15 → The process is killed once all the subprocesses associated with it are completed.
kill all -> It is used to terminate all processes of that particular task for the user. Eg: - chrome instance is running so killall will kill all its instances.
It is a search utility that is used to search or find a particular pattern or a file. It is difficult to check for a pattern scrolling through several lines manually. This command creates it a lot smoother.
It works well with piping also i.e. output of one command can be used as an input for other commands.
It sets permissions for a particular file of a folder to be accessed by a particular user or root. A flag is associated which defines its accessibility for read and write operations.
- 0: No permission
- 1: To execute
- 2: To write
- 3: To write and execute
- 4: To read
- 5: To read and execute
- 6: To read and write
- 7: To read, write and execute.
Example: To set permission for a file to be readable, writable and executable for owner 6 will be used and to make it writable for a group we will use 6. And executable for others 7 will be used. So our syntax will be:
Command: chmod 765 a2.txt
The lsblk a widely used command which gives us a tree structure of the block devices of our system. It shows the partitions within the storage system along with size, type and mount point. It is installed as part of the util-Linux package.
The df command is one of the most dominant Linux terminal commands that example element knowledge about the disk space on your filesystem.
Real-Time monitoring of disk-management is done using this command which shows detailed info about the mount point, size-available, size-used and no of blocks.
Touch is a very simple command to create a blank validated file that can be written in the future according to the user’s requirement. It’s also the go-to command for changing the timestamps of that particular file.
Demidecode is an effective command which arranges material about hardware of the system. It will list a lot of detail about CPU, Memory, Mainboard, Devices, and Network, etc. by default without providing any option.
This is used mainly by firms and developers to manage huge amounts of data to check and reduce redundancy. It basically compares two sorted files and shows the output in 3 different columns where in the first column: - contents present distinctly in the first file, second column: - contents present distinctly in the second file, third column: - content present in both the files.
Learning python development provide us to access the Linux command and to create the use of OOP (Object Oriented Programming) concepts.
If the 2 files are not sorted then use the sort command to sort the files using the below given syntax.
Explanation: Column 1, 2 will be eliminated and only the third column will be outputted which has the contents prevailing in both the files.
Comm Command with options: