Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sharing of common command usage in Linux

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "Linux common command usage sharing". In daily operation, I believe many people have doubts about Linux common command usage sharing. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "Linux common command usage sharing"! Next, please follow the editor to study!

Here are 100 usages. If there is anything wrong, please correct it.

1Dome echo "aa" > test.txt and echo "bb" > > test.txt / > empty the original file and write the content to the file, > > put the content at the end of the file

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

3tar-tzvf test.tar.gz / / lists the contents of the archive

4DU-ah / / View file list size

5 du-sh / / View the total size of all files

6 bc echo '1cm 2' | Math operation-l / /

7 linux uname-a / / View some information about the kernel, etc.

8Badmings-s / dev/sda / / shows the progress when scanning bad tracks

9 working time command / / View the running time of the command

10 sorting ls-lrt / / in reverse order of time

11pm rsync-P / / shows the progress when synchronizing

12.history-c / / clear history command

137CD-/ / return to the last directory

14 ~ (th) tree / / display directory tree

15recoverumount-n / mnt/hda2 / / forced uninstall

16D echo ~ / / displays the user's home directory

17D echo $[5pm 5] / / arithmetic operation

18D echo $((5recent 5)) / / arithmetic operation

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

20 minutes free-m / / display memory in MB

21pr uptime / / shows how long the system has been running. It shows the following information in turn: the current time, how long the system has been running, how many users have logged in, and the average load of the system in the past 1 minute, 5 minutes and 15 minutes.

22, addition operation

[root@krlcgcms01 mytest] # let axia343.3

[root@krlcgcms01 mytest] # echo $a

23dimentional export / / View all environment variables

24Die echo $PATH / / View a single variable

25pcmp file1 file2 / / file content comparison

26th clear / / clear screen

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

2828 cal / / get a neat calendar format

29dwc-l / / counts rows and wc-w counts words

30 AaDCbd23 echo "AaDCbd23" | tr "[Amurz]"[Amurz]" uppercase is lowercase, echo "AaDCbdc23" | tr-c BMurd = replace the string other than bmurd with =

31 ADSF echo "ADSF" | iconv-f UTF8-t GBK / / convert characters from utf8 to gbk-f is from and abbreviation,-t is like the abbreviation of terminal

32 file cat-n line number will be displayed in front of the content

33Gramchattr + I file / / read-only, and root users cannot modify it.

34J lsattr file / / View file properties

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

36Cat / etc/group / / View all groups in the system

37 groups / / check all groups that the current user belongs to before

38 mysql usermod usermod-g group name user / / this is the way to overwrite, be careful when using it, if user An is of the nature of user-g php mysql only

It belongs to php.

39ma usermod-G group name user / / this is the way to increase. If user An is mysql usermod-g php mysql, mysql belongs to two groups.

40 BC / / enter into the mathematical calculation

41jimeumask 003u permissions are 7 and g permissions are 7, and other users are 4, that is, 774777-003 permission 774

42MKFS-t vfat / dev/hda6 / / format a partition in the removable hard disk into vfat format

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

44GetGetent group 532 / / find group information through group ID

45 last / / log in successful user record

46 record of unsuccessful users logging in to lastb / /

47J dump-S / dev/sda2 / / check the capacity required to back up / dev/sda2

48pm dump-0j-f / dev/hda2/sda2_bak.dump.bz2 / dev/sda2 / / back up and compress the sda2

49rec restore-t-f / dev/hda2/sda2_bak.dump / / View backup information

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

51force fcMuslist / / View the fonts installed in the system

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

53Jing vmstat 5 / / every 5 displays the secondary system information, cpu,memory,i/o, etc.

The ranking of processes occupied by shift + P after 54 focus top shows

The sort of memory occupied by shift + M after 55 minutes top shows

56 minute iptraf-g / / View the traffic of each interface

57 iostat Ostat-d-x / dev/sda2 2 / / use iostat to check the disk iUnivero of disk / dev/sda2 and refresh it every two seconds

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

59dint lsof-I: 22 / / know what program port 22 is running now.

6010 lsof-c abc / / displays the files now opened by the abc process

61rec lsof-p 12 / / see which files are opened by the process with process number 12

63 minute route / / View routing information

64 focus ifup / / turn on the network card

65fufdown / / close the network card

66 del route-net 172.168.0.0 netmask 255.255.0.0 dev eth0 / / Delete the network segment 172.168

67 add route-net 172.168.10.0 netmask 255.255.255.0 dev eth0 / / add a route

68pm netstat-tunl / / lists the network service ports that are listening

69pm netstat-tun / / lists the connected network service ports

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

71rec vgdisplay / / View the available space in the system

72 LV extend-Lines 20g / dev/tank/part1 / / add 20g of space to the partition part1

73 LV resize-Ltel 10G / dev/tank/part2 / / reduce 10G of space to the partition part2.

74dint pvdisplay / / View disk information

75 Mplayer-loop 10 / mnt/song/music/ blossoms. Mp3 / / play it 10 times in a loop

76 firefox Pacman-S Pacman-nd / / nd remove dependency

77dint wget-c / / breakpoint download

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

79 under the command line, the cursor moves to the beginning of the command line.

At the end of the cursor movement under the command line 8010 ctrlSecrete / /

81 meme cut-d:-f 1mur4 test / / use: split the file, take the split 1Mui 4 columns

82 home/zhangy/test.php file / file / / is used to view some basic information of the file

83MagneTouch test.txt / / create an empty file text.txt

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

85df / / View disk space and current number of disks

86 forward fdisk-l / / View the number of all disks

The m key can be muted after entering 87century alsamixer / /.

88J Killall httpd / / Kill all httpd processes

89djillall-9 mysqld_safe / / some processes cannot be stopped by super users.-9 is a forced deletion.

90 mirror / mysql / / download the mysql directory

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

92 pcspkr rmmod / / turn off the tab tone

93dyadic modprobe pcspkr / / enable tab tone

94Gpasswd-a zhangy wheel / / add the user zhangy to the group wheel

95dd if=/dev/zero of=/virtual/ubuntu.virt.img bs=1M count=4096 / / create a 4G IMG image

96 focus lspic / / display pci device

97 minute lsusb / / display usb device

98 less history | less / / less root more is a bit like, feeling that less is more comfortable to use

99991n-s / / if you forget-s, it becomes a hard link.

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

At this point, the study on "Linux common command usage sharing" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report