DEV Community

Cover image for Essential Linux Commands Map
Altair Lage
Altair Lage

Posted on

Essential Linux Commands Map

Essential Linux Commands Map

With the evolution of operational systems visual environments, the majority of users don't ever need to use the command terminal for their daily activities. Most users do not execute any advanced system tasks, and when they do it, the configuration apps are more than enough. You probably know some Windows users that never opened the "black screen" for anything.
The same happens with Linux. It evolved its visual environments, also known as Desktop environments (DEs), to a point that the terminal is not necessary for almost 100% of an average user needs. The most popular choices, GNOME, KDE, and XFCE, allow system configurations and troubleshooting from the UI. But when you need advanced troubleshooting and system administration, the terminal is always your best friend.

You may feel intimidated the first time you open a Linux terminal. That black screen with thousands of commands, many options, and sometimes, many ways to do the same thing. Beginners often feel lost, and even experienced users sometimes fall back on the same small set of commands every day.

That's why a visual command map like the main image of this article is useful. It is superficial, but focuses on the commands people use most often in real life. The main image organizes the commands into functional groups to make it easier to understand the kind of tasks they solve. Further in this article, all the groups and commands are explained briefly for reference.

In practice, most terminal work is the same you perform on a UI. You move through folders, inspect files, edit content, check running processes, review system details, manage users, troubleshoot networks, and install software. Once you understand that terminal and a visual interfaces are only faces of the same coin, Linux terminal feels more practical and less overwhelming.

A list of commands is not a good way to learn something. People remember things better when they make associations with other things, happenings or feelings. Grouping it by purpose works better because you create associations, for an example, "I have no internet connection" relates to networking, which can relate to IP misconfiguration, so maybe ipconfig command may help to diagnose the issue. That is what makes the presented map helpful. It gives structure to the learning process.

Instead of thinking, “I need to memorize all Linux commands”, you can think “I need these few commands for files, a few for processes, and a few for networking”.
It reflects real life. Most users do not need hundreds of commands every day. They need a small set they can use with confidence for the day-by-day tasks, the same way most users don't need to know and perform multiple advanced tasks via the UI. Once that core is familiar, learning more advanced tools becomes much easier.

File and Directory Management

These commands allow you move/browse around the filesystem and manage files and folders.

  • ls - List files and directories in the current location.
    • Example: ls -la: Lists all files (including hidden ones) in long format, showing permissions, owner, size, and modification date.
  • pwd - Show the full path of the current working directory.
    • Example output: # /home/myuser/projects/my-app.
    • Useful when you've navigated deep into a directory tree and need to confirm where you are.
  • cd - Change, or moves, from one directory to another.
    • Examples:
    • cd /var/log # Move to an absolute path
    • cd .. # Move one level up
    • cd ~ # Move to the current user home directory
  • mkdir - Create a new directory.
    • Examples:
    • mkdir my-folder # Create the "my-folder" folder in current directory
    • mkdir -p parent/child/grandchild # Create nested directories in one go
      • The -p flag creates intermediate directories as needed, so you don't have to create each level manually.
  • rmdir - Remove an empty directory.
    • Example: rmdir old-folder
    • This only works if the directory is completely empty. If it contains files, you'll need rm -r instead.
  • touch - Create an empty file or updates a file timestamp.
    • Examples:
    • touch notes.txt # Create a new empty file
    • touch existing-file.log # Update the modification timestamp to now
  • cp - Copie files or directories.
    • Examples:
    • cp report.txt report-backup.txt # Copy the report.txt file and name it to report-backup.txt
    • cp -r src/ src-backup/ # Copy the src directory recursively
    • The -r (recursive) flag is required when copying directories, otherwise cp will skip them.
  • mv - Move or renames files and directories.
    • Examples:
    • mv old-name.txt new-name.txt # Rename a file
    • mv file.txt ~/Documents/ # Move a file to another directory
    • Unlike cp, mv works on directories without needing any extra flags.
  • rm - Remove files or directories.
    • Examples:
    • rm unwanted-file.txt # Remove the file
    • rm -r old-project/ # Remove a directory and everything inside it
    • rm -ri important-folder/ # Remove recursively but ask for confirmation on each file
    • Be careful with rm -r there is no trash can in the terminal. Once removed, files are gone for good.

These are often the first commands people learn, and for good reason. They are the foundation of daily terminal use. If you think about it, this is also the most frequent actions you perform in a visual interface, like Windows.

