Table of contents
What is Linux?
Linux is an open-source and community-developed operating system for computers, servers, mainframes, mobile devices, and embedded devices. It has support on almost every major computer platform including x86, ARM etc, making it one of the most widely supported operating systems.
Every Linux-based OS contains the Linux Kernel—which manages hardware resources—and a set of software packages that make up the rest of the operating system.
Why Linux is popular?
More than 90% of the top 1000 websites in the world use Linux as the dominant system. Linux is different from the rest of the operating systems in many important aspects. Some of them are as follows
1. Free – First, and perhaps most importantly, Linux is free. You do not have to spend any amount to download and use it, unlike Windows.
2. Open Source – Linux is open-source software. The code used to create Linux is free and available to the public to view, edit, and—for users with the appropriate skills—contribute to.
3. Secure – Once you have Linux installed on your system, there is no need to use an antivirus! Linux is a highly secure system. Moreover, there is a global development community constantly looking at ways to enhance its security. Each upgrade makes the OS becomes more secure and robust.
4. Stability and Performance – Linux provides very high stability i.e. it does not need a reboot after a short period of time. Your Linux system rarely slows down or freezes. You can work without any disturbance on your Linux systems. Linux provides remarkably high performance on various networks and workstations.
Basic Linux Commands
cd
The cd command in Linux stands for change directory. It is used to change the current directory of the terminal
whoami
Displays the currently logged-in user name.
uname
Displays the name of the kernel.
uname -r
Displays the version of the kernel.
echo
Used to print the text mentioned inside the quotes(" ") on the screen.
ls
This command lists all the contents in the current working directory.
sudo
This command executes a particular command with root/ superuser privileges.
pwd
pwd (present working directory) displays the present working directory. The path of you are currently in the directory.
mkdir<directoryname>
Creates a directory named <directoryname> in the present working directory.
rmdir<directoryname>
Removes a directory named <directoryname>.
rmdir : To remove an empty directory.
rm -r : To remove a directory with its contents.
touch<filename>
Creates a file named <filename> in the present working directory.
touch filename{1..10} : Creates 10 files as specified in '{}'.
touch <filename1> <filename2>... : Creates multiple files as mentioned at once.
vim
vim is a file editor. Vim Editor is among the mostly used file editor in Linux.
cat
To view the contents of a file, you can use the command. It displays the entire contents of a file.
head
To read the top 'n' lines of the file by displaying it on the screen.
tail
To read the bottom 'n' lines of the file by displaying it on the screen.
grep
This command searches for a particular string/ word in a text file. This is similar to “Ctrl+F” .
sort
This command sorts the results of a search either alphabetically or numerically. It also sorts files, file contents, and directories.
sort -r: This flag returns the results in reverse order.
sort -f: This flag does case-insensitive sorting
sort -n : This flag returns the results as per numerical order
chmod
This command is used to change the access permissions of files and directories.
We can see the permissions of all the contents in the present working directory, by using ls -al command.
chmod <permissions of user,group,others> {filename}
4 – read permission
2 – write permission
1 – execute permission
0 – no permission
cp
cp command is used to copy files from the source path to the destination path.
mv
The mv command moves files and directories from one directory to another or renames a file or directory.
Conclusion
In the dynamic world of DevOps, Linux stands tall as the go-to operating system for engineers worldwide. Its open-source nature, cost-effectiveness, and robust security make it a top choice. With Linux, DevOps professionals experience stability and high performance, allowing seamless development and deployment processes. Mastering essential Linux commands empowers engineers to efficiently manage files and directories, streamlining their workflow. Embrace Linux, and unlock its full potential to elevate the DevOps journey. 🚀