This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
列出使用 /mountpoint 挂载的挂载上的文件的进程。 对于查找哪些进程正在使用已安装的 USB 记忆棒或 CD/DVD 特别有用。
lists the processes using files on the mount mounted at /mountpoint. Particularly useful for finding which process(es) are using a mounted USB stick or CD/DVD.
将递归显示目录中打开的所有文件。 +d 仅代表顶层。
当您的 IO 等待百分比很高(与特定 FS 上的使用相关)并且想要查看哪些进程正在消耗您的 io 时,这非常有用。
Will display recursively all the files opened in a directory. +d for just the top-level.
This is useful when you have high wait% for IO, correlated to use on a particular FS and want to see which processes are chewing up your io.
查看正在运行的应用程序或守护程序打开了哪些文件:
其中 pid 是应用程序或守护程序的进程 ID。
See what files a running application or daemon has open:
Where pid is the process ID of the application or daemon.
会告诉您哪些程序正在侦听特定端口。
will tell you what programs are listening on a specific port.
lsof -i 将提供开放网络套接字的列表。
-n
选项将阻止 DNS 查找,这在网络连接速度慢或不可靠时非常有用。lsof -i
will provide a list of open network sockets. The-n
option will prevent DNS lookups, which is useful when your network connection is slow or unreliable.要显示与给定
端口
相关的所有网络:要显示与特定主机的连接,请使用
@host
使用@host显示基于主机和端口的连接:端口
lsof [电子邮件受保护]:22
grep
ping forLISTEN
显示您的系统正在等待连接的端口:使用
-u
显示给定用户打开的内容:使用-u 查看命令正在使用哪些文件和网络连接code>-c
-p
开关可让您查看给定进程 ID 打开的内容,这有助于了解有关未知进程的更多信息:-t
选项仅返回一个PID
结合使用
-t
和-c
选项,您可以HUP
进程您还可以使用
-t
与-u
一起杀死用户打开的所有内容To show all networking related to a given
port
:To show connections to a specific host, use
@host
Show connections based on the host and the port using
@host:port
lsof [email protected]:22
grep
ping forLISTEN
shows what ports your system is waiting for connections on:Show what a given user has open using
-u
:See what files and network connections a command is using with
-c
The
-p
switch lets you see what a given process ID has open, which is good for learning more about unknown processes:The
-t
option returns just aPID
Using the
-t
and-c
options together you canHUP
processesYou can also use the
-t
with-u
to kill everything a user has open