Original works can be reprinted. During reprinting, you must mark the original source, author information, and this statement in hyperlink form. Otherwise, legal liability will be held. Http://navyaijm.blog.51cto.com/4647068/1242890
1. vmtools is automatically installed on Windows virtual machines.
Connect to esxi through a client: client-install vmtools
Go to the system and run cmd.
/k
e:&&setup
/s/v/qn
(E: drive letter)
2. End user sessions
View who is logging on to the system: W
In Linux, run pkill-9-t pts to kill other commands that are logging on to the user through SSH.
/3
3. view the TCP connection status and number
netstat
-n|
awk
‘/^tcp/ {++S[$NF]}END {for(a in S) print a,S[a]}‘
/usr/sbin/ss
-n|
awk
‘{++S[$1]} END {for(a in S) print S[a],"\t",a}‘
4. Analyze access. log to obtain the top 10 IP addresses
awk
‘{print $1}‘
access.log |
sort
|
uniq
-c|
sort
-nr|
head
-10
5. Real-time traffic monitoring
yum -y
install
nload
- For detailed command usage, see: https://linux.cn/article-2871-1.html
6. Prevent rsyslog loss caused by too much log output
echo
"$SystemLogRateLimitInterval 60"
>>
/etc/rsyslog
.conf
echo
"$SystemLogRateLimitBurst 3000"
>>
/etc/rsyslog
.conf
7. Delete massive directory commands:
find
./ -
type
f |
xargs
-I {}
rm
-F {} (enter the directory to be deleted)
rsync
--delete-before -a -H -
v
--progress --stats
/tmp/
./(Replace the directory to be deleted with an empty directory)
8. Route Tracking command:
9. Ssh disconnection solution:
ClientAliveInterval 120
ClientAliveCountMax 3
10. Zero-time download is provided: (listen to 8888 on 10.10.10.10 )??
nc -l 8888 <
/root/drbd-8
.4.1.
tar
.gz
Download the client:
wget http:
//10
.10.10.10:8888
/drbd-8
.4.1.
tar
.gz
11. lftp download instance:
lftp -c
"pget -n 10 -O ./ ftp://test:[email protected]:21/kisops_centos6.3_vm_4G.iso"
12. lftp upload instance:
lftp -c put
/data/apps/kisops_centos6
.3_vm_4G.iso -o
ftp
:
//test
:[email protected]:2
/kisops_centos6
.3_vm_4G.iso
13. SMB client mounting command:
mount
-t cifs -o async,soft,rw,username=
ftp
,password=123456
//172
.28.29.249
/Share
/sandata/data
14. Run a script on a remote machine. The biggest benefit of this command is that you do not need to copy the script to a remote machine:
ssh
[email protected]
bash
<
/path/to/local/script
.sh
15. Test the read/write speed of the hard disk:
Write:
time
dd
if
=
/dev/zero
of=
/usr/mfstest/test2/zhhtest500M
bs=1024k count=500
Read:
time
dd
if
=
/usr/mfstest/test2/zhhtest500M
of=
/dev/null
16. view the system Sn:
dmidecode |
grep
"Serial Number“
17. Fixed an error caused by the format of the script copied to Linux:
yum
install
dos2unix
Dos2unix cactirelease. Sh (problematic script format)
18. centos6 series emails with attachments:
- Echo "this is a test mail" | mail-s "test"-A/etc/passwd [email protected] (Mail title: Test, mail body: this is a test mail, attachment: passwd file under/etc/
19. Ping prohibited in Linux:
echo
1 >
/proc/sys/net/ipv4/icmp_echo_ignore_all
2018.write 10.10.1-254to iplist.txt, one line in two ways:
printf
‘%s\n‘
10.10.10.{1..254} >iplist.txt
echo
10.10.10.{1..249} |
tr
‘ ‘
‘\n‘
>> iplist.txt
21. Check whether the machine has several CPUs:
cat
/proc/cpuinfo
|
grep
physical |
uniq
-c
- Lscpu
22. Add the default route:
windows:
route -p add 0.0.0.0 mask 0.0.0.0 162.28.29.32
linux:
route add -net 0.0.0.0 netmask 0.0.0.0 gw 162.28.29.32
23. view the sn of the vswitch model:
24. Delete 0-byte files:
find
-
type
f -size 0 -
exec
rm
-rf {} \;
25. Obtain the IP Address:
ifconfig
eth0 |
grep
"inet addr:"
|
awk
‘{print $2}‘
|
cut
-c 6-
Or
ifconfig
|
grep
‘inet addr:‘
|
grep
-
v
‘127.0.0.1‘
|
cut
-d: -f2 |
awk
‘{ print $1}‘
26. Kill the process related to port 80:
lsof
-i :80|
grep
-
v
"ID"
|
awk
‘{print "kill -9",$2}‘
|sh
27. Clear dead processes:
ps
-eal |
awk
‘{ if ($2 == "Z") {print $4}}‘
|
kill
-9
28. View File filtering # Start With and blank lines
cat
lvs.cfg |
grep
-
v
"#"
|
awk
‘NF‘
Summary of daily O & M work knowledge