File Viewing and Editing

Once you find a file, the next step is usually to read or edit it. These commands handle these actions.

  • cat - Print file content directly in the terminal.

    • Examples:
    • cat server.log # Display the entire file in the terminal
    • cat -n server.log # Display with line numbers
    • cat file1.txt file2.txt > combined.txt # Concatenate two files into a new one
  • less - Open a file for scrolling and reading page by page.

    • Examples:
    • less /var/log/syslog # Open a log file for browsing (use q to quit)
    • less -N app.log # Open with line numbers shown
    • dmesg | less # Pipe command output into less for easy scrolling
  • more - Display file content one screen at a time.

    • Examples:
    • more readme.txt # View the file one screenful at a time
    • more -10 config.yaml # Display 10 lines at a time
    • ls -la /etc | more # Pipe a long directory listing through more
  • nano - A simple terminal-based text editor.

    • Examples:
    • nano notes.txt # Open (or create) a file for editing
    • nano +15 script.sh # Open a file and jump directly to line 15
    • nano -B /etc/hosts # Open a file and automatically create a backup before editing
  • vim - A powerful terminal-based text editor with advanced features.

    • Examples:
    • vim deploy.sh # Open a file for editing (press i to enter insert mode, Esc then :wq to save and quit)
    • vim +42 main.py # Open a file and jump to line 42
    • vim -d file-v1.txt file-v2.txt # Open two files side by side in diff mode
  • gedit - A graphical text editor often found on desktop Linux systems.

    • Examples:
    • gedit todo.txt # Open a file in the graphical editor
    • gedit +25 app.conf # Open a file and place the cursor on line 25
    • gedit file1.txt file2.txt # Open multiple files in separate tabs

This group is useful for everything from reading logs to editing config files.

Process Management

Linux is always running processes in the background and foreground. These commands help you inspect and control them. It is similar to the Windows Task Manager, but in text mode.

  • ps - Show a snapshot of running processes.

    • Examples:
    • ps aux # List all running processes with detailed info
    • ps -ef | grep nginx # Find all processes related to nginx
    • ps -u jdoe # Show all processes owned by user jdoe
  • top - Display live system activity and active processes.

    • Examples:
    • top # Launch the interactive process viewer
    • top -u www-data # Show only processes owned by the www-data user
    • top -p 1234,5678 # Monitor only specific PIDs
  • kill - Send a signal to stop or control a process by PID.

    • Examples:
    • kill 1234 # Gracefully terminate process with PID 1234 (sends SIGTERM)
    • kill -9 1234 # Force-kill a stubborn process (sends SIGKILL)
    • kill -STOP 1234 # Pause a running process without ending it
  • killall - Stop processes by name.

    • Examples:
    • killall firefox # Terminate all Firefox processes
    • killall -9 node # Force-kill all Node.js processes
    • killall -u jdoe python # Kill all Python processes owned by user jdoe
  • pstree - Display processes in a tree structure.

    • Examples:
    • pstree # Show all processes as a tree from init/systemd
    • pstree -p # Show the tree with PIDs next to each process
    • pstree -u jdoe # Show the process tree for a specific user
  • htop - An interactive process viewer with a cleaner interface than top.

    • Examples:
    • htop # Launch the interactive viewer with color-coded output
    • htop -u www-data # Filter to show only a specific user's processes
    • htop -p 1234,5678 # Monitor only specific PIDs in the interactive viewer

When a system is slow or an app freezes, this is usually where you start troubleshooting.

System Information

These commands help you learn more about the machine itself, including hardware, storage, and memory usage.

  • uname - Show basic system information such as kernel and OS name and version.

    • Examples:
    • uname -a # Display all system info (kernel, hostname, architecture, etc.)
    • uname -r # Show only the kernel release version
    • uname -m # Print the machine hardware architecture (e.g., x86_64)
  • df - Report disk space usage by filesystem.

    • Examples:
    • df -h # Show disk usage in human-readable format (GB, MB)
    • df -h /home # Check available space on the /home partition
    • df -T # Include the filesystem type in the output (ext4, xfs, etc.)
  • du - Estimate disk usage for files and directories.

    • Examples:
    • du -sh /var/log # Show total size of the /var/log directory in human-readable format
    • du -h --max-depth=1 /home # Show sizes of immediate subdirectories under /home
    • du -ah /tmp | sort -rh | head -10 # Find the 10 largest files and folders in /tmp
  • free - Display memory and swap usage.

    • Examples:
    • free -h # Show RAM and swap usage in human-readable format
    • free -m # Display memory values in megabytes
    • free -h -s 5 # Refresh memory stats every 5 seconds
  • lscpu - Show CPU architecture details.

    • Examples:
    • lscpu # Display full CPU info (cores, threads, model, cache, etc.)
    • lscpu | grep "Model name" # Show only the CPU model name
    • lscpu | grep "CPU(s)" # Check the total number of CPUs/cores available
  • lshw - List detailed hardware information.

    • Examples:
    • sudo lshw -short # Show a compact summary of all hardware components
    • sudo lshw -class network # Display only network adapter details
    • sudo lshw -class memory # Show RAM module details (size, speed, slots)
  • lsblk - Display block devices such as disks and partitions.

    • Examples:
    • lsblk # List all block devices in a tree view
    • lsblk -f # Include filesystem type and UUIDs in the output
    • lsblk -o NAME,SIZE,TYPE,MOUNTPOINT # Show only specific columns for a cleaner view

This category is especially helpful for troubleshooting and performance checks.

User and Group Management

Linux is built around users, groups, and permissions. These commands support account administration.

  • passwd - Changes a user password.

    • Examples:
    • passwd # Change the password for the currently logged-in user
    • sudo passwd jdoe # Reset the password for user jdoe (requires root)
    • passwd -e jdoe # Force user jdoe to change password on next login
  • useradd - Creates a new user account.

    • Examples:
    • sudo useradd jdoe # Create a new user with default settings
    • sudo useradd -m -s /bin/bash jdoe # Create a user with a home directory and bash shell
    • sudo useradd -G developers,docker jdoe # Create a user and add them to multiple groups
  • userdel - Deletes a user account.

    • Examples:
    • sudo userdel jdoe # Remove the user account but keep the home directory
    • sudo userdel -r jdoe # Remove the user and delete their home directory
    • sudo userdel -f jdoe # Force removal even if the user is currently logged in
  • usermod - Modifies an existing user account.

    • Examples:
    • sudo usermod -aG docker jdoe # Add user jdoe to the docker group without removing other groups
    • sudo usermod -s /bin/zsh jdoe # Change the default shell for user jdoe
    • sudo usermod -l jsmith jdoe # Rename the user account from jdoe to jsmith
  • groupadd - Creates a new group.

    • Examples:
    • sudo groupadd developers # Create a new group called developers
    • sudo groupadd -g 1500 devops # Create a group with a specific GID
    • sudo groupadd --system appusers # Create a system group for service accounts
  • groupdel - Deletes a group.

    • Examples:
    • sudo groupdel developers # Remove the developers group
    • sudo groupdel old-team # Delete a group that is no longer needed
    • sudo groupdel temp-project # Clean up a temporary project group
  • groups - Shows the groups a user belongs to.

    • Examples:
    • groups # Show the groups for the currently logged-in user
    • groups jdoe # List all groups that user jdoe belongs to
    • groups root # Check which groups the root user is a member of
  • id - Displays user ID, group ID, and related group information.

    • Examples:
    • id # Show UID, GID, and groups for the current user
    • id jdoe # Display the full identity info for user jdoe
    • id -gn jdoe # Print only the primary group name of user jdoe

Specially if you manage shared systems or servers, you will use these commands very often.

Network Configuration and Monitoring

