linux使用命令

  • man -t ls | ps2pdf – filename.pdf
  • 为命令绑定快捷键
    • bind -x ‘”\C-l”:ls -l’
  • 读取设备信息:file -s /dev/sd*
  • 比较两文件:cmp file1 file2
  • 从光碟创建iso文件,dd -if=/dev/cdrom -of=file.iso
  • dd -if=/dev/sda | gzip -c | ssh user@ip ‘dd of=/mnt/backups/sda.dd’
  • 测试网速:dd -if=/dev/zero bs=4096 count=1048576 | ssh user@ip ‘cat > /dev/null’
  • 将用户etl的所有进程的优先级别设置位5
    • renice +5 -u etl
  • 根据程序名字获取pid:gprep $pname
  • 通过程序名字杀死进程:killall
  • /bin/time
    header: “command”,”exit-status”,”real(s)”,”user(s)”,”sys(s)”
    /usr/bin/time -f ‘”%C”,”x”,”%e”,”%U”,”%S”‘
    echo ‘”command”,”real(s)”,”exit-status”,”user(s)”,”sys(s)”,”cpu(%)”,”cpu-sys(s)”,”cpu-usr(s)”,”sock-rev”,”sort-send”‘
    /usr/bin/time -f ‘”%C”,”%x”,”%e”,”%U”,”%S”,”%P”,”%S”,”%U”,”%r”,”%s”‘
  • 创建镜像:dd if=/dev/zero of=/mnt/root.disk bs=1M -count=100
  • 查看linux版本:lsb_release -a
  • 挂载远程盘:sudo sshfs -o idmap=user $USER@$HOST:$RemoteDir $MountPoint
  • 查看硬件信息:dmidecode

发表评论