lsof
来源:互联网 发布:mysql事务隔离级别 编辑:程序博客网 时间:2024/06/10 11:42
参考
http://www.thegeekstuff.com/2012/08/lsof-command-examples/
list open file
使用lsof,可以查看到任何打开的文件的信息。
linux中一切可以看做文件,普通文件,管道,网络文件(例如socket),设备等都是文件。
1.lsof
# lsof
列出所有活动进程打开的文件。
解释第一行的几个值:
FD:file descriptor 文件描述符
- cwd – Current Working Directory
- txt – Text file
- mem – Memory mapped file
- mmap – Memory mapped device
- NUMBER – Represent the actual file descriptor. The character after the number i.e ‘1u’, represents the mode in which the file is opened. r for read, w for write, u for read and write.
TYPE, Some of the values of TYPEs are
- REG – Regular File
- DIR – Directory
- FIFO – First In First Out(先进先出是队列)
- CHR – Character special file
DEVICE:指定磁盘名称
NODE: 索引节点,文件在磁盘上的标识
2.lsof 文件名
列出打开了指定文件的进程
# lsof /var/log/syslog
3.lsof -p 进程pid
列出被指定的进程所打开的文件
# lsof -p pid
4. lsof -u username
显示指定用户下打开的文件
5. lsof -i
这个命令和网络相关,显示所有的网络连接
按条件过滤的
- lsof -i tcp #查看协议tcp的连接
- lsof -i udp #udp协议的连接
- lsof -i4 # ipv4
- lsof -i6 # ipv6
- lsof -i -n # 不把ip转化为hostname
- lsof -i :22 # 查看22号端口被哪个进程占用,监听
0 0
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- lsof
- 同步传输 异步传输
- localStorage 历史存储小工具
- C# winform 使用进度条(两种形式)
- Android7.0源码下载,编译,运行
- 【Linux 内核网络协议栈源码剖析】系统网络协议栈初始化及数据传输通道建立过程
- lsof
- 适配器模式
- 工具下载目录
- mime-types-data requires Ruby version >= 2.0
- 单项数据绑定、双向数据绑定及其原理(脏检查)
- php验证码制作
- 解决Error:Android Dex: com.android.dex.DexIndexOverflowException: Cannot merge new index 65918 into a
- js排序算法总结—冒泡,快速,选择,插入,希尔,归并
- error C3861: 'assert': identifier not found