This article serves as a comprehensive guide to Linux commands, summarizing commands from A to Z. It is recommended to bookmark it for reference or to fill in any gaps in your knowledge!
A
| Command | Description |
|---|---|
| access | Used to check if a program can access a specified file, verifying if the file exists. |
| accton | Used to turn on or off accounting processes or to change the information in the accounting file. |
| aclocal | Used to automatically generate the aclocal.m4 file from the configure.in file. |
| acpi | Used to display battery status and other ACPI information. |
| acpi_available | Tests if the ACPI (Advanced Configuration and Power Interface) subsystem is available. |
| acpid | Provides intelligent power management, notifying user-space programs about ACPI events. |
| addr2line | Used to convert addresses to file names and line numbers. |
| agetty | The Linux version of getty, a Unix program that manages physical or virtual terminals to allow multi-user access. |
| alias | Indicates to the shell to replace one string with another when executing commands. |
| amixer | Command-line mixer for the ALSA (Advanced Linux Sound Architecture) sound card driver. |
| aplay | Command-line audio player for the ALSA sound card driver. |
| aplaymidi | Used to play standard MIDI (Musical Instrument Digital Interface) files by sending the contents of the MIDI file to the ALSA MIDI port. |
| apropos | Helps users when they do not remember the exact command but know some keywords related to its purpose or function. |
| apt | Provides a high-level CLI (Command Line Interface) for the package management system, designed as an interface for end users, compared to more specialized APT tools like apt-cache and apt-get. |
| apt-get | A command-line tool that helps manage packages in Linux. |
| aptitude | Provides a highly integrated interface to interact with the machine’s package manager. |
| ar | Used to create, modify, and extract files from archives. |
| arch | Used to print the computer architecture. |
| arp | Manipulates the system’s ARP cache, allowing a complete dump of the ARP cache. |
| aspell | Used as a spell checker in Linux. |
| atd | A job scheduling daemon that runs scheduled jobs for later execution. |
| atrm | Used to remove specified jobs; to remove a job, its job number is passed in the command. |
| atq | Displays a list of pending jobs scheduled by the user. |
| autoconf | Used in Linux to generate configuration scripts. |
| autoheader | Used to create template files for C “#define” or any other template headers for configure. |
| automake | Used to automatically generate Makefile.in files that conform to GNU coding standards. |
| autoreconf | Used to create source code that can be automatically built for Unix-like systems. |
| autoupdate | Used to update the configure.in file in our Linux system to a newer version of Autoconf. |
| awk | A scripting language used for manipulating data and generating reports. |
B
| Command | Description |
|---|---|
| banner | Used to print uppercase ASCII strings to standard output. |
| basename | Removes directory information and suffix from a file name, i.e., prints the file name NAME and removes any leading directory components. |
| batch | Reads commands from standard input or a specified file and executes them when the system load level allows, i.e., when the average load is below 1.5. |
| bc | Command-line calculator. |
| bg | Used to place a foreground job in the background. |
| biff | Unix mail notification system that notifies the user on the command line when new mail arrives and tells who it is from. |
| bind | Used to set Readline key bindings and variables. |
| bison | A parser generator similar to yacc. |
| break | Used to terminate the execution of for, while, and until loops. |
| builtin | Used to run built-in shell commands, passing parameters (args) to it and obtaining the exit status. |
| bzcmp | Used to call the cmp utility on bzip2 compressed files. |
| bzdiff | Used to compare bzip2 compressed files. |
| bzgrep | Used to search for patterns or expressions in bzip2 compressed files. |
| bzip2 | Used to compress and decompress files. |
| bzless | Starts faster for large files as it does not need to read the entire input file before starting. |
| bzmore | Acts as a CRT filter for viewing bzip2 compressed files, which are saved with a .bz2 suffix. |
C
| Command | Description |
|---|---|
| cal | Used to view the calendar for a specific month or the entire year; by default, it displays the calendar for the current month as output. |
| case | The best choice when we have to use multiple if/elif on a single variable. |
| cat | Reads data from a file and outputs its contents. |
| cc | Used to compile C language code and create executable files. |
| ccrypt | A command-line tool for data encryption and decryption. |
| cd | Called the change directory command. It is used to change the current working directory. |
| cfdisk | Displays or manipulates the disk partition table by providing a text-based “graphical” interface. |
| chage | Used to view and modify user password expiration information. |
| chattr | A filesystem command used to change file attributes in a directory. |
| chfn | Changes username and other details. |
| chgrp | Used to change the group ownership of files or directories. |
| chkconfig | Used to list all available services and view or update their runlevel settings. |
| chmod | Used to change the access mode of files. |
| chown | Used to change the owner or group of files. |
| chpasswd | Used to change the passwords of multiple users at once. |
| chroot | Used to change the root directory. |
| chrt | Used to manipulate the real-time attributes of processes. |
| chsh | Used to change the user’s login shell (current login shell). |
| chvt | Used to switch between different available TTY (TeleTYpewriter) terminals. |
| cksum | Used to display a CRC (Cyclic Redundancy Check) value, the byte size of a file, and the file name to standard output. |
| clear | Used to clear the terminal screen. |
| cmp | Used to compare two files byte by byte, helping you find out if the two files are the same. |
| col | Used to filter out reverse line feeds; the col utility simply reads from standard input and writes to standard output. |
| colcrt | Used to format text processor output for viewing on cathode ray tube displays. |
| colrm | Used to remove selected columns from a file. |
| column | Used to display the contents of a file in columns. |
| comm | Compares two sorted files line by line and writes to standard output the common lines and unique lines. |
| compress | Used to reduce file size; after compression, the file will be available and have a .Z extension. |
| continue | Used to skip the current iteration in for, while, and until loops. |
| cp | Used to copy files or a group of files or directories. |
| cpio | cpio stands for “copy in, copy out”; it is used to handle archive files such as *.cpio or *.tar, and this command can copy files to or from an archive. |
| cpp | The C compiler automatically uses it to transform programs before compilation. |
| cron | A software utility provided by Unix-like operating systems that automatically executes scheduled tasks at specified times. |
| crontab | A list of commands for scheduled tasks. |
| csplit | Used to split any file into multiple parts as needed by the user. |
| ctags | Provides quick access to files (e.g., quickly viewing function definitions). |
| cupsd | A scheduler for CUPS (Common Unix Printing System) that implements a printing system based on the Internet printing protocol. |
| curl | A tool for transferring data to or from a server using any supported protocol. |
| cut | Used to cut sections from each line of a file and write the result to standard output. |
| cvs | Used to store the history of files; whenever a file is corrupted or has any issues, “cvs” helps us revert to a previous version and recover our files. |
D
| Command | Description |
|---|---|
| date | Used to display the system date and time. It is also used to set the system’s date and time. |
| dc | Used to calculate arithmetic expressions. It computes expressions in postfix notation. |
| dd | A command-line utility for Unix and Unix-like operating systems, primarily aimed at converting and copying files. |
| declare | Used to declare shell variables and functions, set their attributes, and display their values. |
| depmod | Used to generate a list of dependency descriptions for kernel modules and their associated mapping files. |
| df | Used to display information about the total and available space on the filesystem. |
| diff | Used to show differences between files by comparing them line by line. |
| diff3 | Used to compare three files line by line. |
| dir | Used to list the contents of a directory. |
| dirname | Used to remove the trailing slash from NAME and print the remaining part. |
| dirs | Used to display the list of currently remembered directories. |
| disable | Used to stop a printer or class. |
| dmesg | Used to check the kernel ring buffer and print kernel messages. |
| dmidecode | Used when a user wants to retrieve system hardware-related information such as processor, RAM (DIMM), BIOS details, etc., in a readable format. |
| domainname | Used to return the network information system (NIS) domain name of the host. |
| dos2unix | Converts DOS text files to UNIX format. |
| dosfsck | Diagnoses issues with the MS-DOS filesystem and attempts to fix them. |
| dstat | Used to retrieve information or statistics from the system’s components (e.g., network connections, IO devices, or CPU). |
| du | Used to track files and directories that are taking up excessive disk space. |
| dump | Used to back up the filesystem to a storage device. |
| dumpe2fs | Used to print superblock and block group information of the filesystem present on a device. |
| dumpkeys | Used to dump the keyboard translation table. |
E
| Command | Description |
|---|---|
| echo | Used to display the text/string line passed as a parameter. |
| ed | Used to start the ed text editor, a line-based text editor with a minimal interface that reduces the complexity of handling text files, i.e., creating, editing, displaying, and manipulating files. |
| egrep | Treats patterns as extended regular expressions and prints lines that match the pattern. |
| eject | Uses software to eject removable media (usually CD-ROMs, floppy disks, tapes, or JAZ or ZIP disks). |
| emacs | An editor with a simple user interface. Additionally, this editor does not have an insert mode; it only has an edit mode. |
| enable | Used to start a printer or class. |
| env | Used to print environment variables. It is also used to run utilities or commands in a custom environment. |
| eval | Built-in command used to execute parameters as shell commands. |
| ex | A text editor in Linux, also known as the line editor mode of the vi editor. |
| exec | Used to execute commands from bash itself. |
| exit | Used to exit the currently running shell. |
| expa | Converts tabs to spaces in a file; when no file is specified, it reads from standard input. |
| expect | This command or scripting language is suitable for scripts that require user input, automating tasks by providing input. |
| export | A bash shell BUILTINS command, meaning it is part of the shell, marking environment variables to be exported to subprocesses. |
| expr | Evaluates a given expression and displays its corresponding output. |
F
| Command | Description |
|---|---|
| factor | Used to print the prime factors of a given number, provided from the command line or read from standard input. |
| fc | Used to list, edit, or re-execute commands previously entered into the interactive shell. |
| fc-cache | Scans font directories and builds font caches for applications using fontconfig for font handling. |
| fc-list | Used to list available fonts and font styles; with formatting options, it can filter and organize the list of all fonts. |
| fdisk | Format disk is a dialog-driven command in Linux used to create and manipulate disk partition tables. |
| fg | Used to bring a background job to the foreground. |
| fgrep | Used to search for fixed strings in files. |
| file | Used to determine the type of a file; .file types can be human-readable (e.g., ‘ASCII text’) or MIME types (e.g., ‘text/plain; charset=us-ascii’). |
| find | Used to find files and directories and perform subsequent operations on them. |
| finger | A user information lookup command that provides details about all logged-in users. |
| fmt | Acts as a formatter to simplify and optimize text files. |
| fold | Wraps each line in the input file to fit a specified width and prints it to standard output. |
| for | Used to repeat a set of commands for each element present in a list. |
| free | Displays the total amount of available space and the amount of memory and swap memory used in the system, as well as the buffers used by the kernel. |
| Fun | Used to draw various types of patterns on the terminal. |
| function | Used to create functions or methods. |
G
| Command | Description |
|---|---|
| g++ | Used for preprocessing, compiling, assembling, and linking source code to generate executable files. |
| gawk | Used for pattern scanning and processing language. |
| gcc | The GNU Compiler Collection primarily used to compile C and C++ languages. It can also be used to compile Objective C and Objective C++. |
| gdb | The GNU Debugger helps debug programs written in C, C++, Ada, Fortran, etc. |
| getent | Used to get entries from many important text files called databases. |
| gpasswd | Used to manage /etc/group and /etc/gshadow. |
| grep | Searches for specific character patterns in files and displays all lines containing that pattern. |
| groupadd | Used to create new user groups. |
| groupdel | Used to delete existing groups. |
| groupmod | Used to modify or change existing groups on the Linux system. |
| groups | A group is a collection of users. Groups make it easier to manage users with the same security and access rights. |
| grpck | Verifies the integrity of group information. It checks that all entries in /etc/group and /etc/gshadow have the correct format and contain valid data. |
| grpconv | Used to convert to shadow groups. The grpconv command creates a gshadow from the group and an optional existing gshadow. |
| gs | This command calls Ghostscript, an interpreter for Adobe Systems’ PostScript and Portable Document Format (PDF) languages. |
| gunzip | Used to compress or expand files or lists of files in Linux. |
| gzexe | Used to compress executable files, also used to automatically decompress and execute files. |
| gzip | This command compresses files. Each individual file is compressed into a single file. |
H
| Command | Description |
|---|---|
| halt | Used to instruct hardware to stop all CPU functions, which will restart or stop the system. |
| hash | Used to maintain a hash table of recently executed programs. |
| hdparm | Used to obtain statistics about hard disks, change write intervals, sound management, and DMA settings. |
| Head | Prints the first N data of the given input. |
| help | Displays information about shell built-in commands. |
| hexdump | Used to filter and display specified files or standard input in a human-readable specified format. |
| history | Used to view previously executed commands. |
| host | Used for DNS (Domain Name System) lookup operations. |
| hostid | Used to display the Host’s ID in hexadecimal format. |
| hostname | Used to get the DNS (Domain Name System) name and set the system’s hostname or NIS (Network Information System) domain name. |
| hostnamectl | Provides the appropriate API to control the hostname of the Linux system and change its related settings. |
| htop | Allows users to interactively monitor important resources or server processes in real-time. |
| hwclock | Utility for accessing the hardware clock, also known as the real-time clock (RTC). |
I
| Command | Description |
|---|---|
| iconv | Used to convert text from one encoding to another. |
| id | Used to find out the username and group name, as well as the numeric ID (UID or GID) of the current user or any other user on the server. |
| if | Used to execute commands based on conditions. |
| ifconfig | Used to configure kernel-resident network interfaces. |
| iftop | A network analysis tool used by system administrators to view bandwidth-related statistics. |
| ifup | Starts network interfaces, allowing data transmission and reception. |
| import | Used to capture screenshots of any active pages we have and output them as image files. |
| info | Reads documentation in info format, providing detailed information about commands. |
| insmod | Used to insert modules into the kernel. |
| install | Used to copy files and set attributes. |
| iostat | Used to monitor system input/output statistics for devices and partitions. |
| iotop | Used to display and monitor disk IO usage details, even providing a table of existing IO usage by processes. |
| ip | Used to perform multiple network management tasks. |
| ipcrm | Used to remove some IPC (Inter-Process Communication) resources. It eliminates IPC objects and their associated data structures from the system. |
| ipcs | Displays information about inter-process communication facilities that the calling process has read access to. |
| iptables | Used to set up and maintain tables for the Netfilter firewall for IPv4, included in the Linux kernel. |
| iptables-save | Saves the current iptables rules to a user-specified file for later use when needed. |
| iwconfig | Used to display parameters and wireless statistics extracted from /proc/net/wireless. |
J
| Command | Description |
|---|---|
| join | Used to join lines of two files based on key fields present in both files. |
| journalctl | Used to view systemd, kernel, and journal logs. |
K
| Command | Description |
|---|---|
| kill | Used to manually terminate processes. The kill command sends a signal to terminate the process. |
L
| Command | Description |
|---|---|
| last | Used to display a list of all users who have logged in and out since the creation of the file /var/log/wtmp. |
| less | Used to view the contents of text files one page (one screen) at a time. |
| let | Used to calculate arithmetic expressions of shell variables. |
| ln | Used to create links between files. |
| locate | Used to find files by name. |
| look | Displays lines that begin with a given string. |
| lsblk | Used to display detailed information about block devices, which are essentially files representing devices connected to the PC (except for RAM disks). |
| lshw | Used to generate detailed information about the system hardware configuration from various files under the /proc directory. |
| lsmod | Used to display the status of modules in the Linux kernel. It results in a list of loaded modules. |
| lsof | Provides a list of open files. |
| lsusb | Used to display information about the USB bus and its connected devices. |
M
| Command | Description |
|---|---|
| mailq | This command in Linux prints the mail queue, i.e., a list of messages in the mail queue. |
| man | Used to display the user manual for any command that can be run in the terminal. |
| md5sum | Used to verify data integrity using MD5 (Message-Digest Algorithm 5). |
| mkdir | Allows users to create directories. This command can create multiple directories at once. |
| modinfo | Used to display information about Linux kernel modules. |
| more | Used to view text files at the command prompt, displaying one screen at a time (e.g., log files) when the file is large. |
| mount | Used to mount filesystems found on devices to a tree structure with “/” as the root (Linux filesystem). |
| mpstat | Used to report processor-related statistics. |
| mv | Used to move one or more files or directories from one place to another in UNIX-like filesystems. |
N
| Command | Description |
|---|---|
| nc(netcat) | It is one of the powerful network tools, security tools, or network monitoring tools. |
| netstat | Displays various network-related information such as network connections, routing tables, interface statistics, masquerade connections, multicast memberships, etc. |
| nmcli | Used to control NetworkManager. The nmcli command can also be used to display the status of network devices, create, edit, activate/deactivate, and delete network connections. |
| nslookup | A network management tool used to query the Domain Name System (DNS) for domain name or IP address mappings or any other specific DNS records. |
O
| Command | Description |
|---|---|
| od | Used to convert the input content into different formats in octal format by default. |
P
| Command | Description |
|---|---|
| passwd | Used to change user account passwords. |
| paste | Used to horizontally concatenate files (parallel merge) by outputting lines composed of lines from each specified file, separated by tabs, to standard output. |
| pidof | Used to find the process ID of a specific running program. |
| ping | Used to check network connectivity between a host and a server/host. |
| pinky | A user information lookup command that provides details about all logged-in users. |
| pmap | Used to display the memory mapping of processes. Memory mapping indicates how memory is distributed. |
| poweroff | Sends an ACPI signal indicating the system to shut down power. |
| printf | Used to display given strings, numbers, or any other format specifiers in the terminal window. |
| ps | Used to list currently running processes and their PIDs, along with some other information depending on different options. |
| pwd | Prints the path of the working directory, starting from the root. |
R
| Command | Description |
|---|---|
| ranlib | Used to generate an index for archives. |
| rcp | Used to copy files from one computer to another. |
| read | Reads the total number of bytes from the specified file descriptor into a buffer. |
| readelf | Used to obtain information about ELF (Executable and Linkable Format) files. |
| readlink | Used to print the resolved symbolic link or canonical file name. |
| reboot | Instructs the system to restart or reboot. |
| rename | Used to rename files according to a regular expression perlexpr. |
| reset | Used to initialize the terminal. This is useful when the terminal is in an abnormal state after a program terminates. |
| restore | Used to restore files from backups created using dump. |
| return | Used to exit shell functions. |
| rev | Used to reverse lines by character. |
| rm | Used to remove files, directories, symbolic links, and other objects from UNIX-like filesystems. |
| rmdir | Used to remove empty directories from the filesystem in Linux. |
| rmmod | Used to remove modules from the kernel. |
| route | Used when you want to use the IP/kernel routing table. |
| rsync | Synchronizes files and directories between two hosts or machines. |
S
| Command | Description |
|---|---|
| sar | Used to monitor resources of the Linux system, such as CPU usage, memory usage, I/O device consumption, etc. |
| scp | Used to securely copy files between servers. |
| screen | Provides the ability to start and use multiple shell sessions from a single ssh session. |
| script | Used to make a typescript or record all terminal activity. |
| scriptreplay | Used to replay the typescript/terminal activity stored in the log file of script command. |
| sdiff | Used to compare two files and write the results to standard output in side-by-side format. |
| sed | Used for searching, filtering, text replacement, substitution, and text operations such as inserting, deleting searches, etc. |
| select | Used to create a numbered menu from which the user can select an option. |
| seq | Used to generate numbers from FIRST to LAST in steps of INCREMENT. |
| setsid | Used to run a program in a new session. |
| shift | Moves/moves command line parameters to the left by one position. |
| showkey | Prints the scan code or key code or “ascii” code of each key pressed to standard output. |
| shred | Used to securely delete files from the hard disk. |
| shutdown | Used to safely shut down the system. |
| sleep | Used to create virtual jobs. Virtual jobs help delay execution. |
| source | Used to read and execute the contents of a file (usually a set of commands) passed as parameters in the current shell script. |
| sort | Used to sort files, arranging records in a specific order. |
| split | Used to split large files into smaller files. |
| ssh | Protocol for securely connecting to remote servers/systems. |
| strace | It is one of the most powerful process monitoring, diagnostic, and teaching tools in Linux. |
| stty | Used to change and print terminal line settings. |
| sudo | Acts as a prefix for commands that are only allowed to be run by superusers. |
| sum | Used to find checksums and count blocks in files. |
| sync | Used to synchronize cached writes to persistent storage. |
| systemctl | Used to check and control the status of the “systemd” system and service manager. |
T
| Command | Description |
|---|---|
| tac | Used to concatenate and print files in reverse. |
| tail | Prints the last N data of the given input. |
| tar | Used to create and extract archive files. |
| tee | Reads standard input and writes it to standard output and one or more files. |
| time | Used to execute commands and print a summary of the real, user CPU time, and system CPU time spent executing the command when it terminates. |
| top | Provides a dynamic real-time view of the running system. |
| touch | Used to create, change, and modify file timestamps. |
| tr | Used to translate or delete characters. |
| tracepath | Used to trace the path to a destination, discovering the MTU along this path. |
| traceroute | Prints the route that packets take to reach a host. |
| tree | A recursive directory listing program that produces a deep-indented list of files. |
| tty | Displays information related to the terminal, printing the file name of the terminal connected to standard input. |
| type | Used to describe how its parameters would be translated if used as a command. |
U
| Command | Description |
|---|---|
| uname | Displays information about the system. |
| unexpand | Converts each space to a tab, writing the generated output to standard output. |
| uniq | Used to report or filter out duplicate lines in files. |
| unix2dos | Converts Unix text files to DOS format. |
| until | Used to execute a set of commands as long as the exit status of the last command in “until” is not zero. |
| uptime | Used to find out how long the system has been active (running). |
| useradd | Used to add user accounts to your system. |
| usermod | Used to change user attributes via command line in Linux. |
| username | Retrieves the username and its configuration. |
| users | Used to display the usernames of users currently logged into the current host. |
| userdel | Used to delete user accounts and related files. |
V
| Command | Description |
|---|---|
| vi | The default editor that comes with the UNIX operating system, known as the visual editor. |
| vmstat | A command for monitoring system performance, capable of monitoring information about processes, memory, paging, block IO, disk, and CPU scheduling. |
| vnstat | Used by system administrators to monitor network parameters, such as bandwidth consumption or certain traffic flowing in or out. |
W
| Command | Description |
|---|---|
| w | Used to display who is logged in and what they are doing. |
| wall | Displays messages, file contents, or other standard input on the terminals of all currently logged-in users. |
| watch | Used to execute programs periodically, displaying output in full screen. |
| wc | Used to find the number of lines, words, byte sizes, and character counts in files specified in file parameters. |
| wget | Used to download files from servers, even allowing users to work in the background without interrupting current processes. |
| whatis | Used to get a one-line description of manual pages. |
| which | Used to locate executable files associated with a given command by searching in the path environment variable. |
| while | Used to repeatedly execute a set of commands as long as COMMAND returns true. |
| who | Used to get information about currently logged-in users on the system. |
| whoami | Displays the username of the current user when this command is called. |
| write | Allows users to communicate with other users by copying lines from one user’s terminal to another. |
X
| Command | Description |
|---|---|
| xargs | Used to build and execute commands from standard input. It converts input received from standard input into command parameters. |
| xdg-open | Used to open files or URLs in the user’s preferred application. |
Y
| Command | Description |
|---|---|
| yes | Used to print a continuous output stream of the given STRING. If STRING is not mentioned, it prints ‘y’. |
Z
| Command | Description |
|---|---|
| zdiff | Used to call the diff program on files compressed with gzip. |
| zdump | Used to print the current time in the specified zone, or you can say print the current time in each zone name specified on the command line. |
| zgrep | Used to search for expressions from a given file, even if it is compressed. |
| zip | A compression and file packaging utility for Unix, where each file is stored in a single .zip file with a .zip extension. |
Translated from the Network Technology Alliance site
-End-
Reading this far indicates you enjoy the articles from this public account. Feel free to pin (star) this public account Linux Technology Enthusiast, so you can receive notifications promptly!
In this public account Linux Technology Enthusiast, reply with: Linux to receive 2TB of learning materials!
Recommended Reading:
- 35 Practical Examples of the find Command in Linux
- Essential Network Port Guide for Operations and Maintenance, this one is enough
- Linux Learning Guide (Bookmark Edition)
- A 20,000-word systematic summary to help you achieve freedom with Linux commands