Day 2 : Linux for DevOps
Why is Linux Important for DevOps?
One of the main practices carried out by the majority of IT companies is infrastructure automation. In the area of automating infrastructure, Linux is widely used. The creation of instances takes less time with Linux’s assistance, and operations run more quickly.
Linux makes automation easy hence, it has become an integral part of DevOps professionals. The best advice anybody can get while starting their journey in DevOps is to learn and understand the basics of Linux thoroughly. This makes the DevOps career path easy in the future. Linux is going to be there no matter what. You have to face it and work with it, to become a great DevOps engineer.
Linux and DevOps: A Relationship
It’s important to remember that the majority of enterprises today are running development projects which already have Linux supporting their operations. Although I realize there’s areas of DevOps that focus on Windows, the majority of projects in your DevOps future will, at their core, be Linux-based. Some companies even go as far as developing their own Linux distro with custom capabilities.
Admittedly, there are opportunities out there for Windows DevOps engineers. After all, we now have a huge increase in the number of startups and new companies entering the software development world. However, the majority of employers are using a form of operating system based on Linux. Which is why knowledge of Linux is an essential component to have within your background as part of a solid foundation of experience to succeed as a DevOps engineer.
Basic Linux commands -
1) ls: List files and directories.
Example: ls — Lists files and directories in the current directory.
2) cd: Change directory.
Example: cd /path/to/directory — Changes the current directory to the specified path.
3) pwd: Print the current working directory.
Example: pwd — Displays the current working directory.
4) mkdir: Create a new directory.
Example: mkdir new_directory — Creates a new directory named “new_directory” in the current directory.
5) rm: Remove files and directories.
Example: rm file.txt — Deletes a file named “file.txt”.
Example: rm -r directory — Removes a directory and its contents recursively.
6) cp: Copy files and directories.
Example: cp file.txt new_location/ — Copies a file named “file.txt” to the “new_location” directory.
&) mv: Move or rename files and directories.
Example: mv file.txt new_location/ — Moves a file named “file.txt” to the “new_location” directory.
Example: mv old_name.txt new_name.txt — Renames a file from “old_name.txt” to “new_name.txt”.
8) cat: Concatenate and display file contents.
Example: cat file.txt — Displays the contents of a file named “file.txt”.
9) grep: Search for patterns in files.
Example: grep “pattern” file.txt — Searches for the specified pattern in the contents of “file.txt”.
10) ssh: Securely connect to remote machines.
Example: ssh username@hostname — Establishes an SSH connection to the remote machine with the specified username and hostname.
11) chmod: Change file permissions.
Example: chmod 755 file.txt — Sets the permissions of “file.txt” to read, write, and execute for the owner, and read and execute for others.
12) chown: Change file ownership.
Example: chown username file.txt — Changes the ownership of “file.txt” to the specified username.
13) ps: Display running processes.
Example: ps aux — Lists all running processes on the system.
14) systemctl: Control system services.
Example: systemctl start servicename — Starts a system service with the specified name.
15) ifconfig: Configure network interfaces.
Example: ifconfig eth0 up — Brings up the network interface named “eth0”.
16) netstat: Network statistics.
Example: netstat -tuln — Displays a list of all active network connections and listening ports.
17) ping: Send ICMP echo requests to a host.
Example: ping google.com — Sends ICMP echo requests to the specified host (in this case, “google.com”).
18) traceroute: Trace the route packets take to a destination.
Example: traceroute google.com — Traces the route that packets take to reach the specified destination (in this case, “google.com”).
19) curl: Transfer data from or to a server using various protocols.
Example: curl https://www.example.com — Retrieves the content of a webpage located at the specified URL.
20) mkdir : Make the directory.
Example : mkdir NewFolder, will make a new folder.