Linux很有效的命令
1. man
Linux提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上网查找,只要man一下即可。同时也可以使用man man 查看man的使用方法。
原文链接:http://www.linuxidc.com/Linux/2017-03/142407.htm
2. dpkg
查看某个安装包的具体安装位置,可以首先使用
1 | dpkg -l | grep package_name |
例如
1 | dpkg -l | grep tensorrt |
1 | nvidia@jetson:/usr/src$ dpkg -l | grep tensorrt |
然后使用
1 | dpkg -L tensorrt |
结果:
1 | nvidia@jetson:/usr/src$ dpkg -L tensorrt |
查看某个文件夹是哪个软件安装的
1 | sudo dpkg -S path |
举个例子
1 | sudo dpkg -S /usr/src/tensorrt |
结果
1 | nvidia@jetson:/usr/src$ sudo dpkg -S /usr/src/tensorrt |
debian及其衍生版
先安装apt-file
1 | sudo apt-get install -y apt-file |
查询命令:(已查询ifconfig
为例)
1 | root@debian ~ # apt-file search bin/ifconfig |
apt-file search -x(–regexp) 后可接正则表达式,如:
1 | apt-file search -x ‘bin/rzKaTeX parse error: Expected 'EOF', got '#' at position 36: … root@deepin ~ #̲ apt-file searc…’ |
3. dos2unix
dos2unix是一个基于命令行的文件格式转换工具,用于将windows下的文件转换为unix下的文件格式,有时候文件在windows上打开过后,再在linux/macos系统上运行时,就会出现异常情况,可以使用这个工具解决。
根据文件后缀类型进行修改
1 | dos2unix *.sh |
对文件夹进行递归地修改,亲测有效
1 | find . -type f -print0 | xargs -0 dos2unix |
根据文件名修改
1 | dos2unix a.txt |