"/proc"学习

1,The Proc psuedo file system is a real time, memory resident file system that tracks the processes running on your machine and the state of your system.
2, certain parts of the /proc file system can be read only by the owner of the process and of course root.

3,Dmesg helps us determine the devices that have been detected and
initialized by the Linux kernel.

4,Using the /proc/sys file system to parse kernel parameters.

example:
/proc/sys/net/ipv4/ip_forward

The above file ip_forward has a default value of "0" which you can see
when you cat the contents of this file. This means that IP forwarding by
this machine isn't allowed by the kernel. But this configuration can be
changed in real time by just changing the value stored in this file from
"0" to "1". Thus we have enabled IP forwarding on our Linux machine.

5,The numerical named directories
The various directories that you see out here are the processes that were
running on our machine at the instant we took a snapshot of the /proc
file system. Let's look at the contents of one of these directories.


"cmdline", this file contains the whole command line used to invoke the
process. The contents of this file are the command line arguments with all
the parameters that one has passed to start the particular process.

"cwd", as is visible from above this is a symbolic link to the current
working directory of that particular process.

"environ" contains all the environment variables defined for this
particular process in the form VARIABLE=value. As with cmdline, all the
information contained in the file is without any formatting or space
between the command line arguments and various arguments.

root@hanyh-sina:/proc/2877# more environ
USER=hanyh41c5b114a3f1aad-1254014503.431125-1889403626berra-gtk-module=dd2e39cbab07170eb6e6866a4abebe28ODULE=scim-bridgeysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
SH_AUTH_SOCK=/tmp/ssh-IBCbuc2877/agent.2877MODULE=ximgdm/

"exe", this is a symbolic link to the executable file that the current
process is linkroot@hanyh-sina:/proc/2877# ls -l exe
lrwxrwxrwx 1 hanyh hanyh 0 2009-09-27 09:21 exe -> /usr/bin/gnome-session
ed to.

"fd", this directory contains the list file descriptors as opened by the
particular process.
lr-x------ 1 hanyh hanyh 64 2009-09-27 09:21 0 -> /dev/null
l-wx------ 1 hanyh hanyh 64 2009-09-27 09:21 1 -> pipe:[7760]
lr-x------ 1 hanyh hanyh 64 2009-09-27 10:01 10 -> pipe:[8622]
lrwx------ 1 hanyh hanyh 64 2009-09-27 10:01 16 -> socket:[8625]
lrwx------ 1 hanyh hanyh 64 2009-09-27 10:01 17 -> socket:[8627]

pr--r--r-- 1 root root 0 Nov 30 12:20 maps
root@hanyh-sina:/proc/2877# more maps
00400000-00436000 r-xp 00000000 08:08 50659720 /usr/bin/gnome-session
00635000-00636000 r--p 00035000 08:08 50659720 /usr/bin/gnome-session
00636000-00638000 rw-p 00036000 08:08 50659720 /usr/bin/gnome-session
01721000-01840000 rw-p 01721000 00:00 0 [heap]
7f4f046f8000-7f4f0471a000 r-xp 00000000 08:08 236876 /usr/lib/gtk-2.0/2.10.0/eng
ines/libmurrine.so
7f4f0471a000-7f4f04919000 ---p 00022000 08:08 236876 /usr/lib/gtk-2.0/2.10.0/eng

parts of the process' address space which are currently mapped to a file.
The fields, from left to right, are: the address space associated to this
mapping, the permissions associated to this mapping, the offset from the
beginning of the file where the mapping starts, the device on which the
mapped file is located, the inode number of the file and finally, the name
of the file itself.

"root", this is a symbolic link pointing to the directory which is the
root file system for the particular process.

"status", this file gives information regarding the name of the process,
its current status, i.e sleeping or awake, its PID, its UID, its PPID and
a lot of other general information. This information can be viewed in a
simpler and structured manner by using tools like, "ps" and "top".


proc/cpuinfo
Information about the processor, such as its type, make, model, and
performance.

/proc/devices
List of device drivers configured into the currently running kernel.

/proc/dma
Shows which DMA channels are being used at the moment.

/proc/filesystems
Filesystems configured into the kernel.

/proc/interrupts
Shows which interrupts are in use, and how many of each there have been.

/proc/ioports
Which I/O ports are in use at the moment.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值