linux
  1. history # 偷窥别人常用命令神器
  2. time
    date                                    # 查看时间
    date -s "2018-12-24 10:09:12"           # 修改时间
    hwclock --hctosys                       # 恢复硬件时间
    hwclock -w                              # 同步系统时间到硬件时间
    ntpdate time.windows.com                # 系统时间同步到网络时间
    mv /etc/localtime /etc/localtime.bak    # 修改时区
    ln -s /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime
  3. 开机执行
    vim ~/.bash_profile
    vim ~/.bashrc
  4. 防火墙 root
    iptable -L                   # 查看防火墙状态
    iptable -F                   # 关闭防火墙
  5. 远程拷贝
    scp root@192.168.100.25:/data/release/file_name ./
  6. 查看滚动日志
    tail * -f | grep -E 'Traceback|traceback' -a50
  7. 检索文件关键字
    grep '检索内容' ./ -r
  8. 查文件路径
    updatedb
    locate 文件名
  9. 查看进程&进程配置文件
    ps -ef | grep desc
  10. lsof
    lsof -i :8080  //查看端口被谁占用  sudo ss -lntp | grep 8080
    lsof -p pid    //查看进程打开了哪些文件/连接
    lsof 文件名    //查看文件被哪个进程占用
文档更新时间: 2026-06-26 00:06   作者:morninglu