procfs (or the proc filesystem) is a special filesystem in UNIX-like operating systems that presents information about processes and other system information in a hierarchical file-like structure

learn more… | top users | synonyms

61
votes
3answers
36k views

How do I read from /proc/$pid/mem under Linux?

The Linux proc(5) man page tells me that /proc/$pid/mem “can be used to access the pages of a process's memory”. But a straightforward attempt to use it only gives me $ cat /proc/$$/mem ...
56
votes
3answers
6k views

What happens when I run the command cat /proc/cpuinfo?

What happens when I write cat /proc/cpuinfo. Is that a named pipe (or something else) to the OS which reads the CPU info on the fly and generate that text each time I call it?
22
votes
2answers
1k views

How frequently is the proc file system updated on Linux?

How frequently is the proc file system updated on Linux? Is it 20 milliseconds (time quantum)?
17
votes
7answers
721 views

How do I source another process's environment variables?

If I examine /proc/1/environ I can see a null-byte-delimited string of process 1's environment variables. I'd like to bring these variables into my current environment. Is there an easy way to do ...
16
votes
2answers
2k views

When was a process started

To know when was a process started, my first guess was to check the time when /proc/<pid>/cmdline was written/modified the last time. ps also shows a START field. I thought both of these ...
14
votes
2answers
6k views

/proc/PID/fd/X link number

In Linux, in /proc/PID/fd/X, the links for file descriptors that are pipes or sockets have a number, like: l-wx------ 1 user user 64 Mar 24 00:05 1 -> pipe:[6839] l-wx------ 1 user user 64 Mar 24 ...
14
votes
4answers
462 views

How do I learn what I can do with /proc and /sys

I'd like to know more about the advanced uses of the /proc and /sys virtual filesystems, but I don't know where to begin. Can anyone suggest any good sources to learn from? Also, since I think sys has ...
14
votes
1answer
883 views

“ss” command in iproute package; why query slab table for timewait sockets?

Forgive me if this isn't the best forum for this question, but it seems more relevant to the kernel than to the programming itself. I'm writing a script that queries the system for open ports so that ...
13
votes
7answers
51k views

Tell fs to free space from deleted files NOW

Is there a way to tell the kernel to give back the free disk space now? Like a write to something in /proc/ ? Using Ubuntu 11.10 with ext4. This is probably an old and very repeated theme. After ...
13
votes
3answers
621 views

Contents of /proc

Is there a site someplace that lists the contents of /proc and what each entry means?
12
votes
1answer
1k views

sysctl: /proc/sys/net/ipv[46]/conf/: what's the difference between “all”, “default” and “eth*”?

In sysctl, the /proc/sys/net/ipv[46]/conf/ keys have the following subkeys: all, default, and a key for each network interface. For example, on a machine with a single network interface eth0, it will ...
12
votes
4answers
3k views

Read the stack of another process?

I'm trying to read a child process's stack but with no luck. I know it is possible using ptrace, but ptrace's interface allows you to read only one word at a time, and I'm trying to scan a larger ...
11
votes
5answers
2k views

What happens when I open and read from /proc?

Does the hard drive need to be accessed or is everything done in memory? Basically I would like to constantly get updated values from meminfo and cpuinfo. Do I need to reopen the file and then reread ...
9
votes
4answers
7k views

Find out what device /dev/root represents in Linux?

On linux, there is a /dev/root device node. This will be the same block device as another device node, like /dev/sdaX. How can I resolve /dev/root to the 'real' device node in this situation, so ...
8
votes
2answers
2k views

Determine if a specific process is 32- or 64-Bit

