【转】fuser命令

简介: fuser命令在linux系统中用来根据文件或文件结构识别进程。使用权限:超级用户语法格式:  fuser [ -c | -d | -f ] [ -k | -K { SignalNumber | SignalName }] [ -u ] [ -x ] [ -V ]File ...使用说明:  此 fuser 命令列出了本地进程的进程号,那些本地进程使用 File 参数指定的本地或远程文件。
fuser命令在linux系统中用来根据文件或文件结构识别进程。
使用权限:超级用户
语法格式:
  fuser [ -c | -d | -f ] [ -k | -K { SignalNumber | SignalName }] [ -u ] [ -x ] [ -V ]File ...
使用说明:
  此 fuser 命令列出了本地进程的进程号,那些本地进程使用 File 参数指定的本地或远程文件。
对于阻塞特别设备,此命令列出了使用该设备上任何文件的进程。
每个进程号后面都跟随一个字母,该字母指示进程如何使用文件。
c 将此文件作为当前目录使用。
e 将此文件作为程序的可执行对象使用。
r 将此文件作为根目录使用。
s 将此文件作为共享库(或其他可装载对象)使用。
进程号被写入标准输出(在进程号之间有空格的行中)。
一个换行符被写入标准错误(在每个文件操作数的最后一个输出之后)。其他所有输出被写入标准错误。
此 fuser 命令不会检测有 mmap 区域的进程,其中相关的文件描述符已从此被关闭。
主要参数:
  -c 包含 File 的文件系统中关于任何打开的文件的报告。
  -d 暗示使用了 -c 和 -x 标志。
关于任何与文件系统(自父目录删除的)无链接的打开文件的报告。
当与 -V 标志一起使用时,它也会报告被删除文件的节点号和大小。
-f 仅对文件的打开实例报告。
-K SignalNumber | SignalName 将指定信号发送到每个本地进程。
仅有 root 用户能终止另一用户的进程。信号可以指定为信号名称(如 -9)或 KILL(用于 SIGKILL 信号)。
SignalName 的有效值是 kill -l 命令所显示的那些值。
-k 将 SIGKILL 信号发送到每个本地进程。仅有 root 用户能终止另一用户的进程。
注:
fuser -k 或 -K 可能无法检测和杀死程序开始运行后立即创建的新进程。
-u 为进程号后圆括号中的本地进程提供登录名。
-V 提供详细输出。
-x 与 -c 或 -f 连用,报告除标准 fuser 输出以外的可执行的和可载入的对象。
应用实例:
  要列出使用 /etc/passwd 文件的本地进程的进程号,请输入:
