100 most commonly used linux commands.

Source: Internet
Author: User
Tags php mysql

1. 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.

2. chmod go + w-R/home/zhangy // Add write permissions to group users and other users

3, tar-tzvf test.tar.gz // list the archive content

4, du-ah // view the file list size

5, du-sh // view the total size of all files

6, echo '1 + 2' | bc-l // mathematical operation

7. uname-a // view the Linux kernel and other information

8. badblocks-s/dev/sda // shows the progress during bad track scan.

9, time command // view the command running time

10, ls-lrt // sort by time in reverse order

11. rsync-P // The synchronization progress is displayed.

12. history-c // clear historical commands

13, cd-// returns the last directory

14. tree // display the directory tree

15, umount-n/mnt/hda2 // force uninstall

16, echo ~ /// Display the user's home directory

17, echo $ [5*5] // arithmetic operation

18, echo $ (5*5) // arithmetic operation

19, eval ls; ps aux | grep httpd // both commands can be executed

20, free-m // memory displayed in MB

21. uptime // shows 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 login users are there, the average load of the system in the past 1 minute, 5 minutes, and 15 minutes

22. addition operation

[Root @ krlcgcms01 mytest] # let a = 34 + 3;

[Root @ krlcgcms01 mytest] # echo $;

23, export // view all environment variables

24, echo $ PATH // view a single variable

25, cmp file1 file2 // File Content Comparison

26, clear // clear screen

27, echo 23423 | awk-re-interval '/[0-9] {3,}/' // if re-interval is not added, it is not displayed

28, cal // get a neat calendar format

29, wc-l // number of statistical rows, wc-w statistical words

30, echo "AaDCbd23" | tr "[A-Z]" "[a-z]" in upper case, echo "AaDCbdc23" | tr-c B-d = replace a string other than B-d with =

31, echo "ADSF" | iconv-f UTF8-t GBK // convert the character from utf8 to gbk-f is from and short write, and-t is like terminal shorthand

32, cat-n file // The line number is displayed before the content

33. chattr + I file // read-only, and cannot be modified by the root user

34, lsattr file // View file Attributes

35, cat/etc/passwd | awk-F: '{print $1}' // view all users in the system

36, cat/etc/group // view all groups in the system

37. groups // check all groups of the current user

38. usermod-g group name users // This method is covered. Be careful when using this method. If user A is similar to mysql usermod-g php mysql, only

Php,

39. usermod-G group name user // This method is added. If user A is like mysql usermod-g php mysql, mysql will belong to two groups.

40, bc // enter the mathematical computation

41. umask 003 u permission is 7, g permission is 7, and other users are 4, that is, 774,777-003 = 774

42. mkfs-t vfat/dev/hda6 // format a partition in the mobile hard drive into vfat format.

43. mount/dev/cdrom/media/cdrom // mount cdrom

44, getent group 532 // you can use the group ID to find the group information.

45. last // logon success user record

46. lastb // records of unsuccessful logon users

47. dump-S/dev/sda2 // check the capacity to be backed up by/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 the backup information

50, restore-r-f/dev/hda2/sda2_bak.dump // restore the backup

51, fc-list // view the fonts INSTALLED IN THE SYSTEM

52, find./-type f-exec grep-q "root" {}\;-exec echo {}\; // find the character string contained in the file in the directory

53. vmstat 5 // displays the system information, cpu, memory, and I/o information every 5 times.

54. Sorting of shift + P processes after top

55. Sort the memory occupied by shift + M after top

56, iptraf-g // view the traffic of each interface

57. ostat-d-x/dev/sda2 2 // use iostat to view disk I/o information of Disk/dev/sda2, Which is refreshed every two seconds.

58, paste-sd' | \ n' test // each of the four lines of the file is converted into one line and separated by |.

59, lsof-I: 22 // know what program is running on port 22

60, lsof-c abc // display the files currently opened by the abc process

61, lsof-p 12 // check which files are opened by the process whose process number is 12

63, route // view route information

64, ifup // enable the NIC

65, ifdown // disable the NIC

66, route del-net 172.160.0 netmask 255.255.0.0 dev eth0 // Delete the 172.168 CIDR Block

67, route add-net 172.1610.0 netmask route 255.255.0 dev eth0 // add a route

68, netstat-tunl // list the listening network service ports

69, netstat-tun // list the connected network service ports

70, nmap-sP 172.30.4.0/24 // how many users are operating on my host in this network segment, a good security check tool

71. vgdisplay // view available space in the system

72, lvextend-L + 20G/dev/tank/part1 // Add 20G space to the partition part1

73, lvresize-L-10G/dev/tank/part2 // reduce the space by 10 Gb to the part2 Partition

74, pvdisplay // view disk Information

75, mplayer-loop 10/mnt/song/music/Hua Er opened the loop // played for 10 times

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, the light starts with nominal Motion

80, ctrl + e // move the cursor to the end of the command line

81, cut-d:-f 1-4 test // use: to split the file, take the first-4 columns after the split

82, file/home/zhangy/test. php // used to view some basic information about the file

83, touch test.txt // create an empty file text.txt

84, htpasswd-cbd/usr/local/nginx/conf/authfile // create an access control file

85, df // view the disk space and the current number of disks

86, fdisk-l // view the number of all disks

87. After alsamixer // enters, the m key can be muted.

88, killall httpd // kill all httpd Processes

89, killall-9 mysqld_safe // some process superusers cannot stop,-9 is force Delete

90, mirror/mysql // download the mysql directory

91, mirror-R/mysql // upload the mysql directory

92, rmmod pcspkr // turn off the tab prompt

93, modprobe pcspkr // enable the tab prompt

94, gpasswd-a zhangy wheel // Add the user zhangy to the group

95, dd if =/dev/zero of =/virtual/ubuntu. virt. img bs = 1 M count = 4096 // create a 4g img Image

96, lspic // display pci device

97, lsusb // display usb device

98, history | less // less root is more like, it feels more comfortable to use less

99, ln-s // if you forget-s, it turns into a hard link.

100, tar zxvf test.tar.gz-C/home/zhangy // decompress the content to the specified directory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.