类 Unix 系统下的一些常用命令和用法。
查看文件被谁占用。
fuser -u .linux.md.swp
查看当前用户、组 id。
查看打开的文件列表。
An open file may be a regular file, a directory, a block special file, a character special file, an executing text reference, a library, a stream or a network file (Internet socket, NFS file or UNIX domain socket.) A specific file or all the files in a file system may be selected by path.
lsof -i
lsof -i tcp:5037
lsof .linux.md.swp
lsof -u mazhuang
-u
后面可以跟 uid 或 login name。
lsof -c Vim
注意程序名区分大小写。