大佬教程收集整理的这篇文章主要介绍了linux 文件与进程,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
1. linux查看一个文件正被那些程序使用
fuser -hUsage: fuser [-fMuvw] [-a|-s] [-4|-6] [-c|-m|-n SPACE] [-k [-i] [-SIGNAL]] NAME... fuser -l fuser -VShow which processes use the named files,sockets,or filesystems.
-a,--all display unused files too -i,--interactive ask before killing (ignored without -k) -k,--kill kill processes accessing the named file -l,--list-signals list available signal names -m,--mount show all processes using the named filesystems or block device -M,--ismountpoint fulfill request only if NAME is a mount point -n,--namespace SPACE search in this name space (file,udp,or tcp) -s,--silent silent operation -SIGNAL send this signal instead of SIGKILL -u,--user display user IDs -v,--verbose verbose output -w,--writeonly kill only processes with write access -V,--version display version information -4,--ipv4 search IPv4 sockets only -6,--ipv6 search IPv6 sockets only - reset options
udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]
2. 查看该进程打开的文件
lsof -hlsof 4.86 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-f[gG]] [+|-e s] [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s][+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]Defaults in parentheses; comma-separated set (s) items; dash-separated ranges. -?|-h list Help -a AND SELEctions (OR) -b avoid kernel blocks -c c cmd c ^c /c/[bix] +c w COMMAND width (9) +d s dir s files -d s SELEct by FD set +D D dir D tree *SLOW?* +|-e s exempt s *RISKY* -i SELEct IPv[46] files -K list tasKs -l list Uid numbers -n no host names -N SELEct NFS files -o list file offset -O no overhead *RISKY* -P no port names -R list paRent PID -s list file size -t terse lisTing -T disable TCP/TPI info -U SELEct Unix socket -v list version info -V verbose search +|-w Warnings (+) -X skip TCP&UDP* files -- end option scan +f|-f +filesystem or -file names +|-f[gG] flaGs -F [f] SELEct fields; -F? for Help +|-L [l] list (+) suppress (-) link counts < l="" (0="all;" default="0)" +m="" [m]="" use|create="" mount="" supplement="" +|-m="" portmap="" registration="" (-)="" -o="" o="" o="" 0t="" offset="" digits="" (8)="" -p="" s="" exclude(^)|select="" pids="" -s="" [t]="" t="" second="" stat="" timeout="" (15)="" -t="" qs="" tcp/tpi="" q,st="" (s)="" info="" -g="" [s]="" exclude(^)|select="" and="" print="" process="" group="" ids="" -i="" i="" select="" by="" ipv[46]="" address:="" [46][proto][@host|addr][:svc_list|port_list]="" +|-r="">
以上是大佬教程为你收集整理的linux 文件与进程全部内容,希望文章能够帮你解决linux 文件与进程所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。