Questions tagged [proc]

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

The proc filesystem is a filesystem that presents information about running processes. It is available under many Unix variants including Solaris, Linux and AIX, but is absent on most BSD variants. On Linux, the proc filesystem exposes other system data as well.

The proc filesystem is normally mounted at /proc, and information about a process is presented in a file or directory named after the process ID, e.g. /proc/123 presents information about process 123.

Further reading

External resources

532 questions
168
votes
6 answers

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 /proc/self/mem cat: /proc/3065/mem: No such process cat:…
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
101
votes
6 answers

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 dynamic mapping of the pids under UIDs in Linux?…
user489152
  • 1,113
  • 2
  • 9
  • 6
90
votes
3 answers

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?
slm
  • 363,520
  • 117
  • 767
  • 871
85
votes
4 answers

What is the difference between procfs and sysfs?

What is the difference between procfs and sysfs? Why are they made as file systems? As I understand it, proc is just something to store the immediate info regarding the processes running in the system.
Navaneeth Sen
  • 9,369
  • 17
  • 58
  • 65
76
votes
7 answers

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 hitting 0 space only noticed when my editor couldn't…
Marcos
  • 2,275
  • 2
  • 23
  • 32
75
votes
1 answer

How do I find out more about socket files in /proc/fd?

Looking in /proc/$mypid/fd/, I see these files lrwx------ 1 cm_user cm_user 64 Oct 14 03:21 0 -> /dev/pts/36 (deleted) lrwx------ 1 cm_user cm_user 64 Oct 14 03:21 3 -> socket:[1424055856] lrwx------ 1 cm_user cm_user 64 Oct 14 03:21 4 ->…
benhsu
  • 905
  • 1
  • 6
  • 5
69
votes
6 answers

Which process is `/proc/self/` for?

https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s3-proc-self.html says The /proc/self/ directory is a link to the currently running process. There are always multiple processes running concurrently, so which process is "the currently…
Tim
  • 98,580
  • 191
  • 570
  • 977
46
votes
3 answers

What is the difference between "all", "default" and "eth*" in /proc/sys/net/ipv[46]/conf/?

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 look like this: iserv ~ # ll…
Martin von Wittich
  • 13,857
  • 6
  • 51
  • 74
46
votes
7 answers

"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 > /proc/sys/vm/drop_caches. I am logged in as root over SSH (not using sudo). These…
BrainStone
  • 3,534
  • 12
  • 32
  • 53
45
votes
3 answers

How to get the IPV4 address for an interface from /proc

Is there a clean, simple way to get an IP address for a network interface from /proc, similar to the way I can get the MAC address for a network interface? Ideally I would just type cat /proc//{interface_name} and get the IPv4 address. I'd…
razeh
  • 569
  • 1
  • 4
  • 4
44
votes
3 answers

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 of a long-running batch job without killing it.
Marcos
  • 2,275
  • 2
  • 23
  • 32
40
votes
2 answers

/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 00:05 2 -> pipe:[6839] lrwx------ 1 user user 64 Mar…
Thanatos
  • 897
  • 1
  • 6
  • 17
37
votes
2 answers

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)?
samarasa
  • 657
  • 1
  • 6
  • 10
37
votes
2 answers

When was a process started

To know when was a process started, my first guess was to check the time when /proc//cmdline was written/modified the last time. ps also shows a START field. I thought both of these sources would be the same. Sometimes they are not the same.…
Swair
  • 691
  • 1
  • 7
  • 10
34
votes
2 answers

What does the "bugs" section of /proc/cpuinfo actually show?

On a Debian Stretch and testing/Buster system with a current kernel and installed microcode I still see meltdown and spectre listed as bugs in /proc/cpuinfo. However, running the spectre-meltdown-checker shows not vulnerable. So I'm wondering what…
hurrbert
  • 341
  • 1
  • 3
  • 3
1
2 3
35 36