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!