如何找出哪个进程正在Linux中使用文件? [英] How find out which process is using a file in Linux?

查看:112
本文介绍了如何找出哪个进程正在Linux中使用文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用rm -rf file_name在Linux中删除文件,但收到错误消息:

I tried to remove a file in Linux using rm -rf file_name, but got the error:

rm: file_name not removed.  Text file busy

如何找出正在使用该文件的进程?

How can I find out which process is using this file?

推荐答案

您可以使用fuser命令,例如:

You can use the fuser command, like:

fuser file_name

您将收到使用该文件的进程列表.

You will receive a list of processes using the file.

您可以将其与其他标志一起使用,以接收更详细的输出.

You can use different flags with it, in order to receive a more detailed output.

您可以在 fuser的Wikipedia文章man页.

这篇关于如何找出哪个进程正在Linux中使用文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