免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 12965 | 回复: 3
打印 上一主题 下一主题

[新手入门] 请教fuser的作用及具体用法! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-04-28 13:34 |只看该作者 |倒序浏览
教fuser的作用及具体用法!

论坛徽章:
0
2 [报告]
发表于 2003-04-28 13:37 |只看该作者

请教fuser的作用及具体用法!

man fuser

论坛徽章:
0
3 [报告]
发表于 2003-04-28 13:38 |只看该作者

请教fuser的作用及具体用法!

fuser Command

Purpose

Identifies processes using a file or file structure.

Syntax

fuser [ -c | -d | -f ] [ -k ] [ -u ] [ -x ] [ -V ]File ...

Description

The fuser command lists the process numbers of local processes that use the
local or remote files specified by the File parameter. For block special
devices, the command lists the processes that use any file on that device.


c Uses the file as the current directory.

e Uses the file as a program's executable object.

r Uses the file as the root directory.

s Uses the file as a shared library (or other loadable object).

The process numbers are written to standard output in a line with spaces between
process numbers. A new line character is written to standard error after the
last output for each file operand. All other output is written to standard
error.

The fuser command will not detect processes that have mmap regions where that
associated file descriptor has since been closed.

Flags

-c Reports on any open files in the file system containing File.

-d Implies the use of the -c and -x flags. Reports on any open files which have
been unlinked from the file system (deleted from the parent directory). When
of the deleted file.

-f Reports on open instances of File only.

-k Sends the SIGKILL signal to each local process. Only the root user can kill a
process of another user.

-u Provides the login name for local processes in parentheses after the process
number.

-V Provides verbose output.

-x Used in conjunction with -c or -f, reports on executable and loadable objects
in addition to the standard fuser output.

Examples

  1. To list the process numbers of local processes using the /etc/passwd file,
     enter:

     fuser /etc/passwd

  2. To list the process numbers and user login names of processes using the

     fuser -u /etc/filesystems

  3. To terminate all of the processes using a given file system, enter:

     fuser -k -x -u /dev/hd1 -OR-

     fuser -kxuc /home

     Either command lists the process number and user name, and then terminates
     each process that is using the /dev/hd1 (/home) file system. Only the root
     user can terminate processes that belong to another user. You might want to
     use this command if you are trying to unmount the /dev/hd1 file system and
     a process that is accessing the /dev/hd1 file system prevents this.
  4. To list all processes that are using a file which has been deleted from a
     given file system, enter:

     fuser -d /usr

Files

/dev/kmem Used for the system image.


Related Information

The killall command, mount command, and ps command.

For more information about the identification and authentication of users,
discretionary access control, the trusted computing base, and auditing, refer to
Security Administration in AIX 5L Version 5.1 System Management Concepts:
Operating System and Devices.

论坛徽章:
0
4 [报告]
发表于 2003-04-28 13:46 |只看该作者

请教fuser的作用及具体用法!

fuser 指令

用途
使用文件或文件结构识别进程。

语法
fuser [ -c | -d | -f ] [ -k ] [ -u ] [ -x ] [ -V ]文件 ...

说明
此 fuser 命令列出了本地进程的进程号,那些本地进程使用File 参数指定的本地或远程文件。对于阻塞特别设备,此命令列出了使用该设备上任何文件的进程。

每个进程号后面都跟随一个字母,该字母指示进程如何使用文件。

c 将此文件作为当前目录使用。
e 将此文件作为程序的可执行对象使用。
r 将此文件作为根目录使用。
s 将此文件作为共享库(或其它可装载对象)使用。

进程号被写入标准输出(在进程号之间有空格的行中)。一个换行符被写入标准错误(在每个文件操作数的最后一个输出之后)。其他所有输出被写入标准错误。

此 fuser 命令不会检测有 mmap 区域的进程,其中相关的文件描述符已从此被关闭。

标记

-c 包含 File的文件系统中关于任何打开的文件的报告。
-d 暗示使用了 -c 和 -x 标志。关于任何与文件系统(自父目录删除的)无链接的打开文件的报告。当与 -V 标志一起使用时,它也会报告被删除文件的节点号和大小。
-f 仅对文件的打开实例报告。
-k 将 SIGKILL 信号发送到每个本地进程。仅有根用户能终止另一用户的进程。
-u 为进程号后圆括号中的本地进程提供登录名。
-V 提供详细输出。
-x 与 -c 或 -f 连用,报告除标准 fuser 输出以外的可执行的和可载入的对象。

示例
若要列出使用 /etc/passwd 文件的本地进程的进程号,请输入:

fuser /etc/passwd要列出使用 /etc/filesystems 文件的进程的进程号和用户登录名,请输入:

fuser -u /etc/filesystems要终止全部使用给定的文件系统的进程,请输入:

fuser -k -x -u /dev/hd1 -OR-
fuser -kxuc /home任一命令都列出了进程号和用户名,然后终止每个正在使用 /dev/hd1 (/home) 文件系统的进程。仅有根用户能终止属于另一用户的进程。如果你正在试图卸下 /dev/hd1 文件系统,而一个正在访问 /dev/hd1 文件系统的进程不允许这样,您可能希望使用此命令。

要列出正在使用文件(已从给定文件系统删除的文件)的全部进程,请输入:

fuser -d /usr文件

/dev/kmem 用于系统映象。
/dev/mem 也用于系统映象。

相关信息
killall 命令、mount 命令和 ps 命令。

有关用户识别和认证、任意访问控制、可信计算基础以及审计的更多信息,请参考《AIX 5L V5.2 安全指南》中的『独立的系统安全性』。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP