{"id":20469139,"url":"https://github.com/jinsyin/procfs","last_synced_at":"2026-04-17T00:02:21.960Z","repository":{"id":200497414,"uuid":"246219602","full_name":"JinsYin/procfs","owner":"JinsYin","description":"《procfs》","archived":false,"fork":false,"pushed_at":"2020-03-14T12:29:23.000Z","size":899,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-06T15:02:45.206Z","etag":null,"topics":["linux","proc","procfs"],"latest_commit_sha":null,"homepage":"https://githome.io/procfs/","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JinsYin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-03-10T05:55:06.000Z","updated_at":"2020-03-12T03:37:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa31514f-659b-498e-94ee-38be85c0bd28","html_url":"https://github.com/JinsYin/procfs","commit_stats":null,"previous_names":["jinsyin/procfs"],"tags_count":0,"template":false,"template_full_name":"JinsYin/template-gitbook","purl":"pkg:github/JinsYin/procfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JinsYin%2Fprocfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JinsYin%2Fprocfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JinsYin%2Fprocfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JinsYin%2Fprocfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JinsYin","download_url":"https://codeload.github.com/JinsYin/procfs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JinsYin%2Fprocfs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31909235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","proc","procfs"],"created_at":"2024-11-15T14:08:03.488Z","updated_at":"2026-04-17T00:02:21.927Z","avatar_url":"https://github.com/JinsYin.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Procfs\n\n[![website][website-image]][website-href]\n\n[website-image]: https://img.shields.io/website-up-down-green-red/https/githome.io/procfs/.svg\n[website-href]: https://githome.io/procfs/\n\nProcfs 是 Linux 所特有的伪文件系统（pseudo file system）。\n\n为了更便捷地获取和（或）修改内核属性，Linux 提供了一个 proc 伪文件系统，该文件系统驻留于 `/proc` 目录，包含了各种用于展示内核信息的文件。\n\n之所以将 proc 称为伪文件系统（pseudo：假的；伪的），是因为其包含的文件并未存储在磁盘上，而是由内核在进程访问此类信息时动态创建而成。\n\n## 目录层级\n\n| 子目录            | 描述                   |\n| ----------------- | ---------------------- |\n| /proc/            | 系统相关信息           |\n| /proc/[pid]/      | 进程相关信息           |\n| /proc/net/        | 网络和套接字的状态信息 |\n| /proc/sys/fs/     | 文件系统相关设置       |\n| /proc/sys/kernel/ | 常规的内核设置         |\n| /proc/sys/net/    | 网络和套接字的设置     |\n| /proc/sys/vm/     | 内存管理设置           |\n| /proc/sysvipc/    | System V IPC 对象信息  |\n\n| symlink     | 描述 | 示例                                |\n| ----------- | ---- | ----------------------------------- |\n| mounts      |      | `mounts -\u003e self/mounts`             |\n| self        |      | `self -\u003e 795328`                    |\n| thread-self |      | `thread-self -\u003e 795328/task/795328` |\n\n| 子文件 | 描述 |\n| ------ | ---- |\n|        |      |\n\n## 查看和修改\n\n```sh\n$ echo 1000000 \u003e /proc/sys/kernel/pid_max\n$ cat /pro/sys/kernel/pid_max\n```\n\n注意：\n\n* `/proc` 目录下的一些文件是只读的，仅用于显示内核信息，但无法对其进行修改，多见于 `/proc/[pid]/` 目录下的文件\n* `/proc` 目录下的一些文件仅能有文件拥有者（或特权级进程）读取\n* 除 `/proc/[pid]/` 子目录下的文件，`/proc` 目录的其他文件大多属于 root 用户\n\n## 相关\n\n```sh\n# 手册页\n$ man 5 proc\n```\n\n```sh\n# Debian\n$ apt-get install procinfo\n\n$ lsdev\n\n$ procinfo\n```\n\n## 示例\n\n```sh\n$ tree -L 1\n├── acpi\n│   └── wakeup\n├── asound\n│   ├── card0\n│   ├── card1\n│   ├── cards\n│   ├── devices\n│   ├── hwdep\n│   ├── modules\n│   ├── NVidia -\u003e card1\n│   ├── oss\n│   ├── PCH -\u003e card0\n│   ├── pcm\n│   ├── seq\n│   ├── timers\n│   └── version\n├── buddyinfo\n├── bus\n│   ├── input\n│   └── pci\n├── cgroups\n├── cmdline\n├── consoles\n├── cpuinfo\n├── crypto\n├── devices\n├── diskstats\n├── dma\n├── driver\n│   └── rtc\n├── execdomains\n├── fb\n├── filesystems\n├── fs\n│   ├── aufs\n│   ├── ext4\n│   ├── fscache\n│   ├── jbd2\n│   ├── lockd\n│   ├── nfs\n│   ├── nfsd\n│   ├── nfsfs\n│   └── xfs\n├── interrupts\n├── iomem\n├── ioports\n├── irq\n│   ├── 0\n│   ├── 1\n│   ├── 10\n│   ├── 11\n│   ├── 12\n│   ├── 13\n│   ├── 14\n│   ├── 15\n│   ├── 16\n│   ├── 17\n│   ├── 2\n│   ├── 23\n│   ├── 25\n│   ├── 26\n│   ├── 27\n│   ├── 28\n│   ├── 29\n│   ├── 3\n│   ├── 30\n│   ├── 4\n│   ├── 5\n│   ├── 6\n│   ├── 7\n│   ├── 8\n│   ├── 9\n│   └── default_smp_affinity\n├── kallsyms\n├── kcore\n├── keys\n├── key-users\n├── kmsg\n├── kpagecgroup\n├── kpagecount\n├── kpageflags\n├── loadavg\n├── locks\n├── mdstat\n├── meminfo\n├── misc\n├── modules\n├── mounts -\u003e self/mounts\n├── mtrr\n├── net -\u003e self/net\n├── pagetypeinfo\n├── partitions\n├── sched_debug\n├── schedstat\n├── scsi\n│   ├── device_info\n│   ├── scsi\n│   ├── sg\n│   └── usb-storage\n├── self -\u003e 795328\n├── slabinfo\n├── softirqs\n├── stat\n├── swaps\n├── sys\n│   ├── abi\n│   ├── debug\n│   ├── dev\n│   ├── fs\n│   ├── fscache\n│   ├── kernel\n│   ├── net\n│   ├── sunrpc\n│   └── vm\n├── sysrq-trigger\n├── sysvipc\n│   ├── msg\n│   ├── sem\n│   └── shm\n├── thread-self -\u003e 795328/task/795328\n├── timer_list\n├── timer_stats\n├── tty\n│   ├── driver\n│   ├── drivers\n│   ├── ldisc\n│   └── ldiscs\n├── uptime\n├── version\n├── version_signature\n├── vmallocinfo\n├── vmstat\n└── zoneinfo\n```\n\n## 内核代码\n\n```c\n/*\n * \u003cinclude/linux/proc_fs.h\u003e\n *\n *\n *\n */\n```\n\n## 挂载 procfs\n\n运行时手动挂载：\n\n```sh\n# /proc 是标准挂载点\n# 尝试改变挂载点会发现两者的内容一致：sudo mount -t proc proc /tmp/proc\n$ sudo mount -t proc proc /proc\n```\n\n引导时自动挂载：\n\n```sh\n$ sudo vi /etc/fstab\nproc /proc proc noauto 0 0\n```\n\n## LICENSE\n\n[![CC BY-NC-SA 4.0](https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png)](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinsyin%2Fprocfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjinsyin%2Fprocfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinsyin%2Fprocfs/lists"}