Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

2
votes
1answer
23 views

How long time does a context switch take in Linux (ubuntu 18.04)

I'm interessted in getting the number of context switches a two processes in a KVM vm takes on a singel CPU over some time. Earlier i have used perf, is this best practice? And how much time is used ...
0
votes
0answers
52 views

How to read all background processes from /proc directory? [migrated]

I want to get a list of all background processes running in the OS. job command does the work. But I am using C to do the task. The main problem is, how to distinguish background processes from the ...
0
votes
1answer
53 views

How should we understand symlinks under `/proc/pid/fd`?

They seems more like a link to inode instead a link to path. What does the readlink() mean to them, the canonical path of the inode from the calling process's root directory? What happened when a ...
0
votes
0answers
85 views

How do i capture /proc/<pid>/stat file of a process | linux kernel

As you may know, the /proc/stat file contain the numbers of ticks the different CPU's have spent their time. Same goes to /proc/pid/stat where the tics are measured based on pid (process id) But when ...
1
vote
1answer
29 views

Memory usage info in /proc/pid/status missing when program is about to terminate

In order to track my program's memory usage, I wrote a script that records /proc/pid/status every 0.01 seconds and extracted memory usage from it. I checked most of the records and everything was fine,...
2
votes
1answer
46 views

lsof versus /proc/$PID/fd versus ulimit -n

I am trying to find the reason why my long-running app sometimes busts the maximum open file descriptor limit (ulimit -n). I would like to periodically log how many file descriptors the app has open ...
0
votes
1answer
54 views

Whould someone explain procstat output memory information?

I use the command procstat -r $(pidof myprocess) and I get the following output... PID COMM RESOURCE VALUE 84867 myprocess user time 00:...
0
votes
1answer
85 views

Why is the sum of /proc/pid/stat CPU greater than /proc/stat

In /proc/<pid>/stat I add user cpu, system cpu, child user and child system cpu together for all processes. I take a delta from a previous sample. Immediately after I sum the user, nice and ...
2
votes
1answer
76 views

reading TCP connection list from /proc

I'm trying to implement code that enumerate all existing TCP connections per process (similar to netstat -lptn). I prefer to implement it myself and not to rely on netstat. In order to do that, I'm ...
0
votes
1answer
25 views

How to get informations on each type of filesystem in /proc/filesystems

How do we get detailed information (history, what is used for, etc.) on each filesystem or pseudo filesystem displayed by : cat /proc/filesystems Example : nodev, sysfs, rootfs, ramfs, bdev, proc , ...
0
votes
1answer
56 views

Which files in `/proc` provides the following information?

From https://unix.stackexchange.com/a/492346/674 Kernels such as Linux and the kernels of the BSDs provide four (relevant) pieces of information about a process, via files in /proc and sysctl():...
1
vote
2answers
83 views

Where is the network data is stored on linux system?

