A variety of commands, tools, and other statistics used in the learning process

Source: Internet
Author: User
Tags disk usage

One, the Linux command:

1, Fdisk-l; View all the Partitions

2, Fdisk/dev/sdb; To operate on a partition

3, mkfs;//disk format, for example: Mkfs-t ext4/dev/sdb3

4. dumpe2fs/dev/sdb2;//observation File system

5, Free-m; View memory and swap information

6, Fdisk divided into a partition to the system as SWAP,MKSWAP/DEV/SDB3; SWAPON/DEV/SDB3;

7, create a large file; Mkswap/home/swap.file; Swapon/home/swap.file

8, DD If=/dev/zero of=/home/dev bs=1m count=256

9, Swapoff/home/swap.file;

10, mount-t ext4/dev/sdb3/home/space;//equipment mount

11, Df-h; viewing mount Information

12, UMOUNT/DEV/SDB3;

13. Set up auto-mount in/etc/fstab.

14, Mount-a; Check the/etc/fstab file for errors and mount all the devices defined inside it

15. du-ha/home/space;//file system disk usage or directory usage

16, Echo $JAVA _home;

17, variable set name=nextflower; Echo $name;

18. Variable contents are provided by other commands: version=$ (uname)

19, unset variable name; #取消变量的定义

20, Env; #查看环境变量

21, export var=flower; #普通变量变为环境变量

22, Find/-name *.log-size +10000c-exec ls {} \; #查找大小大于10000字节的文件

23, find. -perm 755-print; #按照文件权限来查找文件

24, find. -user Nextflower-print; #按照文件所有者来查找文件

25, find/-group oracle-print; #按照文件所属的组来查找文件

26, Find/-mtime-5-print; #修改时间5天以内的文件

27, find/-mtime +3-print; #修改时间在3日以前的文件

28, Find/-nogroup-print; #查找无有效所属组的文件

29, Find/etc-type D print; All directories in #查找/etc directory

30. SED command

31. grep command

32. Tail command

33. Sort command

34. Cut command

35. History command

36, Top: Dynamic observation program changes

37, Pstree-a; #打印系统所有进程树

38, Pstree-aup; #系统进程树同事显示PID与userSS

39, Ps-l; #仅观察自己的bash相关进程

40, Kill-l; #查看所有可用信号signal

41, Kill-1 PID; #重新加载并启动

42, kill-9 PID; #强制杀掉一个进程

43, Killall-9 sshd; #强制终止所有以sshd启动的进程

44. Uname: View system and kernel related information

45, Uname-a; #所有系统相关的信息

46, Uname-s; #系统内核名称

47, Uname-r; #内核版本

48, Uname-m; #本系统的硬件名称, such as i686 or x86_64, etc.

49, Uname-p; #CPU类型

50, Uname-i; #硬件的平台

51, Uptime: Observe the system start time and workload

52, Netstat: Network monitoring

53, Netstat-a; #将目前系统上所有的已经连接, listening, and socket data are listed to

54, Netstat-t; #列出tcp网络包的信息

55, Netstat-u; #列出udp网络包的信息

56, Netstat-n; #以端口形式来显示

57, Netstat-l; #列出目前正在监听的服务

58, Netstat-p; #列出该网络服务的进程id.

59, Vmstat: Detection system Resource changes

60, Vmstat 1 3; #统计目前主机CPU状态, 1 times per second, total 3 times.

61. Jobs: View Current work status

62, Jobs-l; #除了列出job number and instruction string, colleagues list PID numbers

63, Jobs-r; #仅列出正在后台run的任务

64, Jobs-s; #仅列出正在后台暂停的任务.

65, FG Jobnumber; #将后台任务拿到前台执行

66, Gzip-v Man.config; #此种方式压缩完毕后, the source file disappears

67, gzip-d man.config.gz; #解压缩文件, the compressed file disappears

68, Tar-zpcv-f/root/etc.tar.gz/etc; #

69, RPM-IVH Package_name; #安装显示进度

70, RPM-QA | grep jdk; #列出所有已经安装在本机上的软件名称

71, RPM-QL jdk; #列出该软件所有的文件与目录所在的完整文件名

72, RPM-QR jdk; #查看jdk所需要的依赖

73, Rpm-v JDK; #查看jdk是否被改动过

74, Rpm-e JDK; #卸载

75, Yum Search; #解析/etc/yum.repos.d/*.repo File

76, yum list;

77, yum install package_name;

78,/ETC/INIT.D/HTTPD status;

79,/ETC/INIT.D/HTTPD start;

80. Ifconfig: NIC Configuration

81, Ping mainly through the ICMP packet for the entire Network status report

82, Ping-c 5; #执行5次ping操作

83. Traceroute track the routing between two hosts

84, Traceroute IP; #

85, Chkconfig; #检查开机阶段启动的服务

86. Tcpdump the network packet from the NIC

87, wget download resources from the network, morning storage to the current directory

88, Wget-o hadoop.new Http://www.hadoop.com/hadoop.zip; #下载并重新命名

