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

PHPz
Release: 2024-02-18 16:48:13
forward
578 people have browsed it

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!

source:mryunwei.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template