


150 common commands you must know in Linux operation and maintenance
Linux commands are the core of Linux system management, similar to DOS commands. There are two types of commands in Linux systems: built-in Shell commands and Linux commands. These commands manage the CPU, memory, disk drives, etc., and are necessary for the normal operation of the system.
Order | Function Description |
Online query and help commands (2) | |
man | View command help, command dictionary, more complex ones include info, but they are not commonly used. |
help | View help for Linux built-in commands, such as the cd command. |
File and directory operation commands (18) | |
ls | Quan spell list, the function is to list the contents of the directory and its content attribute information. |
cd | Quanpin change directory, the function is to switch from the current working directory to the specified working directory. |
cp | Quan spelling copy, its function is to copy files or directories. |
find | Search means, used to find directories and files under directories. |
mkdir | Quanpin make directories, its function is to create directories. |
mv | Quan spell move, its function is to move or rename files. |
pwd | Quanpin print working directory, its function is to display the absolute path of the current working directory. |
rename | is used to rename files. |
rm | Quanpin remove, its function is to delete one or more files or directories. |
rmdir | Quanpin remove empty directories, the function is to delete empty directories. |
touch | Create a new empty file and change the timestamp attribute of the existing file. |
tree | The function is to display the contents of the directory in a tree structure. |
basename | Display file name or directory name. |
dirname | Display file or directory path. |
chattr | Change the extended attributes of the file. |
lsattr | View file extension attributes. |
file | Display the type of file. |
md5sum | Calculate and verify the MD5 value of the file. |
View file and content processing commands (21) | |
cat | Quanpin concatenate, the function is to connect multiple files and print to the screen output or redirect to the specified file. |
tac | tac is the reverse spelling of cat, so the function of the command is to display the file contents in reverse. |
more | Display file contents in pages. |
less | Display the file contents in pages, the opposite usage of the more command. |
head | Display the header of the file content. |
tail | Display the end of the file content. |
cut | Split each line of the file according to the specified delimiter and output it. |
split | Split the file into different small fragments. |
paste | Merge file contents line by line. |
sort | Sort the text content of the file. |
uniq | Remove duplicate rows. oldboy |
wc | Count the number of lines, words or bytes of the file. |
iconv | Convert the encoding format of the file. |
dos2unix | Convert DOS format files to UNIX format. |
diff | Quan spelling difference, compares the differences of files, often used for text files. |
vimdiff | Command line visual file comparison tool, often used for text files. |
rev | Reverse output file content. |
grep/egrep | Filter string, the third of the Three Musketeers. |
join | Merge by the same fields in the two files. |
tr | Replace or delete characters. |
vi/vim | Command line text editor. |
File compression and decompression commands (4) | |
tar | Package and compress. oldboy |
unzip | unzip files. |
gzip | gzip compression tool. |
zip | Compression tool. |
Information display commands (11) | |
uname | Command to display operating system related information. |
hostname | Display or set the host name of the current system. |
dmesg | Displays boot information and is used to diagnose system faults. |
uptime | Display system running time and load. |
stat | Display the status of a file or file system. |
du | Calculate disk space usage. |
df | Report file system disk space usage. |
top | Real-time display of system resource usage. |
free | View system memory. |
date | Display and set system time. |
cal | View calendar and other time information. |
Search file commands (4) | |
which | Search for binary commands and search according to the path of the environment variable PATH. |
find | Traverse the disk to find files or directories. |
whereis | Search for binary commands and search according to the path of the environment variable PATH. |
locate | Find the command from the database (/var/lib/mlocate/mlocate.db) and use updatedb to update the library. |
User management commands (10) | |
useradd | Add user. |
usermod | Modify user attributes that already exist in the system. |
userdel | delete users. |
groupadd | Add user group. |
passwd | Change user password. |
chage | Modify the user password validity period. |
id | View the user's uid, gid and user group. |
su | Switch user identity. |
visudo | Exclusive command to edit /etc/sudoers file. |
sudo | Execute commands previously allowed in the sudoers file as another user (default root user). |
Basic network operation commands (11) | |
telnet | Use TELNET protocol to log in remotely. |
ssh | Use SSH encryption protocol to log in remotely. |
scp | Quanpin secure copy, used to copy files between different hosts. |
wget | Command line download file. |
ping | Test the network connectivity between hosts. |
route | Display and set the routing table of the linux system. |
ifconfig | Commands to view, configure, enable or disable network interfaces. |
ifup | Start the network card. |
ifdown | Close the network card. |
netstat | Check network status. |
ss | Check network status. |
In-depth network operation commands (9) | |
nmap | Network scan command. |
lsof | Full name list open files, which is to list the files that have been opened in the system. |
Send and receive emails. | |
mutt | Mail management commands. |
nslookup | Command to interactively query Internet DNS servers. |
dig | Find the DNS resolution process. |
host | Query DNS command. |
traceroute | Track data transmission routing status. |
tcpdump | Command line packet capture tool. |
Commands related to disk and file system (16) | |
mount | Mount the file system. |
umount | Unmount the file system. |
fsck | Check and repair Linux file system. |
dd | Convert or copy files. |
dumpe2fs | Export ext2/ext3/ext4 file system information. |
dump | ext2/3/4 file system backup tool. |
fdisk | Disk partition command, applicable to disk partitions below 2TB. |
parted | Disk partition command has no disk size limit and is commonly used for disk partitions below 2TB. |
mkfs | Format to create a Linux file system. |
partprobe | Update the kernel’s hard disk partition table information. |
e2fsck | Check ext2/ext3/ext4 type file system. |
mkswap | Create Linux swap partition. |
swapon | Enable swap partition. |
swapoff | Close the swap partition. |
sync | Write the data in the memory buffer to disk. |
resize2fs | Adjust the size of the ext2/ext3/ext4 file system. |
System permissions and user authorization related commands (4) | |
chmod | Change file or directory permissions. |
chown | Change the owner and group of a file or directory. |
chgrp | Change the file user group. |
umask | Display or set permission mask. |
Commands to view system user login information (7) | |
whoami | Display the currently valid user name, which is equivalent to executing the id -un command. |
who | Display the user information currently logged into the system. |
w | Display the list of users who have logged in to the system and display the instructions that the user is executing. |
last | Display users logged into the system. |
lastlog | Display the latest login information of all users in the system. |
users | Display the user list of all users currently logged in to the system. |
finger | Find and display user information. |
Built-in commands and others (19) | |
echo | Print variables, or directly output the specified string |
printf | Format the results and output them to standard output. |
rpm | Commands to manage rpm packages. |
yum | Automate and simplify the management of rpm package commands. |
watch | Periodically execute the given command and display the output of the command in full screen mode. |
alias | Set system alias. |
unalias | Cancel system alias. |
date | View or set the system time. |
clear | Clear the screen, referred to as clear screen. |
history | View the history of command execution. |
eject | Eject the optical drive. |
time | Calculate command execution time. |
nc | Powerful network tool. |
xargs | Convert standard input into command line parameters. |
exec | The command to call and execute the instruction. |
export | Set or display environment variables. |
unset | Delete variables or functions. |
type | Used to determine whether another command is a built-in command. |
bc | Command line scientific calculator |
System management and performance monitoring commands (9) | |
chkconfig | Manage Linux system startup items. |
vmstat | Virtual memory statistics. |
mpstat | Display status statistics of each available CPU. |
iostat | Statistics system IO. |
sar | Comprehensively obtain the system's CPU, run queue, disk I/O, paging (swap area), memory, CPU interrupt and network performance data. |
ipcs | Used to report the status of inter-process communication facilities in Linux. The information displayed includes message list, shared memory and semaphore information. |
ipcrm | Used to delete one or more message queues, semaphore sets or shared memory identifiers. |
strace | Used to diagnose and debug Linux user space tracker. We use it to monitor the interaction between user space processes and the kernel, such as system calls, signal transmission, process state changes, etc. |
ltrace | Thecommand will track the library function calls of the process, and it will show which library function is called. |
Commands to shut down/restart/log off and view system information (6) | |
shutdown | Shut down. |
halt | Shut down. |
poweroff | Turn off the power. |
logout | Quit the currently logged in Shell. |
exit | Quit the currently logged in Shell. |
Ctrl d | Shortcut key to exit the currently logged in Shell. |
Process management related commands (15) | |
bg | Convert a command that is paused in the background to continue execution (execute in the background). |
fg | Move the command in the background to the foreground to continue running. |
jobs | Check how many commands are currently running in the background. |
kill | Terminate the process. |
killall | Terminate the process by process name. |
pkill | Terminate the process by process name. |
crontab | Scheduled task command. |
ps | Display a snapshot of the process. |
pstree | Tree display process. |
nice/renice | Adjust the priority of program running. |
nohup | Ignore the pending signal and run the specified command. |
pgrep | Find processes matching the conditions. |
runlevel | View the current running level of the system. |
init | Switch run level. |
service | Start, stop, restart and shut down system services, and also display the current status of all system services. |
The above is the detailed content of 150 common commands you must know in Linux operation and maintenance. For more information, please follow other related articles on the PHP Chinese website!

