100 common Linux commands

Source: Internet
Author: User

100 common Linux commands

List several commands that are frequently used in linux and give a brief description.

1. export // view all environment variables

2. wc-l // number of rows and wc-w 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 all groups in the system

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 of bad track scanning.

9. time command // view the command running time

10. nmap-sP 172.30.4.0/24 // the number of users in the CIDR block on my host and a good security check tool

11. vgdisplay // view available space in the system

12. lvextend-L + 20G/dev/tank/part1 // Add 20G space to the partition part1

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

14. pvdisplay // view disk Information

15. mplayer-loop 10/mnt/song/music/Hua Er opened the loop // played for 10 times

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, and 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 @ phpac] # let a = 34 + 3;

[Root @ phpac] # echo $;

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 screen

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

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 // enable the tab prompt

34. gpasswd-a zhangy wheel // Add the user named zhangy to the group

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

36. lspic // display the pci device

37. lsusb // display usb devices

38. history | less // less root is a bit more, and it feels more comfortable to use less

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

40. tar zxvf test.tar.gz-C/home/zhangy // decompress 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 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 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 status of Disk/dev/sda2 and refresh 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 // You know what programs are running on port 22.

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

61. lsof-p 12 // check the files opened by the process whose process number is 12.

62. rz-y // upload a file

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. ls-lrt // sort by time in reverse order

71. Progress displayed during rsync-P // Synchronization

72. history-c // clear historical commands

73. cd-// return the last directory

74. tree // display the directory tree

75. umount-n/mnt/hda2 // force uninstall

76. Remove Dependencies from pacman-S firefox-nd/nd.

77. wget-c // breakpoint download

78. chroot/mnt/ubuntu // change the root directory to/mnt/ubuntu

79. ctrl + a // run the command line and the light starts with nominal animation.

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 and retrieve the first-four columns after the split

82. file/home/zhangy/test. php // you can view basic information about a 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 current number of disks

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

87. alsamixer // after entering, the m key can be muted.

88. killall httpd // kill all httpd processes.

89. killall-9 mysqld_safe // some process superusers cannot stop, and-9 is forced to delete

90. echo "AaDCbd23" | tr "[A-Z]" "[a-z]" uppercase small write, echo "AaDCbdc23" | tr-c B-d = convert B-d replace string with =

91. echo "ADSF" | iconv-f UTF8-t GBK // convert the character from utf8 to gbk-f. It is from and simplified, and-t is short for terminal.

92. The line number is displayed before cat-n file //.

93. chattr + I file // read-only and root users cannot modify it.

94. tar-tzvf test.tar.gz // list the archived content

95. du-ah // view the file list size

96. du-sh // view the total size of all files

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

98. usermod-g group name user // This method is the overwrite method. Be careful when using it. If user A is used in mysql usermod-g php mysql, only

Php,

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

100. bc // enter the math

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.