You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
-
显示前N个
ll -lht|head -n 20
-
压缩命令过长
find ./ -name '*' -print |zip files -@
-
合并文件
cat *.txt > target.txt
-
配置定时任务
root 用户 vim /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 20 04 * * * root reboot # 加载配置 crontab /etc/crontab # 重启crontab服务 systemctl restart crond.service
-
查看上一次启动
who -b
-
切分文件
# 按大小切分 split -b 100m xxxx # 按行切分 split -l xxxx # 设置拆分后文件名,指定数字后缀 split -b 100m -d xxxx xxxx_part_
-
显示文件大小
du -sh xxxx
-
grep
# 高亮查找结果 grep --color "test" catalina.out # 显示在第几行 grep -n test catalina.out
-
zip
# 压缩 zip -r ./xxx.zip ./* # 解压 unzip xxx.zip # 查看压缩文件内容 unzip -v xxx.zip # 从zip中删除xxx.txt文件 zip xxx.zip -d xxx.txt
-
软链接
ln -s 源文件名 软链接文件名
-
查看端口占用情况
# 查看所有 lsof -i # 查看指定端口 lsof -i:8080 # 查看文件进程 lsof xxx.txt