is there a way I can find information about my wifi connections? Which networks I was connected to and when? I had tried to look for this information under proc/net but found nothing. (To be more ...
0
votes
2answers
131 views

Why /proc/meminfo shows MemAvailable under Kernel Version 3.10?

I've been using CentOS 7 and its kernel version is 3.10. To check Kernel Version, I typed 'uname -r' and command showed 3.10.0-957.1.3.el7.x86_64 As far as I know, MemAvailable metric was introduced ...
0
votes
0answers
94 views

Send string to another process stdin [duplicate]

Example process waiting an input sent to background $ read -p "Input text and hit ENTER to exit" & I try to write to stdin (fd/0) with \n $ echo -e "ok\n" > /proc/$!/fd/0 but $ fg read -p ...
2
votes
0answers
23 views

How to read information about wifi connection from proc - net? [duplicate]

Is there a way I can get information about my current WiFi connection on my android? Information like the name of the WiFi network, connection start time, connection duration etc.? I looked inside ...
0
votes
2answers
65 views

Is reading /proc repeatedly expensive?

Since the contents of /proc live inside memory, how expensive is reading it's content repeatedly (every second for example)? And does a program like top, htop or atop do that (reading /proc in every ...
2
votes
1answer
23 views

Why the output of ls is different for the same directory /dev/fd/ based on the method of referencing this directory?

cd /dev/fd/; ls Gives me output that I expect: 0 1 2 255 But: ls /dev/fd/ Gives different output that I don't expect: 0 1 2 3 Why? What happens here? What happened to file descriptor 255? ...
0
votes
1answer
21 views

How to measure the usage of disk cache?

Load Average itself is not very informative about the reasons of overload, so I want an additional characteristic: the percent of disk read operations that are done from cache. To measure it, I ...
1
vote
1answer
47 views

how does a non existing sid/pgid process possible?

I've listed processes on Ubuntu 17.04, Noticed the following process: root@user-virtual-machine:~# ps xao pid=,ppid=,pgid=,sid= 1603 1 1601 1601 however process 1601 does not exist. root@...
0
votes
1answer
93 views

Does constant writing to “files” in `/proc` or `/sys` reduce the life of my SSD due to its limited number of writing cycles?

My laptop has a SSD drive and I run a script which writes every other second to /sys/class/thermal/cooling_device4/cur_state. I don't think this would count as writing to the SSD and thus reducing its ...
0
votes
2answers
108 views

How to namespace the ps command?

I am trying to understand how linux containers work internally. One of the things that I have learned is that you can containerize a shell by passing in special flags to it. Out of the flags one is ...
0
votes
1answer
172 views

How to take number of bytes transmitted and received from /net/proc/dev

I want to take the number of bytes transmitted and received from /proc/net/dev in this format: num_ofbytesTransmitted,num_ofbytesReceived. This was my approach: cat /net/proc/dev | grep enp0s3 | cut -...
1
vote
1answer
94 views

Can you edit address values in “/proc/$pid/mem” to reflect changes in that process?

I would like to see if I can edit a value in my program while it is running by directly changing the memory. My thought process (untested) is to do the following: Run the program. Open up "System ...
1
vote
0answers
44 views

Why would strace and /proc/pid/stat show a process taking no CPU time, despite the process doing work?

Have a long-lived process (couple months) that is handling a huge number of connections and doing work, yet most statistics on it show it doing zero work. Here's an strace output, showing a bunch of ...
0
votes
2answers
71 views

In /proc/meminfo, does Dirty include or exclude Writeback?

Dirty %lu - Memory which is waiting to get written back to the disk. Writeback %lu - Memory which is actively being written back to the disk. -- man proc Does Dirty include Writeback? Or ...
1
vote
0answers
44 views

Allow a regular use to write in /proc/sys/net/ipv6/conf

I am using a fairly cheap VPN service in my Xubuntu 18.04 (VPN created using OpenVPN) and, as many other VPN services, is leaking my IPv6. I thought that maybe, since OpenVPN can run a script when it ...
1
vote
1answer
127 views

With Linux user namespaces, why can clone() mount /proc, but unshare() cannot?

I am trying to get a non-root user to mount /proc in a Linux user namespace. If I create a namespace via clone(), then I can mount /proc. However, if I create a namespace via unshare(), then the ...
2
votes
1answer
60 views

Uptime command misconception with suspend and resume states

The definition for uptime is "Tell how long the system has been running." but if you change your system power state to suspend or resume: # uptime 09:50:33 up 8 min, 2 users, load average: 0,24, 0,...
3
votes
1answer
90 views

Get latest output of a running command

I have a command running for a long time, which I don't want to disturb. However, I would like to keep check on the process (most of the time remotely). I am constantly monitoring the process via ...
2
votes
2answers
529 views

How to remount special device proc which does not exist?

I did this: root# mkdir /tmp/test && mount --bind /tmp/test/ /proc/ root# rm -rf /tmp/test root# mount -t proc proc /proc But then I ran into this: mount: special device proc does not ...
1
vote
1answer
47 views

Can I assume /proc will always be readable?

I'm developing a script that will monitor several machines, notably by reading from /proc/[vmstat|stat|diskstats|net/dev] and I'm wondering if I can assume those will always be accessible and readable ...
0
votes
1answer
36 views

Set Linux system time to time from /proc/version

What sequence of awk, sed, and/or cut commands can I use to take the date at the end of /proc/version, for example Linux version 4.15.7 (user@system) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+...
2
votes
1answer
502 views

What is proc/ directory in Ubuntu Server [closed]

I am navigating one of my Ubuntu servers and was wondering what the numbers 1-26758 are under the proc/ folder. Are these ports or something else?
7
votes
2answers
156 views

“find” exclude by fstype strange behavior

I try to have "find" command exclude "/proc" filesystem. I would prefer a portable solution to be able to use it on non GNU based hosts (oldest AIX for instance, where "find" do not have the "-path" ...
0
votes
1answer
353 views

display the file descriptors of a process using python [closed]

How can I display the open file descriptors of a process in linux using python script? I tried using readlink /proc/PID/fd/* in python script but I am getting error. /bin/sh: 2: /fd/*: not found ...
0
votes
1answer
371 views

What is the meaning of the connection state constants in /proc/net/tcp?

I'm creating a parser for /proc/net/tcp, and I would like to know what are all the possible constants for the connection states (fourth column)? I know 0A means LISTENING, but Google results don't ...
1
vote
0answers
54 views

Why is the output of top command not the same as /proc?

Sometimes I see the output of top output like this But when I try to access /proc, it gives me different information, like this Why do I see different session ID from top and /proc?
0
votes
1answer
203 views

Diff outputs “binary files <file1> <file2> differ” but not the usual detail output

I would like to compare two files - "orienv" and "currenv", using the command diff. The way I had created the two files was as follow: Createing the "currenv" file $cat /proc/1/environ >> ...
1
vote
0answers
28 views

Can I somehow identify the physical machine from inside an OpenVZ container?

I am using some VPSes in OpenVZ containers. As I can see, our hosting provider somes moves them between his physical machines. It also means unwaited (and unexpected) reboots. I have no technical ...
1
vote
1answer
42 views

Why I can't see port opened by a process in file descriptors?

I have a rabbitmq management process running, which opens a port 15672, tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN 5431/beam As you can see the process has a PID ...
7
votes
1answer
104 views

Strange behavior of `/proc/self/environ` in some shells; what is going on?

I'm on Debian GNU/Linux 9. I know /proc is special, I know what /proc/self is. This command sh -c '/bin/cat /proc/self/comm - </proc/self/comm' yields cat sh The pattern will be similar if I ...
0
votes
2answers
64 views

Why does shebang lead to a different process name than an explicit call?

Summary Using mirage as an example, a python program that begins with a shebang: #!/usr/bin/python ... Looking at /proc/<pid>/comm or using pgrep, it appears like ... ... the process name ...
0
votes
1answer
309 views

/proc/PID/sched measure units

Does anyone know what are the measurement units for the metrics in /proc/<PID>/sched file in Linux? cat /proc/1277/sched flush-202:32 (1277, #threads: 1) ----------------------------------------...
2
votes
2answers
1k views

What are anon_inodes?

While looking through /proc/[PID]/fd/ folder of various processes, I found curious entry for dbus lrwx------ 1 root root 64 Aug 20 05:46 4 -> anon_inode:[eventpoll] Hence the question, what are ...
0
votes
1answer
168 views

Is /proc folder and process details really exists on hard drive [duplicate]

I am a little bit confused about /proc directory. Each process frequently updating its state, memory info, progress etc in their process. My question is that the /proc directory keeps the memory or ...
0
votes
1answer
357 views

Where to find iowait stat for a single process (as a file)

I am writing a script and I need to find a file in which statistics for a single process/pid/service's iowait are stored. Is there any such file at all on Debian-based distributions? Nor /proc/<...
0
votes
0answers
255 views

Why is cat /proc/[pid]/pagemap not giving any output?

When I use the command cat /proc/<pid>/pagemap, I'm not getting any output. Usually I used to get some binary output but now I am not getting anything. The output starts coming after an hour ...
1
vote
1answer
53 views

How to remove sshd pts processes in status D without restarting servers

Why are these sshd-pts processes stuck in status D? It seems the system load averages are increasing due to these processes. How can I remove them without restarting my server. (add ppid and etime) [...
0
votes
0answers
253 views

Measuring block I/O delays using proc FS

I'm trying to measure IO delay due disk access. For this I'm using delayacct_blkio_ticks from /proc/[pid]/stat response. What I'm getting is a constant 0, no matter how much IO is done in my app. The ...
17
votes
2answers
4k views

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-...