Other Parts of This Series:
- Part 9: DevOps - Step By Step Learning : Part 9 (Linux Package, User Permission, System Process Management)
DevOps Linux Networking (Photo Credit: Unsplash)
Story:
Rasel learned some of the basic and necessary things of linux. Now he wanted to finish his initial linux learning with one of the most important topics like linux networking and service manager. As devOps is heavily related to networking and service management and linux networking commands and systemctl command are essential for them. After that, he wanted to practice his learning with writing a little script.
Linux Networking:
As Linux is heavily used in server side, so managing and debugging the service to service connectivity is essential. And Linux networking related commands helps here to easily manage and operate those tasks.
| |
This command show all network interfaces and IPs.
| |
This is also do the same, but older command (may need to install).
| |
This check if the system can reach Google domain name, also can use ip directly.
| |
This check if port 80 is open, and it is older and insecure command for testing connectivity.
| |
This show listening ports and services.
| |
This also do this but older alternative (install if needed).
| |
This shows IP and DNS info,
| |
This show more detailed DNS query (install dig if needed).
| |
This is used to log in to remote server.
| |
This use SSH key to connect or log in.
| |
This is used to generate a key pair.
| |
This copies your local key to remote.
| |
This securely copy file to another remote server.
| |
This securely download file from remote.
Example:
| |
Compression and Archiving:
Sometimes we need to compress and archive files, folders to reduce its original size before move from local to remote server. It saves bandwidth and perform file transfer faster. Linux gives us many ways to do so.
| |
This compress folder.
| |
This do the opposite and extract contents.
| |
This create zip.
| |
This extract zip.
| |
This compress.
| |
This decompress.
Example:
System / Service Manager:
In server we deployed or install services. And its natural that we need to start, stop, enable auto start on startup and know their running status. Linux systemctl commands helps us to easily do that.
| |
This start a service.
| |
This stop a running service.
| |
This restart a stopped service.
| |
This gives the service status.
| |
This enables a service auto start on boot.
| |
This disables a service auto start on boot.
| |
This gives list of all service.
Example:
| |
Little Scripting:
Scripting is the way of combining multiple commands in a single file (generally a bash file) and executes all the command at all. It helps to automate repetitive task and command to execute at once.
Like below we create a simple script that will create a file, add some text and print a hello message.
Step 1 (create a bash file):
| |
Step 2 (Add the commands):
Step 3 (Make it executables):
| |
Step 4 (Run it):
| |
Summary:
Linux networking tools like ip, ping and ss help you check connections, IPs, and open ports. Commands like ssh helps to remote login and telnet is useful for check connectivity. For moving files between systems, scp is useful. Compression tools like tar, zip, gzip let you package and reduce file sizes. systemctl is used to manage services like web servers (e.g., start, stop, enable on boot). Finally, with basic shell scripting using bash, you can combine multiple commands together to automate repetitive tasks.