Do you have trouble downloading or sending attachments in Outlook 365? Sometimes, Outlook doesn’t show them for some unknown reason, so you are unable to see them. In this post on php.cn Website, we collect some use tips for attachments not showing.

When V Rising players try to join a server that is close to or already full, they may encounter the “V Rising connection timed out” issue. If you are one of them, you can refer to this post from php.cn to get solutions. Now, keep on your reading.

Windows supplies real-time protection via Windows Security. But this feature may prevent you from doing something it thinks are dangerous. In this situation, you may want to temporarily turn on real-time protection. This php.cn post will show you how

Microsoft has started working on next year’s Windows updates very early. Recent rumors state that the next update in 2024 might be Windows 11 24H2 rather than Windows 12. Everything is uncertain now. php.cn will now take you to see some related infor

The error 0x80030001 often happens when you are attempting to copy files. The error code will be accompanied by a message that tells “unable to perform requested operation”. If you are struggling with this error, you can read this article on php.cn W

On February 13, 2024, Microsoft released KB5034765 (OS builds 22621.3155 and 22631.3155) for Windows 11 22H2 and Windows 11 23H2. This security update brings you many new improvements and bug fixes. You can learn how to download and install Windows 1

Device Manager is widely used when you need to fix some computer issues. You can check the problematic devices and decide to uninstall or update device drivers. Besides, you can also set Power Management settings in Device Manager. However, you may f

When Backup and Restore (Windows Backup) fails to work, you can choose to reset it to default. How to restore Windows Backup to default in Windows 11/10? php.cn will guide you to easily do this thing in 2 ways and let’s go to see them.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment