The linux command is a command for managing the Linux system. For the Linux system, whether it is the central processor, memory, disk drive, keyboard, mouse, or user, they are all files. The commands for Linux system management are the core of its normal operation, similar to the previous DOS commands. There are two types of Linux commands in the system: built-in Shell commands and Linux commands. In this article, we will list 100 commands that are frequently used when using Linux systems and give a brief explanation.
1, export //View all environment variables
2, wc -l //Count the number of lines, wc -w count words
3, lsattr file //View File attributes
4, cat /etc/passwd |awk -F: '{print $1}' //View all users in the system
5, cat /etc/group //View the system All groups in
6, echo '1+2'|bc -l //Mathematical operations
7, uname -a //View some information about the linux kernel, etc.
8. badblocks -s /dev/sda //Display progress during bad sector scanning
9. time command //View the running time of the command
10. nmap -sP 172.30.4.0 /24 //How many users are operating on my host in this network segment, a good security check tool
11, vgdisplay //View the available space in the system
12, lvextend -L+20G /dev/tank/part1 //Add 20G space to the part1 partition
13, lvresize -L-10G /dev/tank/part2 //Reduce 10G space to the part2 partition
14. pvdisplay //View disk information
15.mplayer -loop 10 /mnt/song/music/花儿开.mp3 //Loop 10 times
16, echo ~/ //Display the user's home directory
17, echo $[5*5] //Arithmetic operations
18, echo $((5*5)) / /Arithmetic operations
19, eval ls;ps aux|grep httpd //Both commands can be executed
20, free -m //Display memory in MB
21. uptime //Displays how long the system has been running. It displays the following information in sequence: current time, how long the system has been running, how many logged-in users are currently, and how long the system has been running in the past 1 minute, 5 minutes, and Average load within 15 minutes
22, addition operation
[root@phpac phpac]# let a=34+3;
[root@phpac phpac]# echo $a;
23, echo "aa" > test.txt and echo "bb" >> test.txt //> Clear the original file and write the content to the file, > ;>Put the content at the end of the file
24, echo $PATH //View a single variable
25, cmp file1 file2 //File content comparison
26 , clear //Clear the screen
27, echo 23423 |awk -re-interval '/[0-9]{3,}/' //If re-interval is not added, it will not be displayed
28, cal //Get a neat calendar format
29, chmod go+w -R /home/zhangy //Add write permissions to group users and other users
30. mirror /mysql //Download the mysql directory
31. Mirror -R /mysql //Upload the mysql directory
32. rmmod pcspkr //Turn off the tab prompt
33. modprobe pcspkr //Turn on the tab prompt sound
34.gpasswd -a zhangy wheel //Add the zhangy user to the wheel group
35.dd if=/dev/zero of=/virtual/ubuntu.virt.img bs=1M count=4096 //Create a 4G IMG image
36, lspic //Display pci device
37, lsusb //Display usb device
38, history | less //less root is a bit like more, it feels more comfortable to use less
39, ln -s //if you forget -s, it will become hard Linked
40, tar zxvf test.tar.gz -C /home/zhangy //Extract the content to the specified directory
41, umask 003 u permission is 7, g permission is 7 , other users are 4, that is, 774, 777-003=774
42, mkfs -t vfat /dev/hda6 //Format a partition in the mobile hard disk into vfat format
43. mount /dev/cdrom /media/cdrom //Mount cdrom
44. getent group 532 //Find group information through group ID
45.last //Login successful User record
46, lastb //Unsuccessful login user record
47, dump -S /dev/sda2 //Check the capacity required to back up /dev/sda2
48, dump -0j -f /dev/hda2/sda2_bak.dump.bz2 /dev/sda2 //Back up and compress sda2
49, restore -t -f /dev/hda2/sda2_bak .dump //View backup information
50, restore -r -f /dev/hda2/sda2_bak.dump //Restore backup
51, fc-list //View the files installed in the system Font
52, find ./ -type f -exec grep -q "root" {} \; -exec echo {} \; //Find the string contained in the file in the directory
53. vmstat 5 //Display the next system information, cpu, memory, i/o, etc. every 5 times
54. After top, use shift + P to sort the processes occupied
55 , top and then shift + M to sort the memory occupied
56, iptraf -g //View the traffic of each interface
57, ostat -d -x /dev/sda2 2 / /Use iostat to check the disk I/O status of disk /dev/sda2, refresh every two seconds
58, paste -sd '|||\n' test //Convert every 4 lines of the file to 1 Line, separated by |.
59, lsof -i :22 //Know what program is currently running on port 22
60, lsof -c abc //Display the files currently opened by the abc process
61 , lsof -p 12 //See which files are opened by the process with process number 12
62, rz -y //Upload files
63, route //View routing information
64, ifup //Open the network card
65, ifdown //Close the network card
66, route del -net 172.168.0.0 netmask 255.255.0.0 dev eth0 //Delete the network 172.168 part
67, route add -net 172.168.10.0 netmask 255.255.255.0 dev eth0 //Add a route
68, netstat -tunl //List the monitored network service ports
69 , netstat -tun //List connected network service ports
70, ls -lrt //Sort in reverse order of time
71, rsync -P //Display progress during synchronization
72.history -c //Clear history command
73, cd – //Return to the last directory
74, tree //Display directory tree
75, umount -n /mnt/hda2 //Force uninstall
76, pacman -S firefox -nd //nd remove dependencies
77, wget -c //Breakpoint download
78. chroot /mnt/ubuntu //Change the root directory to /mnt/ubuntu
79. ctrl+a //Under the command line, move the cursor to the beginning
80. ctrl+e // Under the command line, move the cursor to the end
81. cut -d: -f 1-4 test // Use: split the file and get the 1-4 columns after splitting
82, file /home/zhangy/test.php //Some basic information for viewing files
83, touch test.txt //Create an empty file text.txt
84, htpasswd -cbd /usr/local/nginx/conf/authfile //Create access control file
85, df //View disk space and current number of disks
86 , fdisk -l //View the number of all disks
87, alsamixer //After entering, the m key can mute
88, killall httpd //Kill all httpd processes
89, killall -9 mysqld_safe //Some processes cannot be stopped by super users, -9 is forced deletion
90, echo "AaDCbd23″ |tr "[A-Z]" "[a-z]" capitalization changed Lowercase, echo "AaDCbdc23" |tr -c b-d = Replace strings other than b-d with =
91, echo "ADSF" | iconv -f UTF8 -t GBK //Convert characters from utf8 to gbk -f is the abbreviation of from and -t is like the abbreviation of terminal
92, cat -n file //The line number will be displayed in front of the content
93, chattr +i file //Only Reading and root users cannot modify it
94, tar -tzvf test.tar.gz //List archive contents
95, du -ah //View file list size
96, du -sh //View the total size of all files
97, groups //Check all groups where the current user is located
98, usermod -g Group name user//This method is an overwriting method. Be careful when using it. If user A is different from mysql usermod -g php mysql, then it only
belongs to php.
99 , usermod -G group name user // This method is to add, if user A is different from mysql usermod -g php mysql, mysql will belong to 2 groups
100, bc //Enter Go to
in mathematical calculations. The above are 100 commonly used commands in Linux. Collect the useful ones quickly.
Related recommendations:
The latest Linux command collection
Share a complete collection of Linux command shortcuts
The above is the detailed content of 100 commonly used Linux commands. For more information, please follow other related articles on the PHP Chinese website!

MaintenanceModeinLinuxisaspecialbootenvironmentforcriticalsystemmaintenancetasks.Itallowsadministratorstoperformtaskslikeresettingpasswords,repairingfilesystems,andrecoveringfrombootfailuresinaminimalenvironment.ToenterMaintenanceMode,interrupttheboo

The core components of Linux include kernel, file system, shell, user and kernel space, device drivers, and performance optimization and best practices. 1) The kernel is the core of the system, managing hardware, memory and processes. 2) The file system organizes data and supports multiple types such as ext4, Btrfs and XFS. 3) Shell is the command center for users to interact with the system and supports scripting. 4) Separate user space from kernel space to ensure system stability. 5) The device driver connects the hardware to the operating system. 6) Performance optimization includes tuning system configuration and following best practices.

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.

Linux maintenance mode can be entered through the GRUB menu. The specific steps are: 1) Select the kernel in the GRUB menu and press 'e' to edit, 2) Add 'single' or '1' at the end of the 'linux' line, 3) Press Ctrl X to start. Maintenance mode provides a secure environment for tasks such as system repair, password reset and system upgrade.

The steps to enter Linux recovery mode are: 1. Restart the system and press the specific key to enter the GRUB menu; 2. Select the option with (recoverymode); 3. Select the operation in the recovery mode menu, such as fsck or root. Recovery mode allows you to start the system in single-user mode, perform file system checks and repairs, edit configuration files, and other operations to help solve system problems.

The core components of Linux include the kernel, file system, shell and common tools. 1. The kernel manages hardware resources and provides basic services. 2. The file system organizes and stores data. 3. Shell is the interface for users to interact with the system. 4. Common tools help complete daily tasks.

The basic structure of Linux includes the kernel, file system, and shell. 1) Kernel management hardware resources and use uname-r to view the version. 2) The EXT4 file system supports large files and logs and is created using mkfs.ext4. 3) Shell provides command line interaction such as Bash, and lists files using ls-l.

The key steps in Linux system management and maintenance include: 1) Master the basic knowledge, such as file system structure and user management; 2) Carry out system monitoring and resource management, use top, htop and other tools; 3) Use system logs to troubleshoot, use journalctl and other tools; 4) Write automated scripts and task scheduling, use cron tools; 5) implement security management and protection, configure firewalls through iptables; 6) Carry out performance optimization and best practices, adjust kernel parameters and develop good habits.


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

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor