Skip to content

常用命令

查询软件安装位置

shell
    ps -ef | grep nginx

查看当前服务器端口状态

shell
    netstat -ntpl

显示文件结尾的内容

n 代表行数

shell
    tail -n 10 文件名

logrotate nginx 日志分割

shell
/data/wwwlogs/*.log {
  daily
  rotate 5
  missingok
  dateext
  compress
  notifempty
  sharedscripts
  postrotate
    [ -e /usr/local/nginx/logs/nginx.pid ] && kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
  endscript
}

vim

shell
  显示行号
  esc -> : set nu
  复制多行
  :18,20 co 21
  移动多行
  :18,20 m 21
  删除一行
  dd