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

2
votes
1answer
28 views

Why does reading /proc/net/tcp take a long time ss is quick to return the same sort of data about the connections table?

On Linux 2.6.32, if you read (for example, cat) /proc/net/tcp, on a very loaded system (for example, a web server), you will find that reading 100K entries takes over 30 seconds. That's a long time. ...
4
votes
1answer
3k views

Accounting for /proc/net/dev reported traffic

I noticed that according to /proc/net/dev I am constantly receiving around 6Kb/s on my wireless usb interface. But I can't account for anything even close to that with the individual connections that ...
2
votes
2answers
48 views

When does a new system call get added to Linux?

When exposing kernel functionality, there are several alternatives for kernel developers. They can either create a new system call or expose the functionality through /sys, or /proc entries. Is ...
1
vote
1answer
333 views

How to get UID and PID

So here's what I want to do: User inputs a USERNAME. Based on this username, I need to get the list of processes started by this user. I am planning to do this by getting the UID of this user and ...
45
votes
4answers
16k views

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 ...
1
vote
0answers
44 views

sar command vs /proc/stat for cpu usage

I have been using /proc/stat for calculating the cpu usage. Recently I have been going through sar command for calculating cpu usage. And what I found was that their values were not related (I was ...
2
votes
2answers
44 views

Incorrect permissions on special files

I've noticed a lot of special files on Linux have what appears to be incorrect permissions: E.g.: $ ls -l /dev/fuse crw-rw-rw- 1 root root 10, 229 May 29 09:59 /dev/fuse appears writable but in ...
0
votes
0answers
19 views

Strange PFN read from pagemap

I m trying to find the physical page to which a range of virtual addresses are mapped in a piece of C code that I ve written. I m using the /proc/self/pagemap to read the mapping. I ve used the code ...
1
vote
2answers
31 views

Getting the original command invocation from /proc/self

I'm trying to run some startup code in all procesess via the dynamic linker. The code should do stuff based on the zeroth argument of the process. I'm getting the arguments from /proc/self/cmdline (...
1
vote
1answer
31 views

How to obtain counters for swap-in/swap-out on Linux?

I'm trying to obtain counters for swap-in/swap-out activity on CentOS 6. The intention is to feed raw data into RRDtool to generate graphs, and use it to generate alerts. I've had a look at common ...
0
votes
1answer
32 views

How to manipulate a file descriptor in another process? [duplicate]

Is there any way to manipulate (read, write, etc..) a file descriptor for any app which can be found in the path /proc/{pid}/fd? Especially for sockets. $ ll /proc/4229/fd total 0 lrwx------. 1 ...
2
votes
1answer
45 views

How to find the pci slot of an usb controller in Linux?

I have a nearly common Linux machine here. So, it has a PCI (*-X, etc) bus, on that some USB controllers, and I have USB devices on these USB controllers. Similar to this: $ lspci|grep USB 00:12.0 ...
16
votes
4answers
749 views

Why some shells `read` builtin fail to read the whole line from file in `/proc`?

In some Bourne-like shells, the read builtin can not read the whole line from file in /proc (the command below should be run in zsh, replace $=shell with $shell with other shells): $ for shell in ...
0
votes
4answers
893 views

How to get hard disk information from /proc and/or /sys

How can I get hard disk capacity, usage, etc. using the /proc or /sys filesystems? If it is possible, please tell me which file(s) I need to process to get that information.
0
votes
2answers
23 views

Is sysfs a strict subset of procfs? [duplicate]

Is the information that the Linux kernel provides to the user via sysfs a strict subset of the information that the Linux kernel provides to the user via procfs? If not, then which information is ...
2
votes
1answer
47 views

why do I find (under /proc/pid//fd) sockets with broken symlinks

I don't think they're closed, because I would expect that after a close() the fd would disappear, but I see a bunch of lingering fd -> socket[xxxxx] entries with broken symlinks which don't seem to be ...
4
votes
1answer
49 views

How does Linux decide the /proc/PID/stat “name” of a process?

Currently my machine has 5 processes running scripts through python, but Linux thinks only 2 of them have the name python (according to /proc/$pid/stat). That is, pgrep -af python shows: 1784 /usr/...
5
votes
1answer
618 views

What is the meaning of the contents of /proc/net/unix?

On my Android device there is the file called /proc/net/unix who's content does not conform to that of any standard linux distribution (which show the unix domain sockets.) First few lines: Num ...
8
votes
2answers
2k 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 ...
1
vote
1answer
43 views

Duration of /proc/pid/stat

I have a process that starts a child process and when the child exits, scans /proc/<pid>/stat to gather some information about the CPU and memory the child used. However I am worried that I am ...
1
vote
1answer
52 views

Get the process start time irrespective of NTP updates

I'm trying to record the start time of a process kicked off by an @reboot cronjob. I'm using ps -p $$ -o ltime= presently, but I've run into a catch. My machine (a Raspberry Pi) connects to the ...
0
votes
0answers
70 views

How to get the path of a current running script file?

Knowing that program's PID, I want to list out the executable file of a running program. For binary programs, I can read /proc/$pid/exe, which is a symlink to the executable. However for scripting ...
2
votes
0answers
37 views

OOM Killer: Processes have a score of over a 1000

All top links when Googling for OOM score seem to indicate that the values must be between -1000 and 1000. I tried to verify that with a simple cat /proc/*/oom_score | sort -n | less and I ...
1
vote
3answers
51 views

Get Linux architecture from /proc filesystem

I'm writing a program in Java and I need to determine the architecture for which Linux was compiled. I need something like uname -m, but without running any program, but instead from the /proc pseduo-...
-1
votes
1answer
20 views

du access failures

I ran du on a particular machine and two instances of failure: Since I ran as superuser I do understand how I can get denied. Second problem was with the proc tree: I kind of get the gist of why ...
1
vote
1answer
55 views

How can I check read permission of /proc/*/* files?

Files in /proc/ seem to be world-readable, but return permission denied: $ ls -lh /proc/5589/smaps -r--r--r-- 1 root root 0 Mar 18 13:11 /proc/5589/smaps $ cat /proc/5589/smaps cat: /proc/5589/...
0
votes
1answer
3k views

Linux ps -elf command output, what is Process Flag meaning?

In output of ps -elf command in linux, we can recognize that process flag of 4 and 1, and process flag of 5, (sum of 1 and 4), but what is meaning of process flag 0 ? unfortunately, man does not help ...
2
votes
2answers
54 views

Can I add to /proc/self?

I want to create a number of named memory regions in my program, and mmap them somewhere so that other processes can read them. I can't guarantee that only one instance of my program will run at a ...
1
vote
1answer
62 views

Why doesn't INotify work with `/etc/mtab` or `/proc/mounts`? [duplicate]

When I used INotify with /etc/mtab or /proc/mounts, it doesn't detect changes when things mount or unmount, even though /etc/mtab and /proc/mounts both have changed when I check manually. Why is this, ...
4
votes
1answer
289 views

/proc/net/wireless does not show values unless run as root

cat /proc/net/wireless does not show statistics for wireless devices unless it is run as root, even though the permissions on the file are 444. The same seems to apply when accessing statistics via ...
2
votes
2answers
40 views

Can I set my core file location without being root?

It seems strange that I need to be root in order to say "place cores in my current directory" (via cat whatever /proc/sys/kernel/core_pattern). Isn't there any user-specific override for this?
0
votes
2answers
75 views

Awk run time error: not enough arguments passed

Here is the script: TYPE="${BLOCK_INSTANCE:-mem}" awk -v type=$TYPE ' /^MemTotal:/ { mem_total=$2 } /^MemFree:/ { mem_free=$2 } /^Buffers:/ { mem_free+=$2 } /^Cached:/ { mem_free+=$2 ...
0
votes
3answers
71 views

Why would the size of /proc/stat show as zero? [duplicate]

ls -rlth /proc/stat -r--r--r-- 1 root root 0 Feb 21 04:25 /proc/stat Although if we cat it, its got enough contents. Any help regarding this virtual FS will be helpful.
3
votes
1answer
43 views

Meaning and usage of /proc/[pid]/make-if-fail

I am currently developing inside an embedded Linux environment (kernel 3.10.0), and while goofing around in the procfs mount of the system I found that all processes present the following file in ...
2
votes
1answer
55 views

Linux Unix /proc Rename

How can I rename /proc to something else forcefully? mv /proc /0 gives mv: cannot move ‘/proc’ to ‘/0’: Device or resource busy
3
votes
2answers
80 views

How to find out the reason why ssh processes are hanging?

When I run command like iostat -dkx 2 2 via ssh, I get the expected result, but the processes on the local computer are saying alive in status "interruptible sleep". Why is this happening? Is there a ...
0
votes
1answer
77 views

Convert meminfo kB to bytes [duplicate]

To convert the readings in /proc/meminfo from "kB" to bytes, should I multiply by 1024, or 1000?
4
votes
1answer
183 views

Does /proc/[pid]/status always use kB?

Particularly, does proc always list the VmRSS value in kB? I can't find a solid answer on the documentation, although it appears that it sticks to one unit.
1
vote
0answers
154 views

Viewing shared segments created by shmget

I'm trying to "visualize" shared memory between two processes. I've created a little server-client example where the client writes some data to a shared memory location and the server reads from it. I'...
1
vote
1answer
76 views

Encoding of /proc/<pid>/cmdline files

I am thinking about working with the /proc/<pid>/cmdline files, but I couldn't find any documentation about the file encoding. The only piece of information I could find is located in the man ...
1
vote
1answer
109 views

Why is the size of “/proc/kcore” file so bigger than the physical memory size?

From proc manual: /proc/kcore This file represents the physical memory of the system and is stored in the ELF core file format. With this pseudo-file, and an unstripped kernel (/usr/src/...
2
votes
2answers
248 views

Is there any way to hide kernel threads from ps command results?

When I type ps -ef , there are lots of special kernel thread processes showing. I am not interested in kernel threads; I am only interested in user process/thread. Is there a way that I can hide the ...
1
vote
2answers
67 views

Recover from faking /proc/meminfo

So, without really thinking too much, I ran this script: #!/bin/bash SWAP="${1:-512}" NEW="$[SWAP*1024]"; TEMP="${NEW//?/ }"; OLD="${TEMP:1}0" sed "/^Swap\(Total\|Free\):/s,$OLD,$NEW," /proc/meminfo &...
1
vote
1answer
307 views

cannot read key “net.ipv6.conf.all.stable_secret” in sysctl?

I am running kernel version as followings on an Arch Linux computer: [root@router ~ ]$ uname -a Linux router 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015 and I noticed that every time ...
0
votes
0answers
19 views

This name appears in multiple /proc/interrupts

The name of the interrupt appears as follows: Multiple.. (85:exynos4210-uart) root@test:~# cat /proc/interrupts CPU0 CPU1 CPU2 CPU3 28: 3543629726 1086578047 3268216812 ...
3
votes
1answer
4k views

The amount of time since the system was last booted [duplicate]

I have used both uptime and cat /proc/uptime commands. I know the idle time in the later can be greater than running time (multiprocessors). However, when I add both running and idle times, and ...
26
votes
7answers
107k 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 ...
1
vote
2answers
1k views

How can I wake a process from sleep status via signal or /proc?

Many years ago I had an issue with Linux where processes would randomly go to sleep. Back then, I knew a trick with the /proc filesystem to trigger a wakeup of the process. I vaguely remember being ...
0
votes
0answers
22 views

fsync () get the impact of road /proc/sys/vm/drop_caches?

I have been testing the service life of TLC(1000write) SD card (4GB). SD card has been formatted with a fat partition. I am a write (), fsync () on a file of 10M SD card repeatedly. 1st (10M): ...
94
votes
4answers
63k 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 /proc/self/...