fuser /etc/passwd
要列出使用 /etc/filesystems 文件的进程的进程号和用户登录名,请输入:
fuser -u /etc/filesystems
要列出正在使用已从给定文件系统删除的文件的全部进程,请输入:
fuser -d /usr
fuser -km /home
kills all   processes   accessing   the   file system /home in any way.
if fuser -s /dev/ttyS1; then :; else something; fi
invokes something if no other process is using /dev/ttyS1.
fuser telnet/tcp
shows all processes at the (local) TELNET port.
fuser [-a|-s] [-n space] [-signal] [-kimuv] name ...   [-]
[-n space] [-signal] [-kimuv] name ...
fuser -l
fuser -V
c    current directory.
e    executable being run.
f    open   file.   f is omitted in default display mode.
r    root directory.
m    mmap'ed file or shared library.
List Open Files: lsof and fuser-进程相关
The function of these commands is very similar. The goal is to determine what processes have certain files open. lsof is freeware
and thus freely compilable under all Unixes. It is available by default under Linux only.
The main difference between lsof and fuser is that lsof takes both files/filesystems and PIDs as arguments whereas fuser only
accepts files/filesystems.
lsof:
lsof stands for list open files. It lists information about files that are currently open by processes.
In the absence of any options, lsof lists all open files belonging to all active processes
To list all open files for login name ``abe'', or user ID 1234 you would use the -u option. To list files being used by process
456, process 123, or process 789, you would use the -p flag. Putting these criteria together, we would have a command that looks
like this:
lsof -p 456,123,789 -u 1234,abe
The command to list all open files on device /dev/hd4, would look like this:
lsof /dev/hd4
To find the process that has /u/abe/foo open, use:
lsof /u/abe/foo
fuser:
fuser is more widely available (under AIX, HP-UX, IRIX, Linux, Solaris, Tru64 UNIX, and others) and can only be run as root. It
displays the process ID numbers of processes using the specified files or file systems. In the default display mode, each file
name is followed by a letter denoting the type of access (these codes differ from vendor to vendor):
a if the process is using the file as its trace file in /proc (IRIX)
c if the process is using the file as its current directory
e if the process is using the file as the executable being run
f if the process is using the file as an open file (Linux)
m if the process is using the file as a mmaped or shared lib (Linux)
o if the process is using the file as an open file (IRIX, Solaris, Tru64 UNIX))
p if the process is using the file as the parent of its current directory (Tru64 UNIX)
r if the process is using the file as root directory
s if the process is using the file as a shared lib (AIX)
t if the process is using the file as its text file (Solaris)
y if the process is using the file as its controlling terminal (IRIX)
目录
相关文章
|
存储
mPaaS一直报Config License验证失败的错误
mPaaS一直报Config License验证失败的错误
796 2
|
7月前
|
人工智能
Chain of Draft: 借鉴人类草稿思维让大型语言模型更快地思考
本研究探讨了大型语言模型(LLMs)在复杂推理任务中的计算资源消耗与响应延迟问题,特别是思维链(CoT)提示范式的效率局限性。为解决这一问题,研究引入了Chain of Draft (CoD) 方法论,通过生成简洁、高信息密度的中间输出,模拟人类认知过程。CoD将每步限制在五个单词以内,减少冗余表达,显著降低token消耗和计算成本,同时保持或提升推理准确性。实验结果显示,CoD在多种推理任务中表现出色,大幅减少了token使用量(仅为CoT的7.6%),缩短了响应时间,提升了LLM在实际应用中的效率与实用性。
157 14
Chain of Draft: 借鉴人类草稿思维让大型语言模型更快地思考
|
8月前
|
存储 人工智能 搜索推荐
评测 | AI 剧本生成与动画创作
随着短视频行业的快速发展,内容的即时性和创意性备受关注。传统动画制作流程复杂、耗时且成本高,难以跟上热点话题的变化。阿里云的“AI剧本生成与动画创作”解决方案通过AI自动化生成剧本、插图和语音,借助云计算的强大算力,大幅提速创作流程,降低成本,帮助短视频内容更高效、更有创意地生产。 本文将详细介绍该解决方案的部署和实际体验,涵盖从注册阿里云账号、开通相关服务到部署应用的全过程,并分享使用感受。尽管部署简单直观,生成的动画效果目前仍存在不足,但在创意动画和快速生成方面已展现出一定潜力。未来,随着技术的不断优化,期待AI动画创作能带来更高质量的作品,推动行业创新和发展。
367 5
评测 | AI 剧本生成与动画创作
|
7月前
|
存储 JavaScript
(ERP系统查看DWG)MxCAD APP调用内部弹框的方法
MxCAD APP 二次开发提供了调用项目内部弹框的接口,以保持样式统一。用户需创建 `test_dialog` 文件夹并依次创建 `dialog.ts`、`dialog.vue` 和 `index.ts` 文件来注册、构建和渲染弹框。通过 `useDialogIsShow` 钩子函数控制弹框显示,并可在方法中直接调用 `dialog.showDialog()` 来控制弹框显隐。此外,还支持监听确认或取消事件获取数据,以及通过配置 `vite.config.ts` 解决样式冲突问题。最终在 `src/index.ts` 中引入相关文件即可实现弹框功能。
|
数据采集 安全 自动驾驶
5G中的隐私保护机制:守护数字世界的安全与信任
5G中的隐私保护机制:守护数字世界的安全与信任
389 0
|
监控 数据挖掘 数据安全/隐私保护
ERP系统中的人才管理与绩效评估详解
【7月更文挑战第25天】 ERP系统中的人才管理与绩效评估详解
271 4
|
Cloud Native Go 开发工具
如何让CSDN学习成就个人能力六边形全是100分:解析个人能力雷达图的窍门
如何让CSDN学习成就个人能力六边形全是100分:解析个人能力雷达图的窍门
531 0
|
监控 安全 网络安全
IPSEC 与防火墙:功能与优势比较
【8月更文挑战第24天】
342 0
|
Go 图形学
【Unity小技巧】3D人物移动脚步和跳跃下落音效控制
【Unity小技巧】3D人物移动脚步和跳跃下落音效控制
241 1
|
Java Apache Maven
杨校老师课堂之Maven下载与配置阿里云镜像
杨校老师课堂之Maven下载与配置阿里云镜像
321 0