linux文件描述符open file descriptors与open files的区别
一个文件被打开,也可能没有文件描述符,比如current working diretories,memory mapped files and executable text files ;losf可以查岀某个进程打开的文件数目:
root@GitLab ~]# sh
sh-4.1# lsof |grep
rpcbind rpc cwd DIR , /
rpcbind rpc rtd DIR , /
rpcbind rpc txt REG , /sbin/rpcbind
rpcbind rpc mem REG , /lib64/libnss_files-2.12.so
rpcbind rpc mem REG , /lib64/libdl-2.12.so
rpcbind rpc mem REG , /lib64/libgssglue.so.1.0.
rpcbind rpc mem REG , /lib64/libnsl-2.12.so
rpcbind rpc mem REG , /lib64/libc-2.12.so
rpcbind rpc mem REG , /lib64/libpthread-2.12.so
rpcbind rpc mem REG , /lib64/libtirpc.so.1.0.
rpcbind rpc mem REG , /lib64/libwrap.so.0.7.
rpcbind rpc mem REG , /lib64/ld-2.12.so
rpcbind rpc 0u CHR , 0t0 /dev/null
rpcbind rpc 1u CHR , 0t0 /dev/null
rpcbind rpc 2u CHR , 0t0 /dev/null
rpcbind rpc 3r REG , /var/run/rpcbind.lock
rpcbind rpc 4u sock , 0t0 can't identify protocol
rpcbind rpc 5u unix 0xffff88003742b480 0t0 /var/run/rpcbind.sock
rpcbind rpc 6u IPv4 0t0 UDP *:sunrpc
rpcbind rpc 7u IPv4 0t0 UDP *:
rpcbind rpc 8u IPv4 0t0 TCP *:sunrpc (LISTEN)
rpcbind rpc 9u IPv6 0t0 UDP *:sunrpc
rpcbind rpc 10u IPv6 0t0 UDP *:
rpcbind rpc 11u IPv6 0t0 TCP *:sunrpc (LISTEN)
sh-4.1# lsof |grep |wc -l
以下方法用于查询进程使用的文件 描述符的数目:
sh-4.1# ls -l /proc//fd
total
lrwx------ root root Nov : -> /dev/null
lrwx------ root root Nov : -> /dev/null
lrwx------ root root Nov : -> socket:[]
lrwx------ root root Nov : -> socket:[]
lrwx------ root root Nov : -> /dev/null
lr-x------ root root Nov : -> /var/run/rpcbind.lock
lrwx------ root root Nov : -> socket:[]
lrwx------ root root Nov : -> socket:[]
lrwx------ root root Nov : -> socket:[]
lrwx------ root root Nov : -> socket:[]
lrwx------ root root Nov : -> socket:[]
lrwx------ root root Nov : -> socket:[]
sh-4.1# ls -l /proc//fd|wc -l
进程1407总共打开24个文件,只占用了13个文件 描述符
查看文件描述符的设置:
sh-4.1# cat /proc/sys/fs/file-max --该参数可以动态修改
linux文件描述符open file descriptors与open files的区别的更多相关文章
- Linux文件描述符与打开文件之间的区别(转载)
转载请说明出处:http://blog.csdn.net/cywosp/article/details/38965239 1. 概述 在Linux系统中一切皆可以看成是文件,文件又可分为: ...
- linux文件描述符--转载
转自:http://blog.csdn.net/cywosp/article/details/38965239 1. 概述 在Linux系统中一切皆可以看成是文件,文件又可分为:普通文件.目录 ...
- [性能分析]linux文件描述符(转)
1.什么是文件和文件描述符 Linux中文件可以分为4种:普通文件.目录文件.链接文件和设备文件.1.普通文件是用户日常使用最多的文件,包括文本文件.shell脚本.二进制的可执行和各种类型的数据.l ...
- 文件描述符与FILE
1. 文件描述符(重点) 在Linux系统中一切皆可以看成是文件,文件又可分为:普通文件.目录文件.链接文件和设备文件.文件描述符(file descriptor)是内核为了高效管理已被打开的文件所创 ...
- linux 文件描述符
文件描述符是什么?和文件句柄有啥区别?文件描述符是linux/unix操作系统中特有的概念.相当于windows系统中的文件句柄.一个意思不同叫法.Linux系统中, 每当进程打开一个文件时,系统就为 ...
- [性能分析]linux文件描述符
1.什么是文件和文件描述符 Linux中文件可以分为4种:普通文件.目录文件.链接文件和设备文件.1.普通文件是用户日常使用最多的文件,包括文本文件.shell脚本.二进制的可执行和各种类型的数据.l ...
- 玩转Linux文件描述符和重定向
本文介绍linux中文件描述符与重定向的相关知识,文件描述符是与文件输入.输出相关联的整数,它们用来跟踪已打开的文件.有需要的朋友参考下. 原文出处:http://www.jbxue.com/arti ...
- [转帖]linux文件描述符文件/etc/security/limits.conf
linux文件描述符文件/etc/security/limits.conf https://blog.csdn.net/fanren224/article/details/79971359 需要多学习 ...
- linux文件描述符、软硬连接、输入输出重定向
引用链接:https://blog.csdn.net/qq769651718/article/details/79459346 文件描述符的作用: 文件描述符是linux操作系统中特有的概念.其相当于 ...
随机推荐
- 160809228_符瑞艺_C语言程序设计实验3 循环结构程序设计
#include <stdio.h> int main(){ //使用for循环完成1+2+......+100 ; ;i<=;i++) sum +=i; //sum = sum ...
- 绝对实用 NAT + VLAN +ACL管理企业网络
在企业中,要实现所有的员工都能与互联网进行通信,每个人各使用一个公网地址是很不现实的.一般,企业有1个或几个公网地址,而企业有几十.几百个员工.要想让所有的员工使用这仅有的几个公网地址与互联网通信该怎 ...
- MyBatis 中 Result Maps collection already contains value for xxx 错误原因
出现此类错误的原因是同一个DAO操作多个Mapper导致的,将Mapper配置文件的 ResultMap的ID修改成不相同即可解决
- zend studio安装svn插件
进入zend->Help->Install New Software 输入如下地址: http://subclipse.tigris.org/update_1.8.x 选择subclips ...
- Python正则表达式汇总
判断是否是整数或小数,在网上看到一个方法: type(eval(")) == int type(eval("123.23")) == float 后来又看到<Pyt ...
- JustMock Lite (Free Mocking Framework For .net)
通过 Nuget 安装 2. 官网下载(官网不行点这里) 3. 帮助文档 商业版和免费版区别概览 MockingContainer 测试类准备:一般来说也是业务类 public class C ...
- 开源工作流 Bonita BPM (JAVA)
Bonita BPM 开源工作流 Bonita BPM (JAVA) http://www.bonitasoft.com/
- 【leetcode】Gas Station
Gas Station There are N gas stations along a circular route, where the amount of gas at station i is ...
- 【leetcode】Rotate Image
Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees ...
- iOS UIViewController 和 nib 相关的3个方法
iOS UIViewController 的 awakeFromNib 以及 - (id)initWithCoder:(NSCoder *)aDecoder 和 - (instancetype)ini ...