关于
我的项目
相关阅读
热度排行
- [转] 宫崎骏用动漫教给我们的人生哲理,每一句都能说到心里! - (日期:[八月 24, 2013] 点击:[53,581])
- Google 网页爬虫报告无法连接站点解决办法 - (日期:[七月 20, 2014] 点击:[38,665])
- 架设Tiny Tiny RSS(TTRSS)阅读器,找回Google Reader! - (日期:[九月 27, 2013] 点击:[27,802])
- SkyDrive、DropBox和Google Drive三大公有云存储服务对比 - (日期:[六月 25, 2013] 点击:[25,659])
- 升级到至强E5440后,与i5 CPU笔记本性能对比 - (日期:[二月 18, 2014] 点击:[23,836])
- 公钥私钥加密解密数字证书数字签名详解 - (日期:[四月 19, 2014] 点击:[22,976])
- 本站建站技术合集 - (日期:[九月 20, 2013] 点击:[22,549])
- 使用OpenerDNS解决无法访问Google的问题 - (日期:[七月 5, 2014] 点击:[21,851])
- WordPress博客添加“返回顶部”按钮 - (日期:[七月 14, 2013] 点击:[21,268])
- Linux文件系统基础之inode和dentry - (日期:[三月 13, 2015] 点击:[20,212])
- 云存储中的HTTP鉴权算法分析 - (日期:[二月 7, 2014] 点击:[18,654])
- 存储基础知识之——磁盘阵列原理及操作实战 - (日期:[二月 9, 2014] 点击:[17,540])
- 精选37条强大的常用linux shell命令组合 - (日期:[九月 4, 2013] 点击:[17,467])
- DNS原理、架构和配置详解 - (日期:[九月 6, 2013] 点击:[16,869])
- Netty和Jetty的Java NIO 网络框架模型分析 - (日期:[七月 13, 2013] 点击:[16,348])
- CoreOS 初识之安装 - (日期:[十一月 16, 2014] 点击:[16,217])
- Windows与Linux文件系统互访的几种方法 - (日期:[八月 21, 2014] 点击:[15,738])
- Dijkstra算法求解最短路径分析 - (日期:[七月 12, 2014] 点击:[14,942])
- NAS解决方案实现多媒体文件共享播放 - (日期:[十二月 21, 2014] 点击:[13,965])
- 简介 - (日期:[九月 1, 2012] 点击:[13,787])
- 如何编程实现 2 + 2 = 5? - (日期:[六月 2, 2014] 点击:[13,278])
- 搭建了一个iNews程序 - (日期:[十月 15, 2013] 点击:[13,251])
- 2014年9月曝出的Bash ShellShock漏洞简析 - (日期:[九月 26, 2014] 点击:[13,169])
- 彻底解决WordPress博客垃圾评论的问题 - (日期:[八月 5, 2013] 点击:[13,157])
- 如何使用1M的内存排序100万个8位数 - (日期:[三月 27, 2014] 点击:[12,570])
- 全部日志列表 - (日期:[十一月 11, 2012] 点击:[12,421])
- 关于回调函数和this指针探讨 - (日期:[八月 24, 2014] 点击:[12,245])
- 开源好用的电子书管理服务Talebook(Calibre网络版)安装使用指南 - (日期:[四月 23, 2022] 点击:[11,820])
- 给定一个long型常量,其值为x,给定long型变量a,要求a & x 的取值集合 - (日期:[九月 8, 2012] 点击:[11,734])
- WordPress建站必备实用插件 - (日期:[八月 7, 2014] 点击:[11,387])
分类目录
文章归档
- 2025年一月 (1)
- 2024年十二月 (1)
- 2024年四月 (1)
- 2024年二月 (1)
- 2023年九月 (1)
- 2023年一月 (1)
- 2022年十月 (1)
- 2022年八月 (2)
- 2022年四月 (1)
- 2022年三月 (1)
- 2021年十二月 (2)
- 2021年十月 (2)
- 2021年九月 (1)
- 2021年八月 (1)
- 2021年五月 (1)
- 2021年三月 (2)
- 2021年一月 (2)
- 2020年十二月 (5)
- 2020年十一月 (2)
- 2020年十月 (2)
- 2020年九月 (1)
- 2020年八月 (5)
- 2020年七月 (2)
- 2019年九月 (1)
- 2018年八月 (1)
- 2018年七月 (1)
- 2018年六月 (1)
- 2018年五月 (1)
- 2018年三月 (1)
- 2018年二月 (1)
- 2018年一月 (2)
- 2017年十二月 (3)
- 2017年十月 (4)
- 2017年九月 (1)
- 2017年七月 (1)
- 2017年六月 (1)
- 2016年十二月 (1)
- 2016年十月 (1)
- 2016年九月 (1)
- 2016年七月 (2)
- 2016年六月 (1)
- 2016年二月 (3)
- 2015年十二月 (3)
- 2015年十一月 (2)
- 2015年十月 (1)
- 2015年八月 (2)
- 2015年七月 (4)
- 2015年六月 (1)
- 2015年三月 (2)
- 2015年二月 (1)
- 2015年一月 (4)
- 2014年十二月 (2)
- 2014年十一月 (2)
- 2014年十月 (5)
- 2014年九月 (8)
- 2014年八月 (11)
- 2014年七月 (17)
- 2014年六月 (7)
- 2014年五月 (15)
- 2014年四月 (16)
- 2014年三月 (14)
- 2014年二月 (5)
- 2013年十二月 (5)
- 2013年十一月 (3)
- 2013年十月 (13)
- 2013年九月 (13)
- 2013年八月 (13)
- 2013年七月 (9)
- 2013年六月 (8)
- 2013年五月 (1)
- 2013年三月 (3)
- 2013年一月 (1)
- 2012年十一月 (1)
- 2012年九月 (12)
- 2012年八月 (3)
- 2011年二月 (1)
- 2009年三月 (1)
- 2009年二月 (1)
- 2008年十一月 (1)
- 2008年六月 (1)
- 2008年四月 (1)
- 2008年三月 (1)
一些有用的Linux工具和命令
1、查看进程树:ps aufx,可以看到进程的派生关系、运行用户、启动时间、耗时和内存CPU等进程状态。
2、查看文本文件内容,并显示行号:nl,对比cat命令的效果如下:
root@shentar-raspberry:~# cat abc.txt
a
bcd
cdef
123
root@shentar-raspberry:~# nl abc.txt
1 a
2 bcd
3 cdef
4 123
root@shentar-raspberry:~# cat abc.txt |nl -
1 a
2 bcd
3 cdef
4 123
3、格式化xml文件输出:xmllint,按照规整的xml格式输出内容。
root@shentar-raspberry:~# cat a.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
picfilesuffix the file type with the suffix that can be scaned by the tool. It is ignorecase.
inputdir specify the folder which nedd to scan.
minfilesize specify the min size of Pic file in byte.
maxpicsperonepage specify the max pic count of one index page.
threadcount specify the size of thread pool.
hashalog specify the file HASH fingerprint Algorithm. The common algorithms are: SHA-256, MD5, SHA-1. You can find the stand algorithm names in MessageDigest Algorithms.
excludedir specify the folder which you do not like the tool scan and display the content of it.
thumbnaildir specify the folder which to store the thumbnail to.-->
<config>
<picfilesuffix>
<suffix>jpg</suffix>
<suffix>jpeg</suffix>
<suffix>png</suffix>
</picfilesuffix>
<minfilesize>51200</minfilesize>
<maxfilesize>512000000</maxfilesize>
<threadcount>20</threadcount>
<maxpicsperonepage>25</maxpicsperonepage>
<hashalog>MD5</hashalog>
<accessAuth>true</accessAuth>
<inputdir>
<dir>D:\\</dir>
<dir>C:\\</dir>
</inputdir>
<excludedir>
<dir>C:\\windows\\</dir>
<dir>C:\\Program Files\\</dir>
<dir>./</dir>
</excludedir>
</config>
root@shentar-raspberry:~# cat a.xml |xmllint --format -
<?xml version="1.0" encoding="utf-8"?>
<!--
picfilesuffix the file type with the suffix that can be scaned by the tool. It is ignorecase.
inputdir specify the folder which nedd to scan.
minfilesize specify the min size of Pic file in byte.
maxpicsperonepage specify the max pic count of one index page.
threadcount specify the size of thread pool.
hashalog specify the file HASH fingerprint Algorithm. The common algorithms are: SHA-256, MD5, SHA-1. You can find the stand algorithm names in MessageDigest Algorithms.
excludedir specify the folder which you do not like the tool scan and display the content of it.
thumbnaildir specify the folder which to store the thumbnail to.-->
<config>
<picfilesuffix>
<suffix>jpg</suffix>
<suffix>jpeg</suffix>
<suffix>png</suffix>
</picfilesuffix>
<minfilesize>51200</minfilesize>
<maxfilesize>512000000</maxfilesize>
<threadcount>20</threadcount>
<maxpicsperonepage>25</maxpicsperonepage>
<hashalog>MD5</hashalog>
<accessAuth>true</accessAuth>
<inputdir>
<dir>D:\\</dir>
<dir>C:\\</dir>
</inputdir>
<excludedir>
<dir>C:\\windows\\</dir>
<dir>C:\\Program Files\\</dir>
<dir>./</dir>
</excludedir>
</config>
root@shentar-raspberry:~#
4、相应的json格式输出,则需要使用json工具包,python –m json.tool:
root@shentar-raspberry:~# cat /root/.mozilla/firefox/7dfkbioj.default/sessionCheckpoints.json
{"profile-after-change":true,"final-ui-startup":true,"sessionstore-windows-restored":true,"quit-application-granted":true,"quit-application":true,"sessionstore-final-state-write-complete":true,"profile-change-net-teardown":true,"profile-change-teardown":true,"profile-before-change":true}
root@shentar-raspberry:~# cat /root/.mozilla/firefox/7dfkbioj.default/sessionCheckpoints.json|python -m json.tool
{
"final-ui-startup": true,
"profile-after-change": true,
"profile-before-change": true,
"profile-change-net-teardown": true,
"profile-change-teardown": true,
"quit-application": true,
"quit-application-granted": true,
"sessionstore-final-state-write-complete": true,
"sessionstore-windows-restored": true
}
root@shentar-raspberry:~#
5、查看目录大小,递归查询指定目录的大小,指定显示深度:du -max-depth=1 –h
root@shentar-raspberry:~# du --max-depth=1 -h
22M ./.sync
156K ./.local
4.0K ./文档
392K ./.rpmdb
4.0K ./.dist
122M ./jetty-distribution-8.1.17.v20150415
4.0K ./视频
12M ./.mozilla
6.7M ./.cache
8.0K ./.ssh
4.0K ./桌面
160K ./.config
8.0K ./.vim
4.0K ./下载
20K ./.dbus
4.0K ./模板
27M ./psiphon
20K ./.gnupg
12K ./.oracle_jre_usage
132M ./s3curl-4win
101M ./.m2
4.0K ./音乐
4.0K ./公共的
4.0K ./.themes
4.0K ./.icons
4.0K ./.gconf
4.0K ./图片
280K ./.kodi
56K ./.vnc
4.0K ./.nano
515M .
root@shentar-raspberry:~#
6、使用ping快速检查丢包率:ping -f -c 1000 example.com,-f为倾倒式的发送icmp包,-c指定次数。Windows下的ping命令无此参数选项,可以下载cygwin下的ping命令实现。
root@shentar-raspberry:~# ping -f -c 1000 example.com
PING example.com (93.184.216.34) 56(84) bytes of data.
................
--- example.com ping statistics ---
1000 packets transmitted, 984 received, 1% packet loss, time 12018ms
rtt min/avg/max/mdev = 283.280/293.537/303.682/3.957 ms, pipe 27, ipg/ewma 12.030/296.774 ms
7、watch命令,循环运行指定命令,并将执行结果刷新到屏幕上:watch -t -c -n 1 "date",每间隔1秒执行一次date命令。