First, review
1, vi use:
1.1, the normal edit a file, save and exit
1.2, paste pit: i key must edit mode
2, find the error
cat xxx.log | grep -C 10 ERROR > error.log
cat more sz
Into the tail line mode: / Enter keyword automatic matching to find the next key press N
3, set the line number
Into the tail line mode:
SET NU
SET nonu
4, emptied the contents of this
cat / dev / null> xxx.log perfect
echo ''> xxx.log presence of 1 byte
5, command line mode common shortcuts:
dd delete the current line
dG delete the current cursor and all the following rows
ndd deleted and the cursor is currently below the line n
gg jump to the first letter of the first row
G to jump to the first letter of the last row
shift + $ end of line
gg + dG
Second, the process port number
1, system commands - Disk
[root@localhost ~]# df -h File system capacity has been available for use with % mount point / dev / Mapper / VolGroup00- LogVol00 15G 3.8G 11G 27% / /dev/sda1 99M 14M 81M 15% /boot tmpfs 829M 0 829M 0% /dev/shm none 829M 104K 829M 1% /var/lib/xenstored /dev/scd0 2.9G 2.9G 0 100% /media/RHEL_5.5 i386 DVD [root@localhost ~]#
2, system commands - Memory
[root@localhost ~]# free -m total used free shared buffers cached Mem: 1658 971 686 0 119 519 -/+ buffers/cache: 332 1325 Swap: 5023 0 5023 [root@localhost ~]#
3, system commands - Load
[root@localhost ~]# top top - 02:29:38 up 2:32, 4 users, load average: 0.00, 0.00, 0.00 Tasks: 213 total, 2 running, 210 sleeping, 0 stopped, 1 zombie People (s): 0.0 % us, 0.0 % sy, 0.0 % Ni, 100.0 % id, 0.0 % when 0.0 % hi, 0.0 % si, 0.0 % st Mem: 1697792k total, 994768k used, 703024k free, 122228k buffers Swap: 5144568k total, 0k used, 5144568k free, 531792k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 15 0 2088 644 552 S 0.0 0.0 0:00.54 init 2 root RT -5 0 0 0 S 0.0 0.0 0:02.83 migration/0 3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0 4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 5 root RT -5 0 0 0 S 0.0 0.0 0:02.62 migration/1 6 root 36 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1 7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1 8 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0 9 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/1 10 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khelper 11 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread 13 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenwatch 14 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 xenbus 17 root 10 -5 0 0 0 S 0.0 0.0 0:00.12 kblockd/0 18 root 10 -5 0 0 0 S 0.0 0.0 0:00.03 kblockd/1 19 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid 180 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/0 [root@localhost ~]#
Experience no more than 10 Otherwise believe this physical server IDC room 100,100,100 2 physical core GPU 56
4, system commands - see the port number to see the process
4.1 Process
[root@localhost ~]# ps -ef|grep ssh
root 4377 1 0 Nov21 ? 00:00:00 /usr/sbin/sshd
linux 5569 5534 0 Nov21 ? 00:00:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c "/usr/bin/dbus-launch --exit-with-session /etc/X11/xinit/Xclients"
root 6710 4377 0 00:09 ? 00:00:00 sshd: root@pts/1
root 8451 4377 0 00:30 ? 00:00:00 sshd: root@pts/3
root 9018 8943 0 02:29 pts/3 00:00:00 grep ssh
[root@localhost ~]#
[root@localhost ~]# ps -ef|grep ssh | grep -v grep
root 4377 1 0 Nov21 ? 00:00:00 /usr/sbin/sshd
linux 5569 5534 0 Nov21 ? 00:00:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c "/usr/bin/dbus-launch --exit-with-session /etc/X11/xinit/Xclients"
root 6710 4377 0 00:09 ? 00:00:00 sshd: root@pts/1
root 8451 4377 0 00:30 ? 00:00:00 sshd: root@pts/3
[root@localhost ~]#
4.2 port numbers
[root@localhost ~]# netstat -nlp |grep 6710 [root@localhost ~]# netstat -nlp |grep 762 unix 2 [ ACC ] STREAM LISTENING 17622 4896/xenstored /var/run/xenstored/socket unix 2 [ ACC ] STREAM LISTENING 17623 4896/xenstored /var/run/xenstored/socket_ro [root@localhost ~]# netstat -nlp |grep 74886 [root@localhost ~]# netstat -nlp |grep ssh tcp 0 0 :::22 :::* LISTEN 4377/sshd unix 2 [ ACC ] STREAM LISTENING 19951 5569/ssh-agent /tmp/ssh-uUAfXg5534/agent.5534 [root@localhost ~]#
By pid find port
must initiate a process PS: 1
2: may not have to start a port netstat
Third, the connection refusal (limited rights)
Fourth, high-risk order
rm -rf /
When vi production profiles 100 line, save and backup, cp xxx.xml xxx.xml20191117
ps process xxx, top command to query rammed living / delete xxx process
kill -9 pid process
kill -9 pid process a process pid process pid
kill -9 $ (pgrep -f matched)
Before scrapping process, first find the relevant ps process, figure out what you kill, or cause accidents
[root@ruozedata001 conf]# ps -ef|grep http root 91733 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91734 91733 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91735 91733 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91736 91733 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91737 91733 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91738 91733 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND root 93161 83057 0 22:46 pts/1 00:00:00 grep --color=auto http [root@ruozedata001 conf]# kill -9 91733 [root@ruozedata001 conf]# [root@ruozedata001 conf]# ps -ef|grep http apache 91734 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91735 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91736 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91737 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91738 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND root 93185 83057 0 22:46 pts/1 00:00:00 grep --color=auto http [root@ruozedata001 conf]# kill -9 91734 91735 91736 [root@ruozedata001 conf]# [root@ruozedata001 conf]# ps -ef|grep http apache 91737 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND apache 91738 1 0 22:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND root 93207 83057 0 22:46 pts/1 00:00:00 grep --color=auto http [root@ruozedata001 conf]# [root@ruozedata001 conf]# [root@ruozedata001 conf]# echo $(pgrep -f http) 91737 91738 [root@ruozedata001 conf]# pgrep -f http 91737 91738 [root@ruozedata001 conf]# kill -9 $(pgrep -f http) kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] [root@ruozedata001 conf]# [root@ruozedata001 conf]# [root@ruozedata001 conf]# pgrep -f http [root@ruozedata001 conf]# ps -ef|grep http root 93533 83057 0 22:48 pts/1 00:00:00 grep --color=auto http [root@ruozedata001 conf]#
Five commonly used wget yum rpm Compression
yum search xxx yum install -y xxx-yyy yum remove xxx-yyy [root@ruozedata001 conf]# [root@ruozedata001 conf]# rpm -qa | grep http httpd-2.4.6-90.el7.centos.x86_64 httpd-tools-2.4.6-90.el7.centos.x86_64 [root@ruozedata001 conf]# [root@ruozedata001 conf]# rpm -e httpd-tools-2.4.6-90.el7.centos.x86_64 error: Failed dependencies: httpd-tools = 2.4.6-90.el7.centos is needed by (installed) httpd-2.4.6-90.el7.centos.x86_64 [root@ruozedata001 conf]# Delete httpd - 2.4 . 6 - 90 .el7.centos.x86_64 httpd-tools-2.4.6-90.el7.centos.x86_64 rpm -e --nodeps httpd-tools-2.4.6-90.el7.centos.x86_64 - nodeps not check, delete [root@ruozedata001 conf]# rpm -qa | grep http httpd-tools-2.4.6-90.el7.centos.x86_64 httpd-2.4.6-90.el7.centos.x86_64 [root@ruozedata001 conf]# [root@ruozedata001 conf]# [root@ruozedata001 conf]# rpm -e --nodeps httpd-tools-2.4.6-90.el7.centos.x86_64 [root@ruozedata001 conf]# rpm -qa | grep http httpd-2.4.6-90.el7.centos.x86_64 [root@ruozedata001 conf]# 6 .wget download the installation package wget http://archive.cloudera.com/cdh5/cdh/5/hadoop-2.6.0-cdh5.16.2.tar.gz 7 . Compression decompression zip ZIP -r xxx.zip. / * folder inside zip -r ruozedata.zip ruozedata / * out unzip ruozedata.zip Compressed data components of almost all large suffix tar.gz tar -xzvf hadoop-2.6.0-cdh5.16.2.tar.gz tar -czvf hadoop-2.6.0-cdh5.16.2.tar.gz hadoop-2.6.0-cdh5.16.2 / * Examples: tar -cf archive.tar foo bar # Create archive.tar from files foo and bar. tar -tvf archive.tar # List all files in archive.tar verbosely. tar -xf archive.tar # Extract all files from archive.tar.