Linux for DevOps

Linux is an Open source UNIX-based operating system.

What is an Operating System(OS)?

An operating system is a collection of programs that coordinates the operation of computer hardware and software.

In simple terms, the hardware and the user cannot directly communicate with each other. They need an intermediary, which is the operating system (OS). The user communicates with the software, and the software communicates with the hardware through the OS. Therefore, the OS acts as an intermediary between the user (via software applications) and the hardware, facilitating communication, managing resources, and providing a platform for running applications.

Why Linux is popular?

Linux is popular for the following features:

  1. Open Source

  2. Highly Secure

  3. Different Distributions are provided

  4. Fast

  5. Multi-user and Multi-tasking

Linux Architecture:

Hardware: This layer consists of physical components like RAM, CPU, Hard drive, etc.

Kernel: It is the heart of an OS. Kernel directly interacts with the hardware.

Shell: An interface between human-readable and machine language. Shell sends the message to Kernel and Kernal converts it to binary language.

File System Hierarchy:

No.LinuxWindows
1We call directoryWe call folder
2We call the root userWe call administrator
3We call packageWe call software
4We call KernelWe call OS
5We use ‘/’We use ‘\’

Commands: Following are a few Linux Commands

  1. ls -Directory listing.

  2. ls -al - Formatted listing with hidden files.

  3. ls -lt - Sorting the formatted listing by time modification.

  4. cd dir -Change directory to dir.

  5. cd - Change to the home directory.

  6. pwd - Shows the present working directory.

  7. mkdir dir - Create a directory dir.

  8. cat>file - Placed the standard input into the file.

  9. touch file - Create or update the file.

  10. rm file - Deleting the file.

  11. rm -r dir - Deleting the director.

  12. rm -f file - Force to remove the file.

  13. rm -rf dir - Force to remove the directory dir.

  14. vi/vim file, nano file - Editors.

  15. cp file1 file2 - Copy the contents of file1 to file2.

  16. cp -r dir1 dir2 - Copy dir1 to dir2;create dir2 if not present.

  17. mv file1 file2 - Rename or move file1 to file2, if file2 is an existing directory.

  18. grep pattern file - Search for a pattern in the file.

  19. cat file - Displays the content of the file.

  20. head file - Displays the top 10 lines of the file.

  21. tail file - Displays the bottom 10 lines of the file.

  22. sudo su - Superuser.

  23. chmod - Change permission

  24. chown - Ownership permission

  25. chgrp - Group permission.