用过的shell命令——持续更新
2012-12-02 19:08
246 查看
1,显示文件的各种属性
stat --help
用例:stat -c "%s" abc.txt
注释:显示abc.txt的大小
2,文件编码类型查看
file --help
用例:file -i abc.txt
注释:显示abc.txt的文件编码类型(貌似不是很全)
3,文件编码类型转换
iconv --help
用例:iconv abc.txt -f GBK -t UTF-8 > cba.txt
注释:将abc.txt从GBK编码转换成为UTF-8编码(有的时候貌似会出问题,用$?检查一下)
4,控制光标位置
tput --help
用例:tput cup 34 23
注释:将光标移动至34行 23列
扩展阅读:http://www.ibm.com/developerworks/cn/aix/library/au-learningtput/
5,脚本后台运行方法
nohup --help
用例:nohup bash test.sh a b >> /dev/null
注释:将test.sh脚本的输出重定向至null(不输出) a ,b 是脚本参数
bash -c help
用例:bash -c "(bash test.sh)&"
注释:将脚本test.sh后台运行
6,如何截取掉一个字符串的后n个字符
head --help
用例:echo $num | head -c -4
注释:head截取掉了后面3个字符
${value:o0-n}
用例:echo ${a:o0-4}
注释:参见http://www.cnblogs.com/pmars/archive/2013/02/17/2914444.html
7,查看路由连接信息(本地ip-路由-路由-ip2)
traceroute --help
用例:traceroute 61.135.169.105
注释:会列出网络上所有经过的路由节点IP
8,如何删除文件中的一行或者几行
sed --help
用例:sed -i '40d;41d' file
注释:用sed遍历文件,将40和41行删除,分隔符为分号“;”
9,查看已登录用户
w --help
用例:w
注释:查看当前已登录用户信息
10,查看登录历史信息
last --help
用例:last
注释:查看linux的登录历史,记录所有登录过的信息
stat --help
用例:stat -c "%s" abc.txt
注释:显示abc.txt的大小
2,文件编码类型查看
file --help
用例:file -i abc.txt
注释:显示abc.txt的文件编码类型(貌似不是很全)
3,文件编码类型转换
iconv --help
用例:iconv abc.txt -f GBK -t UTF-8 > cba.txt
注释:将abc.txt从GBK编码转换成为UTF-8编码(有的时候貌似会出问题,用$?检查一下)
4,控制光标位置
tput --help
用例:tput cup 34 23
注释:将光标移动至34行 23列
扩展阅读:http://www.ibm.com/developerworks/cn/aix/library/au-learningtput/
5,脚本后台运行方法
nohup --help
用例:nohup bash test.sh a b >> /dev/null
注释:将test.sh脚本的输出重定向至null(不输出) a ,b 是脚本参数
bash -c help
用例:bash -c "(bash test.sh)&"
注释:将脚本test.sh后台运行
6,如何截取掉一个字符串的后n个字符
head --help
用例:echo $num | head -c -4
注释:head截取掉了后面3个字符
${value:o0-n}
用例:echo ${a:o0-4}
注释:参见http://www.cnblogs.com/pmars/archive/2013/02/17/2914444.html
7,查看路由连接信息(本地ip-路由-路由-ip2)
traceroute --help
用例:traceroute 61.135.169.105
注释:会列出网络上所有经过的路由节点IP
8,如何删除文件中的一行或者几行
sed --help
用例:sed -i '40d;41d' file
注释:用sed遍历文件,将40和41行删除,分隔符为分号“;”
9,查看已登录用户
w --help
用例:w
注释:查看当前已登录用户信息
10,查看登录历史信息
last --help
用例:last
注释:查看linux的登录历史,记录所有登录过的信息
相关文章推荐
- 用过的shell命令——持续更新
- shell 命令总结 --持续更新
- 常用shell命令,持续更新中
- 转载---Shell常用命令及特殊符号整理---->持续更新中...
- 常用shell命令(持续更新)
- SHELL利器:比较常用的SHELL命令(持续更新)
- shell实用命令【持续更新】
- 常用的shell命令(持续更新)
- shell常用命令实例分析-持续更新中
- shell特殊用途小命令集合——持续更新。。。求跟帖,大家一起分享
- *nix 命令记(持续更新)
- ubuntu系统git,adb等命令总结----持续更新!
- Mysql命令(持续更新)
- Git 常用命令(查看历史,……) --持续更新
- Linux开发常用命令总结(持续更新)
- linux(Ubuntu)常用命令整理 -- 基础篇 -- 持续更新
- linux常用命令使用技巧(持续更新)
- 常用却易忘linux命令整理(持续更新)
- shell 命令(持续增加)
- Linux-常用命令记录表 - 持续更新中