yum command
##yum 安装软件
sudo yum install grafana-7.3.6-1.x86_64.rpm
##yum 查询已安装软件列表
yum list
yum list | grep influxdb.x86_64
##yum 卸载软件
yum remove influxdb.x86_64
Assign permissions to files or directories
chmod 777 文件或目录
777(可读可写可执行)
ssh login
ssh 客户端用户名@服务器ip地址
ssh root@127.0.0.1
ll command
ll
-- 按修改时间排序
ls -lrt
ps command
ps -ef | grep java
ps aux | grep java
kill command
ps -ef | grep vim
root 3268 2884 0 16:21 pts/1 00:00:00 vim install.log
root 3370 2822 0 16:21 pts/0 00:00:00 grep vim
kill -9 3268
kill -9 3268
-bash: kill: (3268) - 没有那个进程
grep command
-- 显示上下5行
tail -f | grep -C 5 "删除成功数" nabs-send.2020-08-03.13.7.log
grep -i "删除成功数" nabs-send.2020-08-03.13.4.log | less
查看grep版本号的方法是
grep -V
find command
find / -name httpd.conf #在根目录下查找文件httpd.conf,表示在整个硬盘查找
find /etc -name httpd.conf #在/etc目录下文件httpd.conf
find /etc -name '*srm*' #使用通配符*(0或者任意多个)。表示在/etc目录下查找文件名中含有字符串‘srm’的文件
find . -name 'srm*' #表示当前目录下查找文件名开头是字符串‘srm’的文件
Check which process the specified port is occupied by
lsof -i:端口号
netstat -apn | grep 端口号
top command
top //每隔5秒显式所有进程的资源占用情况
top -d 2 //每隔2秒显式所有进程的资源占用情况
top -c //每隔5秒显式进程的资源占用情况,并显示进程的命令行参数(默认只有进程名)
top -p 12345 -p 6789//每隔5秒显示pid是12345和pid是6789的两个进程的资源占用情况
top -d 2 -c -p 123456 //每隔2秒显示pid是12345的进程的资源使用情况,并显式该进程启动的命令行参数
df and fdisk commands
The df command is used to display the available disk space on the disk partition. The
fdisk command is used to observe the physical usage of the hard disk, and it can also partition the hard disk.
df -h
fdisk -l
nohup command
nohup java -jar customerapp-service.jar >/dev/null 2>&1 &
nohup java -jar customerapp-service.jar --spring.profiles.active=test >/dev/null 2>&1 &
nohup java -jar customerapp-service.jar >/dev/null &
vi instruction
:%s/vivian/sky/(等同于 :g/vivian/s//sky/) 替换每一行的第一个 vivian 为 sky
:%s/vivian/sky/g(等同于 :g/vivian/s//sky/g) 替换每一行中所有 vivian 为 sky
View CUP related parameters
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数
# 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l
# 查看CPU信息(型号)
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
查看内 存信息
# cat /proc/meminfo
telnet ip port
1. HTTP server, the default port number is 80/tcp (the Trojan Horse Executor opens this port)
2. HTTPS (securely transferring web pages) server, the default port number is 443/tcp 443/udp
telnet ip port
telnet ip 80