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

1
vote
0answers
23 views

Can I control the ThinkLight through /proc/?

Inside of /proc/acpi/ibm, I see multiple devices provided by kernel module thinkpad_acpi, x230:/proc/acpi/ibm$ ls beep bluetooth cmos driver fan hotkey kbdlight led light video volume Is ...
0
votes
0answers
13 views

Ignore child cpu when reaping (don't add to /proc/[pid]/stat cutime)

I have a program that runs 24/7 and collects resource information on a system. One of the requirements is to cause as little impact to the system as possible, so there are cpu checks to kill it if it ...
1
vote
0answers
21 views

Process in Android making UDP connection not registered anywhere

Google gms is listening on a port using UDP protocol but /proc/net/udp does not display the socket neither /proc/pid/fd displays any socket with inode(only anonpipes) anyone knows why this happens? If ...
0
votes
1answer
43 views

Why are Linux namespace links in /proc red in color?

I inspected the symlinks in an Ubuntu VM for the namespace related directories under /proc/PID/ns. I see all the links are in red color. I even tried to test using unshare to see if I can create a ...
0
votes
1answer
45 views

What units are the values in /proc/partitions and /sys/dev/block/<block>/size?

I have a sample emmc block info from an android device From /proc/partitions major minor #blocks name 179 1 5120 mmcblk0p1 Using my little intelligence I am assuming /proc/partitions ...
-1
votes
2answers
120 views

Why does a CentOS Docker container says it is Ubuntu?

I am trying to verify When choosing a Docker container image file for my Ubuntu, what do I need to match between them? On Lubuntu, a CentOS container says it is CentOS, by $ sudo docker run centos ...
2
votes
1answer
43 views

Why do I get different cpu flags in /proc/cpuinfo between CentOS 6 and CentOS 7?

CentOS 6.9 showed the following CPU flags in /proc/cpuinfo: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm ...
0
votes
2answers
93 views

Set hidepid=1 persistently at boot

I'd like my system's /proc directory to be mounted with the hidepid=1 option. I know that once the system is already up, I can do that with sudo mount /proc -o remount,hidepid=1. How can I make /proc ...
1
vote
1answer
50 views

Do all virtual files have a size of 0 in Linux?

So far, I have only seen virtual files with a size of 0, for example the virtual file /proc/sys/kernel/hostname has a size of 0. But do all virtual files have a size of 0, or are there some virtual ...
2
votes
1answer
39 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
1answer
81 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
209 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
71 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
96 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
76 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
158 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
263 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
31 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
63 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
120 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
225 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
194 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
24 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
76 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
27 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
28 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
54 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
96 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
174 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
273 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
165 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
64 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
114 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
51 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
190 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 ...
3
votes
1answer
88 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
94 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
736 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 ...
2
votes
1answer
51 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
40 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
834 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
167 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
436 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 ...
1
vote
1answer
579 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
55 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
271 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
51 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
120 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
70 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 ...