Linux System Admin Commands

Learn via video courses
Topics Covered

Overview

Linux, as a powerful operating system, offers a wide range of administrative commands that allow system administrators to effectively manage and control their systems. These administrative commands in Linux provide robust control over various aspects of the operating system, including user management, process control, file system management, networking, and security.

In this article, we will explore some of the most useful administrative commands in Linux, along with brief explanations and code examples. Below is a comprehensive cheatsheet containing essential administrative commands in Linux for system administrators:

ls - Lists files and directories in a specified directory, providing information such as file names, sizes, permissions, and timestamps.

cd - Changes the current working directory to the specified directory.

pwd - Prints the current working directory, showing the full path of the directory you are currently in.

mkdir - Creates a new directory with the specified name.

rm - Removes files and directories. To remove a directory and its contents, use the -r or -rf option " rm -r directory or rm -rf directory".

cp - Copies files and directories from a source location to a destination

mv - Moves or renames files and directories. To rename a file, provide the new name as the destination "mv old_name.txt new_name.txt". The mv command can be used to move or rename directories as well.

cat - Displays the contents of one or more files.

find - Searches for files and directories based on specified criteria.

ps - Displays information about running processes on the system along with their associated details, including process IDs (PIDs), CPU and memory usage, and execution status.

kill - Terminates the process with the specified process ID.

killall - Terminates processes by their process name. This command terminates all running instances of the process..

ifconfig - Displays the configuration and status of network interfaces. This command can be used to configure and manage network interfaces as well.

netstat - Displays network statistics and active network connections and this command also provides valuable information for network troubleshooting, monitoring network activity, and identifying open network ports.

iptables - Manages firewall rules and network address translation (NAT). The iptables command offers extensive capabilities to configure firewall rules, filter network packets, and perform network address translation for improved network security and traffic management.

useradd - Creates a new user account on the system, including setting the user's home directory and default shell.

passwd - Changes the password for a user account, and ensures secure password management by encrypting and updating the password in the system's password database, allowing users to maintain the security of their accounts.

df - Displays disk space usage for file systems, helps monitor disk usage, identifies storage constraints, and manages disk space efficiently.

du - Shows disk usage of files and directories and helps identify disk space usage of specific files or directories, allowing system administrators to monitor and manage storage consumption effectively.

ssh - Securely connects to a remote system using the Secure Shell protocol.

tar - Archives files and directories into a single file. This command is commonly used for creating backups, compressing files, and transferring multiple files in a single archive.

apt-get - Manages packages in Debian-based distributions, allowing installation, upgrading, and removal of software packages.

usermod - Modifies user account properties, such as the username, home directory, or group membership.

journalctl - Views system log messages, providing a comprehensive view of system events.

chmod - Changes the permissions of files and directories, allowing control over read, write, and execute permissions for owners, groups, and others.

chown - Changes the ownership of files and directories, allowing the assignment of new owners and groups. For a detailed view on chown command visit our website.

systemctl - Controls and manages system services and units, such as starting, stopping, enabling, and disabling services.

grep - Searches for specific patterns or text within files, enabling efficient text processing and filtering.

top - Displays real-time system information, including CPU usage, memory usage, and running processes.

mount - Mounts file systems, allowing access to external devices or remote file systems.

umount - Unmounts previously mounted file systems, ensuring the safe removal of external devices or unneeded file systems.

crontab - Manages scheduled tasks (cron jobs) for users, allowing the automatic execution of commands at specified intervals.

uptime - Displays the system's uptime, showing how long the system has been running.

w - Provides information about currently logged-in users, their activities, and system load averages.

users - Lists the usernames of currently logged-in users.

who - Displays information about users who are currently logged into the system.

whoami - Prints the username of the current user.

less - Displays the contents of a file one page at a time, allowing backward navigation.

more: Displays the contents of a file one page at a time, allowing forward navigation. For details on more commands, visit our website.

cp - Copies files and directories from one location to another.

sort - Sorts the lines of a text file in alphabetical or numerical order.

vi - Opens the Vim text editor, allowing users to create, edit, and save files.

ftp - Connects to a remote FTP (File Transfer Protocol) server, enabling file transfers between systems.

free - Displays information about the system's free and used memory, including swap space.

lsof - Lists open files and the processes that have them open, providing insight into system resources and network connections.

sudo - Allows users to execute commands with elevated privileges. It runs the given command with root privileges.

man - The man command is used to display the manual pages for various commands and system documentation on a Linux system.

These are some of the most essential administrative commands in Linux which expands the range of tools available to system administrators, covering permissions management, service control, text processing, system monitoring, file system management, user administration, and scheduled task management. Familiarizing yourself with these commands will empower you to effectively manage and maintain Linux systems.

Conclusion

  • Linux offers a rich set of administrative commands that empower system administrators to efficiently manage and control their systems.

  • Understanding and utilizing these administrative commands in Linux can significantly enhance system administration tasks, enabling administrators to maintain the stability, security, and performance of their Linux-based environments.

  • These commands are fundamental for system administrators to manage services, monitor disk usage, connect to remote systems, automate tasks, manage packages, modify user accounts, configure network interfaces, and view system logs efficiently.

  • By familiarizing yourself with the commands outlined in this article, you will be well-equipped to handle a variety of administrative tasks and make the most of the Linux operating system's capabilities.

  • Each command has its own set of options and parameters, allowing administrators to fine-tune their actions according to their specific needs.

  • Mastering these administrative commands in Linux will greatly enhance your ability to administer Linux systems effectively.