Learning Linux For DevOps
By Sudheer S
Introduction
If you have chosen the DevOps engineering path for your career, Linux system administration skills are a must. Companies run their workloads on Linux on-premise as well as in the cloud. Many developers write software on their Linux laptops and workstations. In this post, I will lay out a plan to master Linux system administration skills. The journey begins with you becoming a Linux desktop user. Gradually, you start using your laptop as a Linux server. Become more productive and create your own labs using virtualization. You will be able to simulate a lot of Linux infrastructure scenarios on your laptop.
The list of commands and concepts are laid out based on my two decades of experience in the fields of Linux system administration, infrastructure engineering, DevOps engineering and cloud engineering.
The article provides references to other Tech Chorus articles. I also provide links to tutorials on Youtube and elsewhere.
Use Linux As Your Primary OS
On your laptop or desktop, install a Linux distribution. Ubuntu and Fedora are popular choices for the desktop. If you cannot use Linux as your host and primary OS, and your host OS is:
- Windows, then install Linux on a virtual machine. WSL is an option.
- Mac, use the virtualization feature.
Learning Tips
There’s a lot of free learning material on the Internet. You can read as much as you want. You can watch as many videos as you want. Keep in mind that practicing on your own Linux computer enables the actual learning. After reading text or watching videos on a topic, make sure you sit down and practice it on your computer. Do not read or watch too much without trying the commands and concepts on your computer. Taking notes helps quickly glace what you have learned and reinforces the learning. Use the Feynman technique to have a greater understanding, ie teach others.
This post lists various Linux commands and short summaries of Linux system administration concepts. It can be a valuable resource for both beginner and experienced Linux users. To best benefit from the blog post, it is important to read through it carefully and take note of any commands or concepts that are new or unfamiliar. It will be helpful to practice using the commands in a test environment to gain hands-on experience and become more comfortable with them. It is important to keep the article as a reference for future use and to revisit it periodically to refresh your memory on commands or concepts. By regularly referencing and practicing the commands and concepts outlined in the post, you can improve your Linux system administration skills and become more efficient in managing and troubleshooting Linux systems.
How long does it take to learn Linux system administration?
Learning Linux system administration can be a fun and rewarding experience. The amount of time it takes to become proficient will depend on various factors, such as your previous experience, the amount of time you can dedicate, and your motivation levels. If you commit to practicing Linux commands and concepts for just thirty minutes each day, you will be well on your way to becoming comfortable with the command line within a month. The key milestones are virtualization and SSH. Within three months, you can expect to feel confident putting up Linux-based workloads in the cloud. If you are new to IT, there may be some additional learning required, such as networking. With dedication and practice, you can become proficient in Linux system administration quickly.
Text Editing
If you are using Linux on your desktop/laptop/workstation, feel free to use any text editor or IDE. The GNOME text
editor gedit
suffices for most simple text editing use cases. Visual Studio Code
and JetBrains and its variants(https://www.jetbrains.com/pycharm/) are popular IDEs for developers.
When you are logged on to a remote shell, text editing using a TUI(Terminal User Interface) is an invaluable skill.
Learn to use one of these text editors:
- Nano - the simple text editor. Launch the editor by executing the command
nano
, type all you want and follow the on-screen instructions to save and exit. - Vim - One easy way to learn Vim is to follow the text tutorials provided by the command:
vimtutor
.
Just execute the commandvimtutor
and follow the on-screen instructions, and you will be all set. - emacs or others - any other TUI editor is fine.
Basic Shell Commands
Most types of work can be done with just a few software applications on a Linux desktop these days:
- A web browser
- A text editor
- A terminal window
One of the hallmarks of the Linux operating system is its shell. By default, most Linux distributions offer BASH shell and the GNOME terminal. Start getting comfortable on the command line, ie, the terminal window.
On day one of the command line, get your feet wet with these easy commands:
- man: The
man
command is a shell command used to display the manual page for a particular command, providing a detailed explanation of its usage, options, and syntax. - apropos: The
apropos
command is used to search the manual page names and descriptions for a given keyword or phrase, displaying a list of all manual pages related to the search term. - date: The
date
command is used to display or set the current system date and time, and allows the user to format the output according to their preference. - passwd: The
passwd
command is used to change the password of the current user or another user account, requiring the user to enter their old password and a new password for authentication. - history: The
history
command is used to display the list of previously executed commands in the current shell session, including their command number, execution time, and the command itself, allowing the user to recall and reuse previous commands.
Eventually, you will be on your way to become the master of the sea of Linux command line.
I encourage you to try out each command on your own laptop - don’t be afraid to copy and paste! Trying out a new command
can seem daunting at first, but it’s actually quite easy once you get started. And if you’re ever unsure about what a
command does or how to use it, the man pages are an excellent resource to gain more insight. Go ahead and give it a
try - you might surprise yourself with what you can accomplish! Remember, the more you practice, the more
confident you’ll become with Linux system administration.
Files And Directories
Linux file system is a hierarchical file system used to organize and store files on a computer’s hard drive or other storage media. The file system is composed of directories, subdirectories, files, and other objects, and is organized in a tree-like structure with a root directory at the top.
In Linux, the root directory is denoted by a forward slash (/
), and all files and directories are located beneath
this root directory. Each directory can contain other directories and files, and can have various permissions and
ownerships that determine who can access, modify, and execute the files within them.
Explore the file system. Navigate the directory tree. Create files and directories. Delete files and directories. Rename files and directories. View the text contents of files. Find files with certain names and types. All of them from the terminal window.
How do I navigate the file system in Linux?
- cat: The
cat
command is used to display the contents of one or more files in the terminal, allowing the user to view the file contents as text. - ls: The
ls
command is used to list the contents of a directory, displaying the file and directory names, their permissions, owner, size, and last modification time. - cd: The
cd
command is used to change the current working directory, allowing the user to navigate between different directories in the file system. - pwd: The
pwd
command is used to display the current working directory, showing the full path to the directory in which the user is currently located. - tree: The
tree
command is used to display the contents of a directory and its subdirectories in a tree-like format, showing the directory structure and file names in a hierarchical order. - mkdir: The
mkdir
command is used to create a new directory, allowing the user to create a directory with a specified name in the current working directory or in a specific location. - rmdir: The
rmdir
command is used to remove an empty directory, allowing the user to delete a directory that does not contain any files or subdirectories. - cp: The
cp
command is used to copy files or directories from one location to another, allowing the user to duplicate files or move them to a different location in the file system. - mv: The mv command is used to move or rename files or directories, allowing the user to change the name of a file or move it to a different directory in the file system.
- rm : The rm command is used to remove files or directories from the file system, allowing the user to delete files and directories permanently.
- find: The find command is used to search for files or directories in a specified location or in the entire file system, based on a set of search criteria, including file name, modification time, size, and owner.
- touch: The
touch
command is used to create an empty file or update the modification time of an existing file, allowing the user to quickly create or modify files without needing to edit their contents. - ln: The
ln
command is used to create links between files or directories, allowing the user to create hard links or symbolic links, which provide a way to reference a file or directory using a different name or location, making it easier to organize files or provide access to commonly used files.
File And Directories: Archiving
Once you get comfortable with the filesystem commands, learn to make archives of files. Explore how to extract the archives. With other operating systems, you might be familiar with the ZIP archive format. In the Linux world, tarballs are used by default.
How can I back up important data on a Linux system, and what tools should I use?
- zip: The
zip
command is used to create compressed archive files in ZIP format, allowing the user to bundle multiple files and directories into a single compressed file for easier distribution and storage. - unzip: The unzip command is used to extract files from a compressed ZIP archive.
- tar: The tar command is used to create or extract files from a tape archive, allowing the user to bundle multiple files and directories into a single file for easier distribution and storage, while preserving file permissions, ownership, and timestamps.
- gzip: The gzip command is used to compress files using the gzip compression algorithm, allowing the user to reduce the file size and save disk space, while preserving file ownership and permissions.
- gunzip: The gunzip command is used to decompress files that were compressed using the gzip compression algorithm, allowing the user to restore the original file from the compressed file.
- bzip: The bzip2 command is used to compress files using the bzip2 compression algorithm, providing a higher compression ratio than gzip, and allowing the user to reduce the file size and save disk space, while preserving file ownership and permissions.
- bunzip: The bunzip2 command is used to decompress files that were compressed using the bzip2 compression algorithm, allowing the user to restore the original file from the compressed file.
Linux System Administration
Congratulations on gaining some operational experience with Linux! It sounds like you’re ready to take the next step towards becoming a Linux system administrator. As a Linux system administrator, you’ll be responsible for designing and managing the networking, compute, and storage infrastructure that helps run workloads. It’s an exciting and rewarding role, and there are plenty of topics to learn and master. Don’t worry if it seems overwhelming at first - with time, dedication, and practice, you’ll become a successful Linux system administrator. Just remember to take it one step at a time and don’t be afraid to ask for help along the way. You’ve got this!
User Management
Learn to create new users, set their passwords and access levels. Learn to create groups and the memberships of users. Learn to restrict file usage for reading, writing and executing. Learn to escalate privileges on the command line.
How do I manage users and permissions on a Linux system?
- id: The
id
command is used to display the user and group IDs of the current user or a specified user account, providing information about the user’s access privileges and group membership. - sudo : The sudo command is used to run a command with elevated privileges or as another user, allowing the user to perform administrative tasks or access files and directories that require root privileges, while maintaining a secure environment.
- su: The su command is used to switch to another user account or become the superuser, allowing the user to perform administrative tasks or access files and directories that require elevated privileges, while temporarily adopting the environment of the target user or superuser.
- adduser: The
adduser
command is used to create a new user account in the system, allowing the user to specify options such as the user’s home directory, login shell, and password, as well as setting up the user’s environment and access privileges. Exploreuseradd
on your own. Left as an exercise for the reader. - usermod: The
usermod
command is used to modify an existing user account in the system, allowing the user to change settings such as the user’s home directory, login shell, password, group membership, and access privileges, among other configurations. - userdel: The
userdel
command is used to delete a user account from the system, allowing the user to remove an existing account, along with its home directory and mail spool, if specified, and optionally transfer ownership of the user’s files to another user account. - groupadd: The
groupadd
command is used to create a new group in the system, allowing the user to create a new group and assign users to it, enabling access control and permission management for files and directories in the system. - groupmod: The
groupmod
command is used to modify an existing group in the system, allowing the user to change the name or ID of a group, or modify its membership by adding or removing users, enabling access control and permission management for files and directories in the system. - groupdel: The
groupdel
command is used to delete an existing group from the system, allowing the user to remove a group and its associated files, such as the group’s home directory and mailbox, if specified, and optionally transfer ownership of the group’s files to another group. - chown: The
chown
command is used to change the ownership of a file or directory in the system, allowing the user to transfer ownership of a file or directory to another user or group, granting them access control and permission management over the file or directory. - chmod: The
chmod
command is used to change the permissions of a file or directory in the system, allowing the user to grant or revoke read, write, and execute permissions to the file or directory for the owner, group, and other users, enabling access control and permission management.
Package Management
One of the first things you will have to do after installing Linux is to install packages. On the Linux desktop, you can use GUI tools to manage packages. Learn to manage packages from the command line. Each distribution does it slightly differently.
In Linux distributions like Ubuntu and Fedora, application installation is typically done through package management systems such as APT (Advanced Package Tool) and DNF (Dandified Yum), respectively. These package management systems provide users with access to a vast repository of software packages that can be easily installed, updated, and managed using command-line tools or graphical interfaces.
How do I install new software packages in Linux?
Want a web browser? Install using the package manager. Want a game? Install using the package manager. Want an office suite? Install using the package manager.
Linux distributions such as Ubuntu and Fedora open the doors for easy installation of thousands of free open source and software applications. You can also install commercial applications using some the same package managers.
apt
,dnf
,apk
:apt
,dnf
, andapk
are package management commands used in Linux distributions to install, update, and remove software packages and dependencies.apt
is used in Debian-based distributions such as Ubuntu and Debian itself,dnf
is used in Fedora-based distributions such as Red Hat Enterprise Linux (RHEL) and CentOS, andapk
is used in Alpine Linux, each providing a simple interface to download and manage packages from software repositories.- Compiling from source: compiling from source involves converting human-readable source code into machine-readable code that can be executed by a computer, and is often done to customize or optimize software for a particular system or use case.
- Package management of language environments: Python
virtuanenv
, NodeJSNPM
, etc. Package management tools like Python virtualenv and Node.js NPM allow for the creation and management of isolated environments for different versions of software packages and dependencies, enabling developers to work on multiple projects with different requirements on the same system.
Processes, Memory And Monitoring
Monitoring and metrics are critical aspects of Linux system administration, providing valuable insights into key resources such as system processes, memory, disk space usage, and network activity. Understanding how to monitor and manage these resources is essential for ensuring optimal system performance and identifying and resolving potential issues before they impact system stability. Commonly used tools for monitoring and managing system resources include command-line utilities and graphical interfaces that provide real-time or historical data on system performance metrics.
- ps: The
ps
command is used to display information about active processes running on the system, allowing the user to view process IDs, resource usage, process status, and other details, making it a useful tool for monitoring and managing system processes. - top: The
top
command is used to display real-time information about active processes running on the system, allowing the user to view CPU usage, memory usage, and other system performance metrics, and interactively sort and filter the information, making it a powerful tool for monitoring and managing system resources. - htop: The
htop
command is an interactive process viewer and system monitor, allowing the user to view real-time information about active processes and system performance, including CPU and memory usage, process status, and system load, and interactively sort and filter the information, making it a powerful and user-friendly tool for monitoring and managing system resources. At this point,top
should be considered a legacy utility. - nice: The
nice
command is used to adjust the priority of a process, allowing the user to control the amount of CPU time allocated to the process, and adjust its impact on system performance, making it a useful tool for managing system resources and preventing high-priority processes from monopolizing system resources. - free: The
free
command is used to display information about system memory usage and availability, allowing the user to view total and available memory, as well as memory usage by process and other system metrics, making it a useful tool for monitoring and managing system resources. - du: The
du
command is used to display the disk usage of files and directories, allowing the user to view the size of individual files or directories, and recursively calculate the total disk usage of a file system or directory tree, making it a useful tool for managing and monitoring disk space usage. - df: The
df
command is used to display information about file system disk space usage, allowing the user to view the total, used, and available disk space on a file system, as well as mount points and file system types, making it a useful tool for monitoring and managing disk space usage on a system. - sar: The
sar
command is used to collect and display system performance metrics, allowing the user to view information such as CPU usage, disk activity, network traffic, and other system metrics over a specified time period, making it a useful tool for monitoring and analyzing system performance and identifying performance issues. - kill: The
kill
command is used to terminate or send signals to processes running on the system, allowing the user to gracefully shut down processes or send specific signals to processes, such as terminating or stopping them, making it a useful tool for managing and controlling system processes. - bg: The
bg
command is used to place a suspended or stopped job in the background, allowing the user to continue working in the current shell while the job runs in the background, making it a useful tool for managing and controlling system processes.
Scheduling, Startup And Resource Restrictions
- Cron: run programs and commands on schedule. The
cron
andcrontab
commands are used in Linux and Unix systems to schedule and automate tasks to run at specific times or intervals. - Systemd:
Systemd
is a system and service manager for Linux operating systems.- systemctl: A command-line tool used to control and manage systemd services, targets, and sockets.
- journalctl: A command used to query and view the logs generated by the systemd journal service.
- SELinux and App Armor: SELinux and AppArmor are both Linux security modules that provide mandatory access control (MAC) to restrict the actions that a process can perform on a Linux system.
- **sestatus`: A command that displays the current status of SELinux on the system, including whether it is enabled or disabled.
- **setenforce`: A command used to change the SELinux mode on the system, such as from enforcing to permissive mode.
- semanage: A command used to manage SELinux policies, including managing SELinux port and file context definitions.
- getenforce: A command used to display the current SELinux mode on the system, such as whether it is in enforcing, permissive, or disabled mode.
- aa-status: A command used to display the current status of AppArmor on the system, including whether it is enabled or disabled.
- aa-enforce: A command used to change the AppArmor mode on the system, such as from enforcing to complain mode.
- aa-complain: A command used to set an AppArmor profile to complain mode, allowing it to generate audit logs but not enforcing security policy.
- cgroup, cgroup2: Cgroups (control groups) and cgroups2 are Linux kernel features that allow for the allocation and management of system resources such as CPU, memory, and I/O usage, for groups of processes. For a beginner, an understanding of
cgroups
should suffice. Feel free to research and learn aboutcgroups
if you have the inclination.
Virtualization
- KVM, Libvirt, Qemu: KVM is a kernel-based virtual machine that provides a virtualization infrastructure for the Linux kernel, while
libvirt
is a virtualization API that enables the management of different virtualization technologies, including KVM, and QEMU is a machine emulator and virtualizer that can be used with KVM to provide full system virtualization. cloud-init
:cloud-init
is a package that allows for the automatic configuration and customization of virtual machine instances on cloud platforms such as AWS, Azure, and Google Cloud, using user data provided at launch time. It can also be used on virtual machines on our laptop.- Read my posts on virtualization
SSH
SSH is a key tool and technology to administer Linux hosts remotely. Have a Linux server somewhere in cloud? Administer it remotely using SSH.
- Starting and enabling the OpenSSH secure shell server
- Accessing a secure shell using password authentication
- Accessing a secure shell using key based authentication.
ssh-keygen
. Read my SSH Key Management 101 blog post. - SSH server configuration.
- SSH client configuration.
~/.ssh/config
Key SSH Commands
- ssh-keygen:
ssh-keygen
is a command-line tool used to generate public and private key pairs for SSH (Secure Shell) authentication and encryption, which can be used to securely connect to remote systems and transfer files. - ssh-copy-id: The
ssh-copy-id
command is used to copy a user’s SSH public key to a remote server, allowing the user to establish passwordless SSH authentication with the server, by adding the public key to the server’s list of authorized keys for the user’s account. - scp: The
scp
command is used to securely transfer files between a local and a remote host using the SSH protocol, allowing the user to copy files and directories between two hosts, while encrypting the data and ensuring data integrity during the transfer. - rsync: The
rsync
command is used to efficiently synchronize files and directories between a local and a remote host, allowing the user to copy only the changed parts of files, and perform differential updates, while preserving file permissions, ownership, and timestamps, making it a popular tool for backup and remote synchronization tasks. - ssh-agent: The
ssh-agent
command is used to manage SSH keys for secure authentication, allowing the user to store private keys in memory, and use them to establish secure connections with remote servers, without having to type the passphrase each time, making it easier to manage and use multiple SSH keys. - ssh-add: The
ssh-add
command is used to add private keys to the ssh-agent, allowing the user to store the key in memory and use it for secure authentication with remote servers, without having to enter the passphrase each time, simplifying the process of managing and using multiple SSH keys.
Linux Kernel Modules And Parameters Tuning
- uname: The
uname
command is used to display system information about the current operating system, including the system name, kernel name and version, machine hardware name, and other system details, making it a useful tool for diagnosing and troubleshooting system issues. - sysctl: The
sysctl
command is used to view, set, or modify kernel parameters at runtime, allowing the user to configure and manage various system settings and performance parameters, making it a useful tool for customizing and optimizing system performance. - lsmod: The
lsmod
command is used to display the currently loaded kernel modules on the system, allowing the user to view information about the modules, such as their size, dependencies, and usage, making it a useful tool for troubleshooting and managing kernel modules. - modprobe: The
modprobe
command is used to add or remove kernel modules from the system, allowing the user to load or unload modules at runtime, and configure various kernel parameters and settings, making it a useful tool for managing and troubleshooting kernel modules on the system.
Shell Scripting
Commands Frequently Used In Shell Scripts
- echo: The
echo
command is used to display a message or a value on the terminal or redirect it to a file, allowing the user to print text or variables, and format output using escape sequences, making it a versatile tool for scripting and automation tasks. - xargs: The
xargs
command is used to pass arguments from standard input to a specified command, allowing the user to perform batch operations on multiple files or directories, or generate command arguments dynamically, based on the input data, making it a useful tool for scripting and automation tasks. - read: used to read input from the user and store it in a variable
Shell Scripting Concepts
- Conditionals
- Looping
- Arguments to scripts
- Standard input, standard output, standard error
- Pipes
- Redirection
- Exit codes
Shell Power User Commands
- head: The head command is used to display the first lines of a file or files, allowing the user to preview the contents of a file, examine file headers, or extract metadata from the beginning of the file, and optionally specify the number of lines to display or use options to display specific sections of the file.
- tail: The tail command is used to display the last lines of a file or files, allowing the user to monitor log files, track changes to a file in real-time, or extract metadata from the end of the file, and optionally specify the number of lines to display or use options to display specific sections of the file.
- more: The more command is used to display the contents of a file or files, allowing the user to view and scroll through long files or large amounts of output in the terminal, and interactively navigate through the file using keyboard shortcuts, making it a useful tool for examining files or reviewing output from other commands.
- less: The
less
command is used to display the contents of a file or files, allowing the user to view and scroll through long files or large amounts of output in the terminal, and interactively navigate through the file using keyboard shortcuts, with additional features such as search and highlighting, making it a more powerful and versatile tool than the more command. - cut: The
cut
command is used to extract columns or fields from a text file or stream, allowing the user to specify the delimiter or separator used in the file, and select specific fields based on their position or range, making it a useful tool for data processing and manipulation tasks. - uniq: The
uniq
command is used to filter out or count duplicate lines from a sorted text file or stream, allowing the user to remove or display only unique lines, and optionally count the number of occurrences of each unique line, making it a useful tool for data processing and analysis tasks. - sort: The
sort
command is used to sort lines of text in a file or stream, allowing the user to specify the sorting order, the field delimiter, and other sorting options, making it a useful tool for organizing and analyzing data in various formats. - tee: The
tee
command is used to display and redirect the output of a command to both the terminal and a file, allowing the user to simultaneously view and store the output, and optionally append the output to an existing file, making it a useful tool for logging, debugging, and testing commands.
Text Searching and Manipulation: Regular Expressions
Learn some basic regular expressions and then proceed to use these commands:
- grep: The
grep
command is used to search for patterns in text files or input streams, allowing the user to search for specific words, phrases, or patterns, and perform actions on the matching lines, making it a powerful tool for searching and processing text data. - awk: The
awk
command is a versatile programming language and text processing tool, allowing the user to manipulate and analyze text data, perform calculations and transformations, and extract information from structured text files, making it a powerful tool for text processing and data analysis. - sed: The
sed
command is a stream editor used to perform basic text transformations on an input stream, allowing the user to search for patterns, replace text, insert or delete lines, and perform other modifications to text data, making it a powerful tool for processing and manipulating text data.
Profiles
- ~/.bashrc:
~.bashrc
is a shell script that is executed by the Bash shell every time a new interactive shell is started, allowing the user to customize their shell environment by setting environment variables, defining aliases, and adding functions or scripts. - ~/.profile:
~/.profile
is a shell script that is executed by the login shell every time a user logs in, allowing the user to set environment variables, define aliases, and run scripts or programs that need to be executed at login time, among other configuration tasks.
Environment Variables
- env: The
env
command is used to display or set environment variables for the current shell or a specified command, allowing the user to view or modify the environment variables used by processes and scripts on the system, making it a useful tool for managing and configuring the system environment. - export: The
export
command is used to set an environment variable and export it to child processes and subshells, allowing the user to make environment variables available to all processes and scripts that are spawned from the current shell, making it a useful tool for configuring the system environment and passing variables between processes.
Command Aliasing
- alias: The
alias
command is used to create a shorthand or alias for a longer command or a series of commands, allowing the user to save time and typing effort, and customize their command line experience. - unalias: The
unalias
command is used to remove an alias that was previously defined using the alias command, allowing the user to delete an existing alias and prevent it from being used in future command line sessions.
Linux Networking
Linux offers robust networking tools to do almost anything with networking. You can turn a Linux host into a router or a firewall. You can host network services effortlessly on a Linux server such as web server(HTTP server), or a database server or Git server. Learn to configure networking and tools that aid in network troubleshooting.
Essential Linux Networking Commands
How do I configure network settings on a Linux system?
- ping: The
ping
command is used to test the connectivity between two network hosts by sending ICMP echo request packets to the destination host, and measuring the round-trip time and packet loss, making it a useful tool for diagnosing network connectivity issues and troubleshooting network problems. - dig: The
dig
command is a DNS (Domain Name System) tool used to query DNS servers and retrieve information about domain names, including IP addresses, name servers, and other DNS records, making it a useful tool for troubleshooting DNS issues and verifying DNS configuration. - whois: The
whois
command is a tool used to retrieve information about domain names and IP addresses, including the registrar, name servers, registration date, and other contact information, making it a useful tool for verifying domain ownership and managing domain name registrations. - nslookup: The
nslookup
command is a DNS tool used to query DNS servers and retrieve information about domain names, including IP addresses, name servers, and other DNS records, making it a useful tool for troubleshooting DNS issues and verifying DNS configuration. - host: The host command is a DNS tool used to perform DNS lookups and retrieve information about domain names, including IP addresses, name servers, and other DNS records, making it a useful tool for troubleshooting DNS issues and verifying DNS configuration.
- traceroute: The
traceroute
command is a network diagnostic tool used to trace the path of network packets from a source host to a destination host, showing the sequence of routers or hops that the packets traverse, along with their round-trip times, making it a useful tool for diagnosing network connectivity issues and identifying network latency problems. - curl: The curl command is a tool used to transfer data from or to a server using various protocols, including HTTP, HTTPS, FTP, SCP, and more, making it a useful tool for performing web requests, downloading or uploading files, and interacting with various network services and APIs.
- wget: The
wget
command is a tool used to download files from the Internet using various protocols, including HTTP, HTTPS, FTP, and more, making it a useful tool for automating file downloads, batch downloads, and mirroring websites. - ip: The
ip
command is a powerful tool used to manage and configure network interfaces and routes on Linux systems, including assigning IP addresses, configuring network settings, and managing network interfaces and routing tables, making it a useful tool for troubleshooting network connectivity issues and managing network resources.
Linux Networking Commands: Intermediary To Expert Level Administrator
- bridge: The bridge command is a tool used to manage and configure network bridges on Linux systems, which allow multiple network interfaces to function as a single logical interface, making it a useful tool for setting up virtual networks and managing network resources in virtualized environments.
- nmcli: The
nmcli
command is a tool used to manage and configure network connections using NetworkManager, a daemon that provides automatic network configuration and connection management on Linux systems, making it a useful tool for managing network connections, Wi-Fi settings, and VPN configurations from the command line. - netplan: The
netplan
command is a tool used to configure and manage network settings on Ubuntu systems using YAML configuration files, allowing users to easily configure network interfaces, IP addresses, routes, and other network settings on their systems. - ss: The
ss
command is a powerful tool used to investigate sockets and network connections on Linux systems, providing detailed information about active network connections, listening sockets, and socket statistics, making it a useful tool for troubleshooting network issues and analyzing network performance. - netcat: The
netcat
command, also known as nc, is a tool used to create and manipulate TCP and UDP connections on Linux systems, allowing users to establish network connections with remote hosts, send and receive data over network sockets, and scan network ports for open services. - netstat: The
netstat
command is a tool used to display network connections and statistics on Linux systems, providing information about active network connections, listening sockets, and network interface statistics, making it a useful tool for troubleshooting network issues and analyzing network performance. - nmap: The
nmap
command is a tool used for network exploration and security auditing, allowing users to scan networks, identify open ports and services, detect vulnerabilities and security issues, and generate detailed reports about network devices and services. - Firewall using
iptables
,firewalld
,ufw
:iptables
,firewalld
, andufw
are Linux firewall management utilities that provide users with tools to manage incoming and outgoing network traffic, set up rules and policies, and secure their network and systems from unauthorized access and attacks.iptables
is a traditional command-line tool, whilefirewalld
andufw
provide more modern, user-friendly interfaces for managing firewall configurations. - tcpdump:
tcpdump
is a command-line network packet sniffer that captures and displays network packets transmitted over an interface in real-time or saved to a file for later analysis. - lsof: The
lsof
command lists open files and the processes that have them open.
Linux Storage
Linux offers great features for networking. It also offers great features to house storage services. Learn the fundamental commands related to storage and memory.
- mount: The mount command in Linux is used to attach a file system to the system’s directory tree, making its contents accessible to the system and its users.
- umount:
umount
is a shell command used to unmount file systems mounted with the mount command, specifying the mount point or device to unmount. - fsck: fsck stands for “file system check” and is a command used to check and repair inconsistencies in file systems.
- mkfs: The mkfs command is used to create a new file system on a storage device, such as a hard drive or a USB flash drive.
- fdisk: The fdisk command is a utility for partitioning hard disk drives into individual sections, allowing multiple operating systems to coexist on a single drive, and for creating and manipulating disk partitions.
- resize2fs: resize2fs is a shell command used to resize ext2, ext3, or ext4 file systems in Linux, allowing you to enlarge or shrink the size of an existing file system while it is still mounted.
- lsblk: lsblk is a shell command that lists all the available block devices (such as hard drives, USB drives, etc.) in a tree-like format, along with their mount points and other important information.
- dd: dd is a command that can copy and convert files, block by block, with options for adjusting block size, input/output file and more.
- swapon: used to enable swapping on a specified device or file.
- swapoff: used to disable swapping on a specified device or file.
- mkswap: used to create a swap area on a specified device or file.
Linux Storage Concepts
/etc/fstab
:/etc/fstab
is a configuration file in Linux and Unix-based operating systems that lists the file systems and devices to be mounted at boot time, along with their respective mount points, mount options, and file system types.- NFS: NFS (Network File System) is a distributed file system protocol that allows a user on a client computer to access files over a network as if they were stored locally, providing transparent access to remote file systems.
- LVM: LVM (Logical Volume Manager) is a tool used to manage disk storage on Linux systems by abstracting physical storage devices into logical volumes, allowing for flexible allocation and resizing of storage resources as needed.
- Samba and SMB: Samba is an open-source software suite that enables file and print services between different operating systems, while SMB (Server Message Block) is a protocol used by Samba and Windows operating systems for sharing files, printers, and other resources over a network.
- SSHFS: SSHFS (Secure Shell File System) is a file system client that enables users to securely mount and access remote file systems over an SSH (Secure Shell) connection, allowing for seamless file access and transfer over the network.
Configuring Some Popular Services
- Database server. Learn to install, configure and use a database server such as MariaDB, MySQL or PostgreSQL. Useful and required in many web applications. One popular use case is Wordpress.
- Nginx web server. Learn some basic HTML and CSS and create a website for yourself. Host it on your Linux server using Nginx or Apache. Then host other websites and web applications on your Linux server. Nginx is a key open source software in this realm.
- Language runtimes for Python, PHP, Java, JavaScript, Go, etc. Learn to install packages and runtimes to run programs written in various languages.
Manage Containers
Containers and Kubernetes have become the dominant solution for hosting applications in today’s technological landscape. Nowadays, it is hard to ignore containers, especially for a Linux system administrator. Play with Docker or Podman. Create your own application, package it in a container and run it on a platform capable of hosting containers.
- Install and configure a container runtime suitable for laptop/desktop/workstation. Docker or Podman.
- Run containers on laptop. Explore and use popular container images such as Busy Box, Nginx, Redis, MySQL, PostgreSQL, etc.
- Package your application into a container image. Push the container image to a registry.
- Install and configure a container runtime suitable for servers. Docker or Podman.
- Deploy containerized applications. Fetch the container image from the registry and run them on your server.
- Learn about container storage and networking.
Linux Certifications
What’s your take on certifications for a Linux system administrator?
Let’s focus on the most important point of certification: learning. If the certification helps you to actually learn Linux system administration skills, go for it.
Certifications also provide you a structured way to learn Linux. In some situations, the certification can help you stand out in the crowd. If the certification exam is lab based, it is all the more better.
On the flip side, certifications are expensive and can be gamed. They encourage you to pass the exam more than they encourage you to improve your Linux administration skills. Often the training industry oversells the dream job to the aspirants. Look out for snake oil sales schemes.
When I am hiring Linux system administrators, I look for experience, exposure and practical skills rather than certifications. I encourage you to make lots of experiments and do-it-yourself projects.
References
- The DevOps Path
- DevOps Challenges And Project Ideas
- DevOps Lab: Run Your Own DNS Server
- firewalld Cheat Sheet
- The Ansible Learning Path
Linux Learning Resources
Shell Commands And Basics Of Linux
- Video by Free Code Camp: Command Line Crash Course
- Video by Free Code Camp: The 50 Most Popular Linux & Terminal Commands - Full Course for Beginners
- Video by Geek’s Lesson: Linux Command Line Full course: Beginners to Experts. Bash Command Line Tutorials
- Video playlist by FactorPad: Linux Essentials Tutorials
Systemd
- Video playlist by Linux systemd: Linux systemd
- Video by DevDungeon: Creating systemd Service Files
Networking
- If you are new to computer networking, take this course by Google for free: The Bits and Bytes of Computer Networking
- Video by freeCodeCamp.org: Computer Networking Course - Network Engineering CompTIA Network+ Exam Prep
- Video playlist by NetworkChuck You Suck at Subnetting
- Read the Wikipedia page for the OSI model.
- Video by Tony Teaches Tech: How To Lookup DNS Records With The dig Command
- Video by KeepItTechie: IP Command | Configure Network Interfaces on Linux
- Ubuntu UFW Wiki Page