40 most common Linux commands you should know
Linux commands are the instructions that are entered in a terminal or command line interface (CLI) to perform specific tasks on a Linux system. There are many different Linux commands, and each one has a specific purpose.
I have created a list of the most commonly used linux commands and their intended use.
“sudo” command allows a user to run a command with the privileges of a different user, such as the root user. It is commonly used to perform tasks that require superuser (or root) privileges.
“pwd” command stands for “print working directory” and prints the path of the current working directory to the terminal. This can be useful for letting the user know where they are in the file system.
“cd” command stands for “change directory” and is used to change the current working directory to a specified directory.
“ls” command lists the files and directories in the current working directory. It can be used with various flags to control the information that is displayed and the format of the output.
“cat” command concatenates and displays the contents of one or more files to the terminal. It can also be used to create new files and to combine multiple files into a single file.
“cp” command is used to copy files and directories. It can be used to copy a single file to a different location, or to copy multiple files at once.
“mv” command is used to move or rename files and directories. It can be used to move a single file to a different location, or to move multiple files at once.
“mkdir” command is used to create new directories. It can be used to create a single directory or to create multiple directories at once, using the appropriate flags.
“rmdir” command is used to remove empty directories. It will not remove directories that contain files or other directories.
“rm” command is used to remove files and directories. It can be used to remove a single file, multiple files at once, or even entire directories (including any files and subdirectories they contain).
“touch” command is used to create new empty files. It can also be used to update the timestamp on an existing file.
“locate” command is used to search for files on the system. It uses a database to quickly find files that match the specified search criteria.
“find” command is used to search for files on the system based on various criteria such as file name, size, and permissions. Unlike the locate command, it searches the actual file system rather than using a pre-built database.
“grep” command is used to search for patterns within files. It is commonly used to search for specific words or phrases within one or more files.
“diff” command is used to compare the contents of two files and display the differences between them. It is commonly used to identify changes between different versions of the same file, or to compare the contents of two different files.
“tar” command is used to create, extract, or manipulate files that are stored in the tar file format. This file format is commonly used for creating archives of multiple files and directories.
“chmod” command is used to change the permissions of a file or directory. It allows the user to specify which users or groups are allowed to read, write, or execute the file.
“chown” command is used to change the owner of a file or directory. It allows the user to specify the new owner of the file, as well as the owner’s group.
“jobs” command is used to display a list of jobs that are running in the background or that have been stopped. It can be used to monitor and manage background processes.
“kill” command is used to send a signal to a process, causing it to terminate. It can be used to terminate processes that are not responding or that are causing problems.
“ping” command is used to test the reachability of a network host. It sends a small packet of data to the host and waits for a response, providing information about the response time and other details.
“wget” command is used to download files from the internet. It supports various protocols such as HTTP, HTTPS, and FTP, and can be used to download files from a URL or from a local file that contains a list of URLs.
“uname” command is used to display information about the system, such as the hostname, the version of the operating system, and the machine hardware architecture.
“top” command is used to display real-time information about the running processes on a system. It shows a list of processes, along with their CPU and memory usage, and updates the information in real time.
“history” command is used to display a list of recently executed commands. This can be useful for reviewing and re-running previous commands, or for troubleshooting issues.
“man” command is used to display the manual page for a command. Manual pages contain detailed information about a command, including its syntax, options, and usage examples.
“echo” command is used to display a message to the terminal. It can be used to display the value of a variable, to print a message, or to concatenate strings.
zip – unzip
“zip” and unzip commands are used to compress and decompress files. The zip command creates a compressed archive file from one or more files, while the unzip command extracts the files from a compressed archive.
“hostname” command is used to display the hostname of the system. The hostname is the name that is assigned to a computer on a network, and it is used to identify the computer on the network.
useradd – userdel
“useradd” and “userdel” commands are used to manage user accounts on the system. The useradd command is used to create a new user account, while the userdel command is used to delete an existing user account.
“apt-get” command is used to manage packages on a Linux system. It is commonly used to install, remove, update, and upgrade packages on the system.
“df” command is used to display information about the available and used disk space on the system. It can be used to monitor the usage of the system’s disk and to troubleshoot issues related to disk space.
“du” command is used to estimate the space used by files and directories on a file system. It can be used to determine which files and directories are taking up the most space on the system.
“head” command is used to display the beginning of a file. By default, it shows the first 10 lines of a file, but this can be changed using command line options.
“tail” command is used to display the end of a file. By default, it shows the last 10 lines of a file, but this can be changed using command line options.
“diff” command is used to compare the contents of two files and display the differences between them.
“su” command is used to switch the current user to a different user account. It allows a user to temporarily assume the privileges of another user, such as the root user, in order to perform tasks that require those privileges.
“htop” command is an interactive process viewer for Linux. It is similar to the top command, but it provides a more user-friendly interface and additional features such as the ability to kill processes and sort the process list by various criteria.
“ps” command is used to display information about the running processes on a system. It shows a list of processes, along with their PID (process ID), the user that owns the process, and the command that was used to start the process.
nano – vi – jed
“nano”, “vi”, and “jed” commands are all text editors for the command line. nano and vi are simple and easy-to-use editors that are commonly used on Linux systems, while jed is a more advanced editor that supports features such as syntax highlighting and code folding.