Home Computer Tutorials Computer Knowledge 150 common commands you must know in Linux operation and maintenance

150 common commands you must know in Linux operation and maintenance

Feb 18, 2024 pm 04:48 PM
linux Order Formatted output All spelled out

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.

The
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.
mail 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 command 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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

How to use VSCode How to use VSCode Apr 15, 2025 pm 11:21 PM

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages ​​and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

See all articles