Linux commands organized by category.
Basic Navigation
| Command | Description |
|---|---|
| pwd | Displays the current working directory. |
| cd | Changes the current working directory. |
| cd .. | Moves to the parent directory. |
| ls | Lists files and directories in the current location. |
| ls -la | Lists all files and directories, including hidden ones, in detailed format. |
| man <command> | Displays the manual page for a command. |
| <command> --help | Displays available options for a command. |
File & Directory Operations
| Command | Description |
|---|---|
| mkdir | Creates a new directory. |
| touch | Creates a new empty file. |
| cp | Copies a file or directory without modifying the original. |
| cp -r | Copies a directory and its contents recursively. |
| mv | Moves or renames a file or directory. |
| rm | Deletes a file. |
| rm -r | Deletes a directory and its contents recursively. |
| rmdir | Removes an empty directory. |
| cat | Displays the contents of a file. |
| nano | Opens a file in a simple terminal-based text editor. |
| echo "text" > file | Creates a file containing the given text. |
| echo $PATH | Displays the system's executable search paths. |
| less | Views file contents one page at a time; press q to quit. |
| head | Displays the first lines of a file. |
| tail | Displays the last lines of a file. |
| tail -f | Continuously displays new lines appended to a file — commonly used to monitor logs in real time. |
User & Permissions
| Command | Description |
|---|---|
| passwd | Changes the password of the current user. |
| sudo su | Switches to the root user; use exit to return to the normal user. |
| lsattr | Displays the attributes of a file, such as the immutable flag (i). |
| chattr -i | Removes the immutable attribute from a file, making it editable again. |
User & Group Management
| Command | Description |
|---|---|
| useradd -m -s /bin/bash <username> | Creates a new user with a home directory and bash shell. |
| usermod -aG sudo <username> | Adds a user to the sudo group. |
| userdel -r <username> | Deletes a user along with their home directory. |
| groupadd <groupname> | Creates a new group. |
| groups <username> | Displays the groups a user belongs to. |
| id <username> | Displays UID, GID, and group membership of a user. |
| whoami | Displays the current logged-in username. |
Package Management
| Command | Description |
|---|---|
| apt update | Refreshes the local list of available packages and their versions. |
| apt install | Installs a specified package. |
| apt upgrade | Upgrades all installed packages to their latest available versions. |
| apt search | Searches available repositories for a package. |
Networking
| Command | Description |
|---|---|
| ifconfig | Displays network interface configuration, including IP address. Still functional on most systems, but no longer actively maintained — ip addr is the modern, recommended alternative. |
| ip addr | Displays and manages network interface addresses; the modern replacement for ifconfig. |
| netstat / ss | Displays active network connections and listening ports. |
Process Management
| Command | Description |
|---|---|
| ps aux | Displays currently running processes. |
| top | Shows a live view of system processes. |
| htop | Displays an enhanced, interactive process monitor. |
| kill <PID> | Terminates a process by its process ID. |
| pstree | Displays running processes in a tree structure. |
System Information
| Command | Description |
|---|---|
| uname -a | Displays kernel and system information. |
| lsb_release -a | Displays OS/distribution information. |
| uptime | Shows how long the system has been running. |
| free -m | Displays RAM usage in megabytes. |
| cal | Displays a calendar. |
| fdisk -l | Lists disks and partitions. |
| df -h | Displays disk space usage per partition in a human-readable format. |
| du -h | Displays the disk space used by a file or directory in a human-readable format. |
Terminal Shortcuts
| Command | Description |
|---|---|
| clear | Clears the terminal screen. |
| Ctrl + L | Clears the terminal (same as clear). |
| !! | Re-runs the last executed command. |
| Ctrl + Z | Sends the current process to the background. |
| history | Displays a list of previously executed commands. |
Misc / GUI & Version Control
| Command | Description |
|---|---|
| sudo thunar | Opens the Thunar file manager with root privileges. |
| git clone | Downloads a copy of a remote Git repository to the local machine. |
File Permissions
| Command | Description |
|---|---|
| chmod | Changes the read, write, and execute permissions of a file or directory. |
| chown | Changes the owner of a file or directory. |
| chgrp | Changes the group ownership of a file or directory. |
Search & Find
| Command | Description |
|---|---|
| find | Searches for files and directories matching given criteria. |
| grep | Searches for text patterns within files. |
| which <command> | Displays the full path of an installed command. |
| whereis <command> | Locates the binary, source, and manual page files for a command. |
| wc | Counts lines, words, and characters in a file. |
| diff | Compares two files and shows the differences between them. |
Archive & Transfer
| Command | Description |
|---|---|
| tar | Archives or extracts files, often combined with compression. |
| wget | Downloads files from the web directly via the command line. |
| curl | Transfers data to or from a server; commonly used for testing APIs or downloading files. |
| zip | Compresses files into a .zip archive. |
| unzip | Extracts files from a .zip archive. |
| rsync | Synchronizes files and directories between locations, transferring only the differences. |
Network Diagnostics
| Command | Description |
|---|---|
| ping | Tests reachability of a host over the network. |
| traceroute | Displays the network path (hops) taken to reach a host. |
Remote Access
| Command | Description |
|---|---|
| ssh user@host | Connects to a remote machine over SSH. |
| scp file user@host:/path | Securely copies a file to or from a remote machine over SSH. |
File System Structure
| Command | Description |
|---|---|
| /bin | Contains essential commands and programs run by regular users. |
| /sbin | Contains system commands and programs typically run by the root user. |
| /etc | Contains system-wide configuration files. |
| /home | Contains personal directories for regular users. |
| /root | The home directory of the root user (not to be confused with /, the root of the filesystem). |
| /var | Contains variable data that changes while the system runs, such as log files. |
| /tmp | Contains temporary files and directories. |
| /run | Contains runtime data since the last boot, such as process IDs. |
| /dev | Contains device files representing hardware components. |
| /proc | Stores information about currently running processes. |
| /sys | Provides an interface to kernel and hardware information (similar to /proc). |
| /mnt | Used for temporarily mounting filesystems. |
| /media | Contains mount points for removable storage devices. |
| /usr | The primary directory for user applications and their associated files. |
| /lib | Contains shared libraries and kernel modules. |
| /opt | Contains optional, third-party software packages. |
| /boot | Contains critical files required to boot the operating system; deleting this as root can render the system unbootable. |
| /srv | Contains data related to services provided by the system. |