lsof 工具
- font size decrease font size increase font size
lsof 工具可列出某个Unix 进程所打开文件信息的清单,被打开文件的类型可能包括了:本地文件,目录,网络共享文件,块设备文件,字符设备文件,共享库,管道,软链接,套接字等等.
以下是具体的lsof 操作实例总结:
1,列出所有被打开文件信息
#lsof
2,查看某个被打开文件信息
#lsof /path/to/file
#lsof /path/to/file1 /path/to/file2
3,列出某个目录下的被打开文件
#lsof +D /path
#lsof | grep “/path”
4,列出某个用户下的被打开文件
#lsof -u nobody
#lsof -u nobody,root
5,列出某个进程下的被打开文件
#lsof -c httpd
#lsof -c httpd -c mysqld
6,复合查询(OR)被打开文件信息
#lsof -u nobody -c httpd
7,复合查询(AND)被打开文件信息
#lsof -a -u root -c httpd
8,查看除root之外所有用户的被打开文件
#lsof -u ^root
9,查看具体进程PID的被打开文件
#lsof -p 10101
#lsof -p 10101,10102,10103
10,列出所有网络连接
#lsof -i
11,列出所有网络TCP或者UDP连接
#lsof -i tcp
#lsof -i udp
12,查看具体网络端口信息
#lsof -i :80
#lsof -i tcp:80
#lsof -i udp:53
13,查看具体用户下所有网络连接
#lsof -a -u www -i
14,列出NFS 文件
#lsof -N
15,列出Unix 套接字文件
#lsof -U
16,列出某个特定文件描述符相关联的文件
#lsof -d 2
#lsof -d 0-2
#lsof -d mem
0 1 2 => FD: standard input, output, and error
17,列出所有网络连接关联的PID
#lsof -t -i
#kill -9 `lsof -t -i` => kill all process use network
18,重复lsof 输出
#lsof -r 1 -a -u www -i
( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0005 | 415744 | {main}( ) | .../index.php:0 |
2 | 0.0787 | 4720824 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0787 | 4720824 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.2764 | 12448984 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.2775 | 12473328 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.2786 | 12528656 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.2791 | 12557480 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.2903 | 12992888 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.2904 | 12992888 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3039 | 13718088 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3039 | 13718088 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3103 | 14114456 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.3116 | 14134824 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.4151 | 17118848 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.4151 | 17118848 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.4174 | 17299048 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |
- Published in CentOS 6
- Read 1206 times
( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0005 | 415744 | {main}( ) | .../index.php:0 |
2 | 0.0787 | 4720824 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0787 | 4720824 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.2764 | 12448984 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.2775 | 12473328 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.2786 | 12528656 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.2791 | 12557480 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.2903 | 12992888 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.2904 | 12992888 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3039 | 13718088 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3039 | 13718088 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3103 | 14114456 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.3116 | 14134824 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.4151 | 17118848 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.4151 | 17118848 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.4174 | 17299048 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |