Essential Linux Commands: A Comprehensive Guide


Linux commands are the building blocks of efficient system administration and daily tasks for Linux System Administrators and DevOps professionals. In this comprehensive guide, we will explore the most frequently used Linux commands, categorized into various groups, each serving a specific purpose.

File and Directory Management

  • ls – List files and directories in the current directory. It provides a list of files and directories in the current working directory by default, but you can specify a directory path as an argument to list its contents.
  • pwd – Print the working directory path.It stands for “print working directory.” It displays the full path of the current directory you are in. This is helpful when you need to know your current location in the directory tree.
  • cd – Change the current directory.Is used to navigate between directories. You can use it to move into a specific directory by providing the directory name as an argument or by using relative or absolute paths.
  • mkdir – Create a new directory. It stands for “make directory” and its used to create new directories or folders. You specify the directory name as an argument, and it will be created in the current working directory.
  • rmdir – Remove an empty directory. Is used to remove empty directories. If a directory contains any files or subdirectories, it cannot be removed using rmdir.
  • touch – Create an empty file or update the timestamp of an existing file. It creates an empty file with the specified name if it doesn’t exist. If the file already exists, touch update its timestamp to the current time.
  • cp – Copy files or directories. Is used to copy files and directories from one location to another. You specify the source file or directory and the destination where you want to copy it.
  • mv – Move or rename files or directories. Is used for both moving and renaming files and directories. It allows you to change the location of a file or directory or change its name.
  • rm – Remove files or directories. Is used to delete files or directories. Be cautious with this command, as it permanently removes files and directories, and they cannot be easily recovered.
  • tee – Read from standard input and write to standard output and files simultaneously. Is often used in pipelines. It reads from standard input, allows you to view the input, and simultaneously writes it to one or more specified files. It’s useful for logging or capturing output while still displaying it.

File Viewing and Editing

  • cat – Display the contents of a file. Is used to display the entire contents of a text file in the terminal. It can also be used to concatenate and display multiple files.
  • less – View text files one screen at a time. Is a pager that allows you to view text files one screenful at a time. You can scroll forward and backward through the file, making it useful for reading large text files.
  • more – View text files page by page. Similar to less, more allows you to view text files one page at a time. You can press the spacebar to advance to the next page.
  • nano – A simple and user-friendly text editor. Nano is a straightforward text editor with an easy-to-use interface. It’s suitable for quick edits or creating new text files in the terminal.
  • vim – A powerful and highly configurable text editor. Vim is a highly customizable and powerful text editor, especially popular among programmers and system administrators. It offers extensive features and plugins for efficient text editing.
  • gedit – A graphical text editor available in many Linux desktop environments. It provides a user-friendly interface for editing text files.

Process Management

  • ps – List running processes. It provides a list of currently running processes. It displays process information such as process IDs (PIDs), CPU and memory usage, and more.
  • top – Display real-time system statistics, including running processes. Its an interactive command that provides real-time system statistics, including CPU usage, memory usage, and a list of running processes. It updates continuously and allows you to manage processes interactively.
  • kill – Terminate a process by process ID (PID). Allows you to send signals to processes, usually to terminate them. By default, it sends the SIGTERM signal, but you can specify different signals to control how a process is terminated.
  • killall – Terminate processes by name. Is used to terminate processes by their names rather than their PIDs. Be cautious when using this command to avoid unintentional process termination.
  • pstree – Display running processes as a tree. It presents a visual representation of running processes in a hierarchical tree structure, making it easier to understand process relationships.
  • htop – An interactive process viewer. Is an enhanced version of the top command with a more user-friendly interface. It provides a real-time view of system resource usage and allows for interactive process management.

System Information

  • uname – Display system information, such as the kernel name and version. It provides information about the system, including the kernel name, hostname, kernel release, kernel version, and hardware architecture.
  • df – Show disk space usage. It displays information about available disk space on mounted file systems. It shows details such as the filesystem, total space, used space, and available space.
  • du – Display the file and directory space usage. It stands for “disk usage” and is used to estimate file and directory space usage. It can display the total size of directories and subdirectories.
  • free – Show system memory usage. It provides information about system memory (RAM) usage, including total, used, and free memory, as well as swap space statistics.
  • lscpu – Display CPU information. It provides detailed information about the CPU, including the number of CPUs or cores, CPU family, model, and more.
  • lshw – List hardware configuration. Its a command that lists detailed hardware information about the system, including information about the CPU, memory, storage devices, and more.
  • lsblk – List block devices. It lists block devices such as hard drives and partitions, providing information about their sizes and mount points.

User and Group Management

  • passwd – Change a user’s password. Is used to change a user’s password. When executed without arguments, it changes the password of the current user.
  • useradd – Create a new user. Is used to create new user accounts on the system. You can specify various options to set user attributes and home directories.
  • userdel – Delete a user. Is used to remove user accounts from the system. By default, it deletes the user’s home directory and mailbox.
  • usermod – Modify user attributes. It allows you to modify user account attributes, such as the user’s home directory, shell, or group membership.
  • groupadd – Create a new group. Is used to create new groups on the system. Groups are used to manage user access permissions.
  • groupdel – Delete a group. Is used to remove groups from the system. Be cautious when deleting groups, as it may affect user access permissions.
  • groups – Display groups a user belongs to. It shows the group memberships of a user. It lists all the groups to which a user belongs.
  • id – Display user and group information. It provides detailed information about the current user, including user ID (UID), group ID (GID), and group memberships.

Network Configuration and Monitoring

  • ifconfig – Display and configure network interfaces (deprecated, use ip instead). ifconfig was historically used to configure and display network interfaces but is now considered deprecated in favor of the ip command.
  • ip – Show and manipulate network interfaces and routing. Is a versatile command for configuring and managing network interfaces, IP addresses, and routing on Linux systems.
  • ping – Send ICMP echo requests to test network connectivity. Is used to test network connectivity by sending ICMP echo requests to a specified host or IP address and receiving ICMP echo replies.
  • netstat – Display network statistics and connections (deprecated, use ss instead). Netstat was used to display network statistics and connections but is now considered deprecated in favor of the ss command.
  • ss – Show socket statistics. Ss is a modern replacement for netstat and provides detailed information about network sockets, including listening ports and established connections.
  • traceroute – Trace the route packets take to a destination. Traceroute is used to trace the path that packets take from the local system to a remote host, showing each intermediate hop along the way.
  • ssh – Securely connect to remote systems. Ssh (Secure Shell) is used to establish secure, encrypted connections to remote systems for command-line access or file transfer.
  • nc – Netcat for network connectivity. Nc (netcat) is a versatile utility for network connectivity. It can be used for tasks like port scanning, banner grabbing, and transferring files over a network.

Package Management

Package management commands depend on the Linux distribution in use

  • apt-get and apt (Debian/Ubuntu) – Used for package management on Debian-based systems.
  • yum and dnf (Red Hat/CentOS/Fedora) – Used for package management on Red Hat-based systems.
  • rpm (Red Hat Package Manager) – Directly manipulate RPM packages.
  • dpkg (Debian Package Manager) – Directly manipulate Debian packages.
  • snap (Snap packages) – Manage software packages in the Snap format.
  • zypper (openSUSE) – Package management for openSUSE-based systems.


These Linux commands are essential for various system administration and daily tasks. Understanding how to use them effectively is fundamental for Linux professionals. Whether you’re managing files and directories, viewing and editing text files, monitoring processes and system information, managing users and groups, configuring and monitoring networks, or handling packages, these commands are indispensable for Linux system administration and DevOps tasks.