Given a 2.6.x or newer Linux kernel and existing userland that is capable of running both ELF32 and ELF64 binaries (i.e. well past How do I know that my CPU supports 64bit operating systems under ...
8
votes
2answers
995 views

A hidden process, what it is?

[root@datacenteronline ~]# ssh root@192.168.1.172 Last login: Wed Apr 17 09:55:45 2013 from 192.168.1.187 [root@localhost ~]# ls /proc/ | grep 2266 [root@localhost ~]# cd /proc/2266 [root@localhost ...
8
votes
1answer
1k views

change environment of a running process

How might it be possible to alter some variable in the env of an already running process, for example through /proc/PID/environ? That "file" is read-only. Need to change or unset the DISPLAY variable ...
7
votes
4answers
706 views

Linking /proc/mnt to /proc/mounts

I understand that /proc filesystem reflects the output of various processes. Unfortunately, I have a propietary (romdump) binary that expects the mount table to appear as /proc/mtd, while my Android ...
7
votes
2answers
1k views

/proc/sys vs /sys/modules/mod/parameter

I've been wondering for last few days how exactly does it work. We can set kernel runtimes parameters using sysctl or echo boolen 1> /proc/sys/module/exactParameter but in ...
7
votes
1answer
2k views

Is the sum of all PIDs “utime” the total system utime?

In order to measure a user's total CPU time, I'm using the "utime" field out of /proc/[pid]/stat: utime %lu Amount of time that this process has been scheduled in user mode, measured in ...
7
votes
3answers
3k views

Arch linux : pacman does not work when chrooting

I have Ubuntu installed on my computer. I decided to install Arch linux, but I skipped the part about Grub installation as it is already installed. Seeing that Arch does not show up in Grub's menu ...
7
votes
2answers
236 views

Linux /proc/sys/kernel: where are the files sysrq-sticky, sysrq-key, and sysrq-timer?

Documentation for Red Hat Enterprise Linux 3 (section 5.3.9.3) mentions these files in /proc/sys/kernel/: sysrq sysrq-key sysrq-sticky sysrq-timer The documentation for RHEL 5 also mentions them. ...
6
votes
2answers
3k views

How is /proc/self implemented in Linux?

I was tinkering around with the /proc filesystem in Linux, and I came across /proc/self, which is a symbolic link to the process directory of the current process. I would like to know how it is ...
6
votes
3answers
1k views

How to check if /proc/ is mounted

How can I check if /proc/ is mounted? Using /etc/mtab is discouraged as it might be inconsistent. Using /proc/mounts is also not an option as might not exist if /proc/ is not mounted (although ...
6
votes
1answer
185 views

What's the purpose of the /proc/pid/mountinfo file?

What's the purpose of the /proc/pid/mountinfo file (with pid being numerical process id)? As far as I can see it reflects contents of the /proc/mounts file but with added information. Also the file ...
6
votes
2answers
299 views

Which of proc, sys etc. should be bind-mounted (or not) when chrooting into a “replacement” distribution?

This answer to another question basically boils down to chrooting into another Linux distribution in order to mainly use that as a replacement to its too restricted (but irreplaceable) parent. The ...
6
votes
1answer
528 views

Timestamp of socket in /proc/<pid>/fd

If I list /proc/<pid>/fd I see a number of entries for sockets. These entries have timestamps. At first I thought they were when the socket was created. But it doesn't always appear to be the ...
6
votes
1answer
2k views

How do I know if a serial port is actually transmitting data, without opening the device?

I have a high-availability cluster (Heartbeat) connected via serial line and two ethernet NICs. I'd like to set up a monitoring script capable of recognizing disconnected serial line (basically the ...
6
votes
1answer
46 views

How do I know what decompression algorithms are compiled-in into the linux kernel?

If /proc/config.gz is unavailable, how do I know what decompression algorithms the running kernel is capable of using on a compressed cpio initramfs? Is the gzip algorithm always available, even when ...
6
votes
1answer
524 views

Files bigger than max(off64_t) on Solaris, eg “/proc/../as”

How do I read or seek from a file that's bigger than the maximum off64_t? The problem arises because the address space of a process is represented in the /proc/.../as file, which is a huge sparse file ...
5
votes
2answers
617 views

Portability of file descriptor links

I've always wondered this but never took the time to find out, so I'll do so now - how portable is the usage shown here of either /proc/$$/fd/$N or /dev/fd/$N? I understand POSIX guarantees /dev/null, ...
5
votes
2answers
317 views

Why do I have four CPUs listed in /proc/cpuinfo?

When I bought my Lenovo Thinkpad 520, it had Windows installed. I promptly cleaned that out and installed Fedora 16. I recently visited the /proc/cpuinfo and, much to my surprise, discovered that it ...
5
votes
3answers
581 views

Why can't I `tail -f /proc/$pid/fd/1`?

I wrote a simple script which echo-es its PID: #/bin/bash while true; do echo $$; sleep 0.5; done I'm running said script (it says 3844 over and over) in one terminal and trying to tail ...
5
votes
3answers
5k views

How do I kill all a user's processes using their UID

I want to kill all running processes of a particular user from either a shell script or native code on a linux system. Do I have to read the /proc directory and look for these? Any ideas? Is there a ...
5
votes
3answers
2k views

Changing the UID of files in /proc

In a follow up to this question about changing the UID of a user, it is recommended to change the ownership of all files on the system (this answer) find / -uid 1000 -exec chown 5000 '{}' \+ where ...
5
votes
2answers
1k views

Notify of changes on a file under /proc

I have written a small 'daemon' in bash that will switch to the headphones if they are detected, and if not, switch to an external USB speaker with PulseAudio. What I'm looking for is some way to get ...
5
votes
2answers
826 views

Is it possible to create a directory and file inside /proc/sys?

I am running CentOS 6.2 and I need to create a subdirectory named "crypto" inside /proc/sys. Inside /proc/sys/crypto, I need to create a file named test which contains the value "1". I have tried ...
5
votes
2answers
499 views

mount options shown in /proc/mounts

IIRC then the mount options shown in /proc/mounts have changed. Some time ago acl and user_xattr were shown, now it seems that only noacl and nouser_xattr are shown if these features are turned off. ...
5
votes
2answers
804 views

iotop but for particular disk?

Is there a tool like iotop but for monitoring IO on specific volumes? (Or perhaps I missed a way to filter iotop?) If not is there any way to get at this information via (say)/proc? (dstat etc. ...
4
votes
3answers
6k views

“echo 3 > /proc/sys/vm/drop_caches” - Permission denied as root

I am currently having some issues with the cache. It is a little too much right now so I wanted to clear it. I googled and found this little command: sync && echo 3 > ...
4
votes
1answer
2k views

deleting a 'file' under /proc or /dev

I am using a cowdancer/debootstrap setup to generate a chroot. Of course, as I iterate, I generate some chroot configurations that are bad. I have found myself in an awkward situation where I have ...
4
votes
2answers
2k views

Is there an easy way to log all commands executed, including command line arguments?

I am trying to find how to log a specific instantiation of rrdtool to see whether the path it is receiving is incorrect. I know I could wrap the executable in a shell script that would log the ...
4
votes
1answer
1k views

Explain EV in /proc/bus/input/devices data

Can anybody explain to me what the EV value in /proc/bus/input/devices is? The keyboard always has value 120013. Why?
4
votes
2answers
5k views

File descriptor linked to socket or pipe in proc [duplicate]

Possible Duplicate: /proc/PID/fd/X link number i have a question regarding the file descriptors and their linkage in the proc file system. I've observed that if i list the file descriptors ...
4
votes
1answer
125 views

Does pipe's link target exist somewhere in the filesystem?

I'm talking about this: $ readlink <(echo test) pipe:[80076194] Is pipe:[80076194] a path to the target or just indication that the file descriptor is connected to the pipe and doesn't exist in ...
4
votes
1answer
2k views

What is the difference between /proc/self/stack and output from pstack?

I have been looking through the documentation for /proc and the "stack" object being a new'ish object in proc, I have also looked through the kernel commit to create it -- however the documentation ...
4
votes
1answer
77 views

What causes /proc/<pid>/* resources to become owned by root, despite the procs being launched as a normal user?

I've noticed that some procs, such as bash, have their entire /proc/<pid>/ resources readable by the user who created that proc. However other procs, such as chrome or gnome-keyring-daemon, have ...
4
votes
2answers
227 views

UUID in /etc/mtab

In some versions of Ubuntu. Disks are mounted by UUID. in My machine, /proc/mounts /dev/disk/by-uuid/UUID / ext4 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0 /etc/fstab UUID=U-U-I-D ...
4
votes
1answer
180 views

Why is UID information not in /proc/X/stat?

This is a silly question for the sake of academics; I know where to get the UID information if I need it. According to the proc(5) man page: /proc/[number]/stat Status ...
3
votes
2answers
197 views

Determining if a file system object is a procfs/sysfs/etc. “virtual file” which doesn't report its length correctly

Some kinds of pseudo-files, like many in the procfs and sysfs virtual file systems, have no file size (stat returns st_size == 0) and do not support SEEK_END in fseek. These file system objects, such ...