清理磁盘
#查看磁盘
fdisk -l #查看当前有哪些磁盘,多大。
df -h #查看已经挂载了哪些磁盘,空间占比
df -sh * #查看当前目录下各个文件大小。
看里面的挂载配置 和 UUID:cat /etc/fstab
查看操作系统:uname -a
查看磁盘状态:fdisk -l
挂载磁盘:mount /dev/vdb /data
查找大文件:find / -size +512000k -exec ls -lh {} \;
# 查看某个时间段的日志:
grep '2021-10-20 15:4[0-1]' logback.log
# 根据进程名称杀掉进程
kill -9 $(pidof chainmaker)
#查看当前进程所在路径。
!ps
Pwdx 进程号
ll /proc/2164(进程号)/
# 批量更改文件后缀名
rename .c .h *.c
# 创建软连接
ln -s 源文件 目标文件
# 压缩
zip -r -q -o pack.zipf
# 解压
unzip
# tar压缩文件的时候排除特定文件和文件夹:
tar --exclude='./folder' --exclude='./upload/folder2' -zcvf /backup/filename.tgz .
tar --exclude='./threadnum10000x2loop600sleep1000_3/log' --exclude='./threadnum5000x2loop600sleep1000_3/log' -zcvf ../Cert_batch_tbft__ecc_rust.zip .
#反复执行一个shell
#执行一个shell ./get_tx_status.sh 他的参数是:1 d124
# 即平常使用的话是这样:./get_tx_status.sh 1 d124
反复执行100次
seq 100 | xargs -n 1 ./get_tx_status.sh 1 d124
# md5
md5sum abc.crt
# openssl 证书解析
openssl x509 -in consensus1.sign.crt -noout -text
解析crl
openssl
crl -inform PEM -in crl.pem -text -noout
解析证书
openssl x509 -in. xx.crt -no out
vim命令
#替换字段
:%s/替换前/替换后/g
#多行注释
:<<!
#被注释的内容
!
# Vim 中清空所有内容:
ggdG
修改最大文件限制数:
echo ulimit -n 65535 >>/etc/profile
# 统计匹配数
ps -ef |grep "chainmaker" |wc -l
# 查看端口号是否被占用:
ss -naltp |grep 9090
#监控系统资源
dstat -tcmd --output iolog-10.log
# 启动普罗米修斯
ps -ef |grep "prometheus"
kill -9 31377
cd /usr/local/prometheus-2.12.0.linux-amd64/
nohup ./prometheus &
nohup ./prometheus --config.file=prometheus.yml &
/usr/local/prometheus/prometheus --config.file="/usr/local/prometheus/prometheus.yml" &
rpm -ivh --relocate /=/opt/temp xxx.rpm
启动grafana
systemctl stop grafana-server
systemctl restart grafana-server
1、firewalld的基本使用 防火墙
启动: systemctl start firewalld
关闭: systemctl stop firewalld
firewall-cmd --reload
查看状态: systemctl status firewalld
开机禁用 :systemctl disable firewalld
开机启用 : systemctl enable firewalld
#文件名包含指定字符串
find . -name ‘string'
取反:
find . ! -name ‘string’
find . -name "chainmaker-*1*-2022*.tar.gz" -prune
-prune表示不查找子目录 。
文件内容包含指定字符串
grep -rn "case crypto.HASH_TYPE_SM3:"
find . | xargs grep string#查找当前目录下文件内容包含字符串string的文件
查看哪些进程正在使用 queries.active 文件:
sudo lsof -n | grep queries.active
本文介绍了一系列Linux系统下的磁盘管理和文件操作命令,包括查看磁盘信息、挂载磁盘、查找大文件等实用技巧,并涵盖了常用的系统监控与管理命令。
3859

被折叠的 条评论
为什么被折叠?



