centos6下无法使用lsof命令"-bash: lsof: command not found"

本文介绍了解决CentOS系统中lsof命令缺失的问题,并提供了详细的安装步骤。同时,还列举了lsof命令的常用用法,帮助用户更好地管理和监控系统中的端口和服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://blog.youkuaiyun.com/cryhelyxx/article/details/43228423

 

1. 问题描述
在centos下, 无法使用命令lsof, 出现以下信息:
 
 
  1. # lsof -i:3690

  2. -bash: lsof: command not found

2. 解决方法
我们可以通过yum来安装:
 
# yum install lsof
本人操作如下:
 
 
  1. # yum install lsof

  2. Loaded plugins: fastestmirror

  3. Setting up Install Process

  4. Loading mirror speeds from cached hostfile

  5. * base: mirrors.163.com

  6. * epel: ftp.cuhk.edu.hk

  7. * extras: mirrors.aliyun.com

  8. * updates: mirrors.163.com

  9. Resolving Dependencies

  10. --> Running transaction check

  11. ---> Package lsof.x86_64 0:4.82-4.el6 will be installed

  12. --> Finished Dependency Resolution

  13.  
  14. Dependencies Resolved

  15.  
  16. ================================================================================

  17. Package Arch Version Repository Size

  18. ================================================================================

  19. Installing:

  20. lsof x86_64 4.82-4.el6 base 319 k

  21.  
  22. Transaction Summary

  23. ================================================================================

  24. Install 1 Package(s)

  25.  
  26. Total download size: 319 k

  27. Installed size: 890 k

  28. Is this ok [y/N]: y

  29. Downloading Packages:

  30. lsof-4.82-4.el6.x86_64.rpm | 319 kB 00:00

  31. Running rpm_check_debug

  32. Running Transaction Test

  33. Transaction Test Succeeded

  34. Running Transaction

  35. Installing : lsof-4.82-4.el6.x86_64 1/1

  36. Verifying : lsof-4.82-4.el6.x86_64 1/1

  37.  
  38. Installed:

  39. lsof.x86_64 0:4.82-4.el6

  40.  
  41. Complete!

3. lsof 的常用几个命令
 
lsof -i:(端口号)
如, 
lsof -i:3306         (3306默认是mysql服务端的端口)
lsof -i:3690         (3690默认是svn服务端的端口)
 
 
 
 
 
OK, Enjoy it!!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值