100 Common Linux Commands

Source: Internet
Author: User
Tags arithmetic clear screen php mysql

1,echo "AA" > Test.txt and Echo "BB" >> test.txt> empties the original file and writes the contents to the file,>> the end of the file

2,chmod go+w-r/home/zhangyAdd Write permissions to group users and other users

3,TAR-TZVF test.tar.gzList archived Content

4,du-ahView file list size

5,du-shView total size of all files

6,echo ' 1+2′|bc-lMathematical operations

7,uname-aView some information such as the Linux kernel

8,badblocks-s/DEV/SDAShow progress on bad path scan

9,time CommandTo view the run time of a command

10,LS-LRTSort by the reverse of time

11,rsync-pShow progress while synchronizing

12.history-cClear History Command

13,CD-Return to last Directory

14,treeShow Directory tree

15,umount-n/mnt/hda2Force Uninstall

16,echo ~/Show user's home directory

17,echo $[5*5]Arithmetic operations

18,echo $ ((5*5))Arithmetic operations

19,eval ls;ps aux|grep httpdAll two of these commands can be executed.

20,free-mMemory is displayed in MB units

21,uptimeShows how long the system has been running, which in turn displays the following information: The current time, how long the system has been running, how many users are currently logged in, the average load of the system in the last 1 minutes, 5 minutes, and 15 minutes

22, addition Operation
[[email protected] mytest]# let a=34+3;
[Email protected] mytest]# echo $a;

23,exportView all environment variables

24,echo $PATHView a single variable

25,cmp file1 file2Comparison of file contents

26,clearClear Screen

27,echo 23423 |awk-re-interval '/[0-9]{3,}/'If you do not add re-interval, do not display

28,calGet a neat calendar format

29,wc-lCount rows, wc-w statistical words

30,echo "Aadcbd23〃|tr" [A-Z] "" [A-z] "uppercase lowercase, echo" aadcbdc23〃|tr-c b-d =Replace a string other than b-d with =

31,echo "ADSF" | iconv-f utf8-t GBKConvert character from UTF8 to gbk-f is from and shorthand,-t like terminal shorthand

32,cat-n FileLine numbers are displayed in front of the content

33,chattr +i FileRead-only, and the root user cannot modify it

34,lsattr FileView file properties

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

36,cat/etc/groupView all groups in the system

37,groupsBefore checking the current user, all groups

38,usermod-gGroup name user//This way is overridden in a way that uses the time to be careful if User A is a sex in MySQL usermod-gphp mysql such words only
It belongs to PHP,

39,usermod-g Group name userThis way is increased by the way that if user A is in MySQL usermod-g php mysql so, MySQL belongs to 2 groups

40,BCGo into the math calculation

41,umask 003The U permission is the 7,g permission is 7, the other user is 4, that is 774,777-003=774

42,mkfs-t Vfat/dev/hda6Format a partition of a removable hard drive into VFAT format

43,mount/dev/cdrom/media/cdromMount CDROM

44,getent Group 532To find group information by group ID

45,lastLogin successful user record

46,lastbLogon unsuccessful user record

47,dump-s/dev/sda2Check the capacity you want to back up the/dev/sda2

48,dump-0j-f/dev/hda2/sda2_bak.dump.bz2/dev/sda2To back up and compress the Sda2

49,restore-t-f/dev/hda2/sda2_bak.dumpView backup Information

50,restore-r-f/dev/hda2/sda2_bak.dumpRestoring a backup

51,fc-listTo view the fonts installed in the system

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

53,vmstat 5Every 5 times System information is displayed, CPU,MEMORY,I/O, etc.

54,top after shift + PThe sorted display of the occupied process

55,top after shift + MThe sorted display of the occupied memory

56,iptraf-gView traffic for each interface

57,ostat-d-x/dev/sda2 2Use Iostat to see disk I/O for disk/dev/sda2, refreshed every two seconds

paste-sd ' | | | \ n ' TestEach 4 lines of the file are converted to 1 lines, separated by |

59,lsof-i:Know what program 22 port is running now

60,lsof-c ABCDisplays the files that the ABC process now opens

61,lsof-pSee what files are open for processes with process number 12

63,routeViewing routing information

64,ifupTurn on the NIC

65,ifdownTurn off the NIC

66,route del-net 172.168.0.0 netmask 255.255.0.0 Dev eth0Delete 172.168 this network segment

67,route add-net 172.168.10.0 netmask 255.255.255.0 dev eth0Add a route

68,NETSTAT-TUNLList the network service ports that are listening

69,netstat-tunList Connected Network Service ports

70,nmap-sp 172.30.4.0/24How many users are operating on my console in this network segment, a good security check tool

71,vgdisplayView available space in the system

72,lvextend-l+20g/dev/tank/part1Add 20G of space to this part1 partition

73,lvresize-l-10g/dev/tank/part2Reduce 10G of space to the Part2 partition

74,pvdisplayView disk Information

75,mplayer-loop 10/mnt/song/music/flowers are blooming. mp3Play 10 times in a loop

76,pacman-s firefox-ndnd Remove Dependency

77,wget-cBreakpoint Download

78,chroot/mnt/ubuntuChanging the root directory to/mnt/ubuntu

79,ctrl+acommand line, the cursor is called to the beginning

80,ctrl+eAt the end of the command line, the cursor moves

81,cut-d:-F 1-4 TestUse: Split the file, take the split 1-4 columns

82,file/home/zhangy/test.phpSome basic information for viewing a file

83,touch test.txtCreate an empty file Text.txt

84,htpasswd-cbd/usr/local/nginx/conf/authfileCreate an Access control file

85,DFView disk space, and the current number of disks

86,fdisk-lView all disks

87,alsamixerAfter entering, the M key can be used for mute

88,killall httpdKill all the httpd processes.

89,killall-9 Mysqld_safeSome process super users can not stop, 9 is forced to delete

90,mirror/mysqlDownload MySQL Directory

91,mirror-r/mysqlUpload MySQL Directory

92,rmmod PCSPKRTurn off the tab beep

93,modprobe PCSPKRTurn on the tab beep

94,gpasswd-a zhangy WheelAdd zhangy This user to the wheel group

95,dd if=/dev/zero of=/virtual/ubuntu.virt.img bs=1m count=4096Create an IMG image of 4G

96,lspicdisplaying PCI devices

97,lsusbdisplaying USB devices

98,history |Less root more like a little more comfortable

99,ln-sIf you forget-s, it becomes a hard link.

100,tar zxvf test.tar.gz-c/home/zhangyExtract content to the specified directory

100 Common Linux Commands

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.