Linux中的fuser实用程序是非常聪明的Unix实用程序。顾名思义,它提供了有关文件用户或当前正在使用文件或目录的过程的知识。本文介绍有关– Linux中“ fuser”命令的常用示例。
要获取有关热熔器的更多信息,请使用以下命令–
$ fuser
样本输出应如下所示–
Usage: fuser [-fMuvw] [-a|-s] [-4|-6] [-c|-m|-n SPACE] [-k [-i] [-SIGNAL]] NAME... fuser -l fuser -V Show 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]]]
fuser
要获取使用当前目录的进程ID,请使用以下命令–
$ fuser .
样本输出应如下所示–
/home/tutorialspoint: 2782c 2882c 2909c 2922c 2950c 2954c 2956c 2974c 2984c 2986c 2993c 2994c 3003c 3004c 3011c 3018c 3034c 3053c 3068c 3069c 3072c 3073c 3076c 3079c 3080c 3081c 3107c 3146c 3151c 3156c 3157c 3164c 3321c 3361c 3368c 3369c 3440c 3502c 3786c 3859c 3866c
要终止所有上述进程,请使用以下命令–
$ fuser -k .
上面的命令关闭所有进程并关闭Linux计算机。
要获取具有Linux Machine进程ID的用户名,请使用以下命令-
$ fuser -u .
样本输出应如下所示–
/home/tutorialspoint: 2782c(tutorialspoint) 2882c(tutorialspoint) 2909c(tutorialspoint) 2922c(tutorialspoint) 2950c(tutorialspoint) 2954c(tutorialspoint) 2956c(tutorialspoint) 2974c(tutorialspoint) 2984c(tutorialspoint) 2986c(tutorialspoint) 2993c(tutorialspoint) 2994c(tutorialspoint) 3003c(tutorialspoint) 3004c(tutorialspoint) 3011c(tutorialspoint) 3018c(tutorialspoint) 3034c(tutorialspoint) 3053c(tutorialspoint) 3068c(tutorialspoint) 3069c(tutorialspoint) 3072c(tutorialspoint) 3073c(tutorialspoint) 3076c(tutorialspoint) 3079c(tutorialspoint) 3080c(tutorialspoint) 3081c(tutorialspoint) 3107c(tutorialspoint) 3146c(tutorialspoint) 3151c(tutorialspoint) 3156c(tutorialspoint)
要获取当前进程的已知信号列表,请使用以下命令–
$ fuser -l .
样本输出应如下所示–
HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS UNUSED
要查找proc文件系统的位置,请使用以下命令-
$ fuser /proc
样本输出应如下所示–
/proc: 3373 3379
要获取版本信息,请使用以下命令–
$ fuser -V
样本输出应如下所示–
fuser (PSmisc) 22.21 Copyright (C) 1993-2010 Werner Almesberger and Craig Small PSmisc comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING.
要获取当前进程的当前运行目录,请使用以下命令–
$ fuser -c ./
样本输出应如下所示–
/home/tutorialspoint: 1rce 2rce 3rce 5rce 7rce 8rce 9rce 10rce 11rce 12rce 13rce 15rce 16rce 17rce 18rce 19rce 20rce 21rce 22rce 23rce 24rce 25rce 26rce 27rce 28rce 29rce 34rce 35rce 36rce 37rce 53rce 54rce 55rce
要获取当前用户的processID,请使用以下命令–
/home$ fuser -v tutorialspoint
上面的命令教程指向的是当前用户名。样本输出应如下所示–
USER PID ACCESS COMMAND /home/tutorialspoint: tutorialspoint 2782 ..c.. upstart tutorialspoint 2882 ..c.. window-stack-br tutorialspoint 2909 ..c.. ibus-daemon tutorialspoint 2922 ..c.. upstart-file-br tutorialspoint 2950 ..c.. ibus-dconf tutorialspoint 2954 ..c.. ibus-ui-gtk3 tutorialspoint 2956 ..c.. ibus-x11 tutorialspoint 2974 ..c.. bamfdaemon tutorialspoint 2984 ..c.. hud-service tutorialspoint 2986 ..c.. unity-settings- tutorialspoint 2993 ..c.. at-spi-bus-laun tutorialspoint 2994 ..c.. gnome-session-b tutorialspoint 3003 ..c.. dbus-daemon tutorialspoint 3004 ..c.. unity-panel-ser ....................................................................................
在以上文章中,我们了解到– Linux中“ fuser”命令的常用示例。在我们的下一篇文章中,我们将提出更多基于Linux的技巧。继续阅读!