89, wget--limit-rate=300k http;//www.hadoop.com; #限速下载

90, Wget-c http://www.hadoop.com; #使用断点续传

91. Rsync Data Mirroring Backup tool

92. Curl Get Web Form

Second, tool use 1, VIM Editor: A, General mode shortcut keys:

H: The cursor shifts one character to the left.

J: The cursor moves down one character.

K: Move the cursor up one character.

L: The cursor shifts one character to the right.

Crtl+f: The screen moves down one page.

Crtl+b: The screen moves up one page.

H: The cursor moves to the first character of the row at the top of the current screen.

M: The cursor moves to the first character of the line in the middle of the current screen.

L: The cursor moves to the first character in the bottom row of the current screen.

G: Move to the last line of the file.

NG: Move to Nth line of file

GG: Move to the first line.

N[enter]: The cursor moves down n rows.

/work: Look down word word

? work: Find word up word

N: Indicates that the previous find operation was repeated.

N: Contrary to N.

: s/word1/word2/g replace word1 with Word2 on current line lookup

:%s/word1/word2/g replaces the current file lookup word1 with Word2

: N1,n2s/word1/word2/g in N1 to N2 line find Word1 Replace with Word2

: 1, $s/word1/word2/g in 1 to the last row find Word1 replace with Word2

: 1, $s/word1/word2/gc confirm that the user is replaced before replacing.

X: Remove one character backwards

NX: Removes n characters backwards.

X: Deletes a character forward.

DD: Delete cursor in the row

NDD: Deletes the following n lines of the row where the cursor is located.

D1G: Deletes all data from the row to the first row of the cursor.

DG: Removes all data from the line to the last row of the cursor.

d$: Deletes the last character of the cursor to the same peer ...

D0: Deletes the first character of the cursor at the same place.

YY: The line where the cursor is copied.

NYY: The copy cursor is located down n rows.

Y1G: Copies all data from the row of the cursor to the first row.

YG: Copies all data from the row to the last row of the cursor.

y$: Copies the cursor to the last character of the peer.

Y0: Copies the cursor to the first character of the peer.

P: Pastes the copied data to the next line of the cursor.

P: Pastes the copied data to the previous line.

U: Restores the previous operation.

B, edit mode shortcut key:

I: Insert from where the cursor is located.

L: Inserted from the first non-white-space word in the row of prompt.

A: Insert from the next character where the cursor is located.

A: Prompt inserted from the last word in the line where the cursor is located.

o: Insert a new line at the next line where the cursor is located.

O: Inserts a new line on the line where the cursor is located.

R: replaces the character at which the cursor is located one time.

R: Always replace the text at the cursor until ESC is pressed

C, Command mode shortcut key:

: W[filename]: Save as filename

: r[filename]: Read filename to the line following the cursor

: N1,n2 W[filename] Save N1 to N2 row as filename

: q!

: wq!

: Set Nu

: Set Nonu

2. SED command:

SED is a non-interactive text processing tool.

A, sed "s/hadoop/hadoop2/g" demo.txt > Demo2.txt

B, Sed-i "s/hadoop/hadoop2/g" demo.txt; #修改原文件内容

C, sed "3s/hadoop/hadoop2/g" demo.txt; #只替换第三行

D, sed "1,2s/hadoop/hadoop2/g" demo.txt; #替换第1到第2行的文本

E, sed "S/L/L/1" demo.txt; #替换每一行的第一个l;

F, sed "S/G/G/2" demo.txt; #替换每一行的第二个;

G, sed "s/g/g/3g" demo.txt; #替换第一行的第3个以后的g;

H, sed "s/g/g/1;s/h/h/3g" demo.txt; #一次替换多个模式

I, sed "s/g/g/1"-E "s/h/h/3g" demo.txt; #效果同上

J, sed "1 I hi World" demo.txt; #在第一行后新加一行数据

K, sed "1 a Hi World" demo.txt; #在第一行后追加

L, sed "/hive/d" demo.txt; #d动作删除匹配行

3. grep command:

-? : Displays the top and bottom of matching rows at the same time? Yes

-B: Print the block number where the matching line is located

-C: Prints only the number of matched rows and does not print matching content

-I: Ignore case

-N: Prints line numbers in front of matching lines

--color: Highlight Hit

4. Sort command:

-N: Sort by value

-U: Duplicate rows do not appear

-R: Reverse Sort

-T: Specify the symbol for the segment

-K: The number of paragraphs specified

5. Cut command:

Cut-b 2 demo.txt; #剪切每一行的第二个字节

Cut-b 5-7 Demo.txt; #剪切每一行的第5-7 bytes

Cut-b 9-demo.txt; #剪切每一行的第9个字节之后

Cut-b-9 Demo.txt; #剪切每一行的第9个字节之前

Cut-d. -F 2 demo.txt; #以点为分隔符获取第二个字段

Third, the common operation of Linux

1, Cat/etc/shells #查看系统提供了哪些种类shell

A variety of commands, tools, and other statistics used in the learning process

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.