-r--r--r-- 1 root root 0 Dec 25 11:01 /proc/cpuinfo
$ file /proc/cpuinfo
/proc/cpuinfo: empty
$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 21
model : 19
model name : AMD Athlon(tm) X4 750 Quad Core Processor
stepping : 1
microcode : 0x6001119
cpu MHz : 1600.000
cache size : 2048 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 16
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
...
这是一个从双 CPU 的系统中得到的结果,上述大部分的信息十分清楚地给出了这个系统的有用的硬件信息。有些 /proc 的文件是经过编码的,不同的工具可以被用来解释这些编码过的信息并输出成可读的形式。这样的工具包括:'top', 'ps', 'apm' 等。
四.得到有用的系统/内核信息
- /proc/cpuinfo - CPU 的信息 (型号, 家族, 缓存大小等)
- /proc/meminfo - 物理内存、交换空间等的信息
- /proc/mounts - 已加载的文件系统的列表
- /proc/devices - 可用设备的列表
- /proc/filesystems - 被支持的文件系统
- /proc/modules - 已加载的模块
- /proc/version - 内核版本
- /proc/cmdline - 系统启动时输入的内核命令行参数
五.有关运行中的进程的信息
root 27440 27429 0 10:59 pts/23 00:00:05 minicom
正在运行的 mozilla 进程的 PID 是 27440。相对应的,/proc 中应该有一个名叫 27440 的目录
# ls -l /proc/27429
total 0
dr-xr-xr-x 2 root root 0 8月 27 22:36 attr
-rw-r--r-- 1 root root 0 8月 27 22:36 autogroup
-r-------- 1 root root 0 8月 27 22:36 auxv
-r--r--r-- 1 root root 0 8月 27 22:36 cgroup
--w------- 1 root root 0 8月 27 22:36 clear_refs
-r--r--r-- 1 root root 0 8月 27 15:34 cmdline
-rw-r--r-- 1 root root 0 8月 27 22:36 comm
-rw-r--r-- 1 root root 0 8月 27 22:36 coredump_filter
-r--r--r-- 1 root root 0 8月 27 22:36 cpuset
lrwxrwxrwx 1 root root 0 8月 27 22:36 cwd -> /home/andy
-r-------- 1 root root 0 8月 27 22:36 environ
lrwxrwxrwx 1 root root 0 8月 27 22:36 exe -> /bin/bash
dr-x------ 2 root root 0 8月 27 15:34 fd
dr-x------ 2 root root 0 8月 27 22:36 fdinfo
-rw-r--r-- 1 root root 0 8月 27 22:36 gid_map
-r-------- 1 root root 0 8月 27 22:36 io
-r--r--r-- 1 root root 0 8月 27 22:36 latency
-r--r--r-- 1 root root 0 8月 27 22:36 limits
-rw-r--r-- 1 root root 0 8月 27 22:36 loginuid
dr-x------ 2 root root 0 8月 27 22:36 map_files
-r--r--r-- 1 root root 0 8月 27 22:36 maps
-rw------- 1 root root 0 8月 27 22:36 mem
-r--r--r-- 1 root root 0 8月 27 22:36 mountinfo
-r--r--r-- 1 root root 0 8月 27 22:36 mounts
-r-------- 1 root root 0 8月 27 22:36 mountstats
dr-xr-xr-x 5 root root 0 8月 27 22:36 net
dr-x--x--x 2 root root 0 8月 27 22:36 ns
-r--r--r-- 1 root root 0 8月 27 22:36 numa_maps
-rw-r--r-- 1 root root 0 8月 27 22:36 oom_adj
-r--r--r-- 1 root root 0 8月 27 22:36 oom_score
-rw-r--r-- 1 root root 0 8月 27 22:36 oom_score_adj
-r--r--r-- 1 root root 0 8月 27 22:36 pagemap
-r--r--r-- 1 root root 0 8月 27 22:36 personality
-rw-r--r-- 1 root root 0 8月 27 22:36 projid_map
lrwxrwxrwx 1 root root 0 8月 27 22:36 root -> /
-rw-r--r-- 1 root root 0 8月 27 22:36 sched
-r--r--r-- 1 root root 0 8月 27 22:36 schedstat
-r--r--r-- 1 root root 0 8月 27 22:36 sessionid
-r--r--r-- 1 root root 0 8月 27 22:36 smaps
-r--r--r-- 1 root root 0 8月 27 22:36 stack
-r--r--r-- 1 root root 0 8月 27 15:34 stat
-r--r--r-- 1 root root 0 8月 27 22:36 statm
-r--r--r-- 1 root root 0 8月 27 15:34 status
-r--r--r-- 1 root root 0 8月 27 22:36 syscall
dr-xr-xr-x 3 root root 0 8月 27 22:36 task
-r--r--r-- 1 root root 0 8月 27 22:36 timers
-rw-r--r-- 1 root root 0 8月 27 22:36 uid_map
-r--r--r-- 1 root root 0 8月 27 22:36 wchan
文件 "cmdline" 包含启动进程时调用的命令行。
"envir" 进程的环境变量。
"status" 是进程的状态信息,包括启动进程的用户的用户ID (UID) 和组ID(GID) ,父进程ID (PPID),还有进程当前的状态,比如"Sleelping"和"Running"。每个进程的目录都有几个符号链接,"cwd"是指向进程当前工作目录的符号链接,"exe"指向运行进程的可执行程序,"root"指向被这个进程看作是根目录的目录 (通常是"/")。
目录"fd"包含指向进程使用的文件描述符的链接。
"cpu"仅在运行 SMP 内核时出现,里面是按 CPU 划分的进程时间。