Networking is a big part of Linux administration. These commands help you inspect connections and test communication.

  • ifconfig - Displays or configures network interfaces on older systems.

    • Examples:
    • ifconfig # Show all active network interfaces and their IPs
    • ifconfig eth0 # Display details for a specific interface
    • sudo ifconfig eth0 down # Disable the eth0 network interface
  • ip - Modern command for viewing and managing network interfaces, routes, and addresses.

    • Examples:
    • ip addr show # List all interfaces with their IP addresses
    • ip route show # Display the routing table
    • ip link set eth0 up # Bring the eth0 interface up
  • ping - Test the connectivity to another host.

    • Examples:
    • ping google.com # Continuously ping Google to check internet connectivity
    • ping -c 4 192.168.1.1 # Send exactly 4 ping packets to a host
    • ping -i 2 server.local # Ping every 2 seconds instead of the default 1 second
  • netstat - Show network connections, routing tables, and interface stats.

    • Examples:
    • netstat -tulnp # Show all listening TCP/UDP ports with process names
    • netstat -an | grep :80 # Check if anything is listening on port 80
    • netstat -r # Display the kernel routing table
  • ss - Display socket and network connection information, often faster than netstat.

    • Examples:
    • ss -tulnp # List all listening ports with associated processes
    • ss -s # Show a summary of socket statistics
    • ss -t state established # Display only established TCP connections
  • traceroute - Show the path packets take to reach a destination.

    • Examples:
    • traceroute google.com # Trace the route to Google showing each hop
    • traceroute -n 8.8.8.8 # Trace without resolving hostnames (faster output)
    • traceroute -m 15 example.com # Set a maximum of 15 hops
  • ssh - Connect securely to a remote machine.

    • Examples:
    • ssh jdoe@192.168.1.50 # Connect to a remote host as user jdoe
    • ssh -p 2222 jdoe@server.com # Connect using a non-default SSH port
    • ssh -i ~/.ssh/mykey.pem ec2-user@10.0.0.5 # Connect using a specific private key
  • nc - Netcat, a flexible tool for testing ports, sending data, and debugging network services.

    • Examples:
    • nc -zv server.com 443 # Test if port 443 is open on a remote host
    • nc -l 8080 # Listen for incoming connections on port 8080
    • nc -zv 192.168.1.10 20-100 # Scan a range of ports on a host

This is the part of Linux that becomes essential the moment something stops connecting.

Package Management

Linux distributions use package managers to install, update, and remove software. The exact tool depends on the distro.

  • apt-get - Package management tool used on Debian-based systems.

    • Examples:
    • sudo apt-get update # Refresh the list of available packages
    • sudo apt-get install nginx # Install the nginx web server
    • sudo apt-get remove --purge nginx # Remove nginx and its configuration files
  • apt - A more user-friendly package command for Debian-based systems.

    • Examples:
    • sudo apt update && sudo apt upgrade # Update package list and upgrade all packages
    • sudo apt install git curl wget # Install multiple packages at once
    • apt search image editor # Search for packages related to image editing
  • yum - Older package manager for RPM-based distributions.

    • Examples:
    • sudo yum install httpd # Install the Apache web server
    • sudo yum update # Update all installed packages
    • yum list installed # Show all currently installed packages
  • dnf - Modern package manager used in newer RPM-based distributions.

    • Examples:
    • sudo dnf install nodejs # Install Node.js
    • sudo dnf upgrade --refresh # Refresh metadata and upgrade all packages
    • dnf search python3 # Search for packages matching python3
  • rpm - Low-level tool for managing RPM packages directly.

    • Examples:
    • sudo rpm -ivh package.rpm # Install a local RPM package file
    • rpm -qa | grep java # List all installed packages containing "java"
    • rpm -qi nginx # Show detailed info about an installed package
  • dpkg - Low-level tool for managing Debian packages directly.

    • Examples:
    • sudo dpkg -i package.deb # Install a local .deb package file
    • dpkg -l | grep python # List installed packages matching "python"
    • dpkg -L nginx # Show all files installed by the nginx package
  • snap - Installs and manages snap packages across supported distributions.

    • Examples:
    • sudo snap install code --classic # Install VS Code as a snap package
    • snap list # Show all installed snap packages
    • sudo snap refresh # Update all installed snaps to their latest versions
  • zypper - Package manager used on openSUSE and SUSE systems.

    • Examples:
    • sudo zypper install git # Install git on an openSUSE system
    • sudo zypper refresh # Refresh all configured repositories
    • zypper search docker # Search for packages related to docker

Not every Linux system uses all of these, but knowing the distro family you use will help you to know which commands to use.

Start Learning

Start learning the commands in small groups:

  1. Start with navigation: pwd, ls, cd.
  2. Then learn file handling: touch, cp, mv, rm.
  3. Add file reading and editing: cat, less, nano.
  4. Move into process and system checks: ps, top, df, free.
  5. Finish with network basics: ip, ping, ssh.

Th-Th-That's all, folks!

Linux becomes much easier once you stop seeing it as a wall of commands and start seeing it as a set of tools for clear tasks. This map is a good reminder that the terminal is not about complexity for the sake of complexity. It is about control, speed, and understanding what your system is doing.

You do not need to master every command today. Learn the ones that solve the problems in front of you. Use them often. Repeat them in real situations. That is how confidence grows.

And after a while, the terminal stops feeling technical and starts feeling natural.

Top comments (0)