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

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Disparity between file-nr and netstat

> netstat | grep :389 | grep ESTABLISHED | wc -l 2116 > cat /proc/sys/fs/file-nr 1920 0 3178047 how can a subset of the number of tcp connections be more than the total number of file ...
soupybionics's user avatar
0 votes
1 answer
38 views

How do I determine the PID of the shell running a given pts/tty?

There are many ways to obtain the PTS associated with a given process - such as using the tty command or resolving /proc/self/fd/0 (assuming it's open and not redirected) - but what about the inverse? ...
Tenders McChiken's user avatar
0 votes
0 answers
32 views

File descriptor counts differ

There is something fundamental that I miss here, I am sure. On a system I run: cat /proc/sys/fs/file-nr 2240 0 763924 On the same system, if I do : sum=0; for pid in /proc/[0-9]*; do fd=$(ls $...
Eugene's user avatar
  • 101
3 votes
0 answers
94 views

Why isn't access to /proc/pid/mem a security vulnerability?

I've played around a bit with /proc/pid/mem and /proc/pid/maps. I wrote a simple c program that just periodically reads from a variable (whose address is written to stdout), and I was able to change ...
gypaete02's user avatar
0 votes
1 answer
59 views

Who mounts /proc and /sys in GNU/Linux systems?

If you build a custom GNU/Linux system for an embedded device, do you need to execute mount -t proc proc /proc mount -t sysfs sysfs /sys somewhere in init process or is this done automatically by the ...
mrn's user avatar
  • 149
0 votes
1 answer
71 views

sudo cannot ls root owned files in /proc

I am on Debian 12 and I am trying to write a script to identify processes with certain inodes (from /proc/net/raw and /proc/net/packet). My original grep command is this (to get only the pid itself): ...
user avatar
0 votes
1 answer
35 views

Memory total shown on Linux on 8GB memory PC is only 7038920 kB

Why linux /proc/meminfo show:" 1 MemTotal: 7038920 kB " (proc most likely is to mean Kibibyte) in a PC of 8 GB memory RAM, although its Kibibyte is 7812500 ?
user avatar
0 votes
0 answers
40 views

mount returns errno 11 when mounting /dev or /proc

Recently I tried to create a minimal linux distro, that can run only a single program. I started by compiling the linux kernel and creating the initramfs. The initramfs contains /init (compiled c ...
doc. Chocholoušek's user avatar
0 votes
0 answers
54 views

Running an application that requires read access to /proc

I'm trying to run an application that requires access to /proc in order to find the gnome-shell process and its environment variables. My guess is that this application used to work but default ...
Olumide's user avatar
  • 167
8 votes
2 answers
1k views

Should the use of /etc/mtab now be considered deprecated?

I'm curious about the file or symlink /etc/mtab. I believe this is a legacy mechanism. On every modern linux I've used this is a symbolic link to /proc/mounts and if mtab were to be a regular file on ...
Philip Couling's user avatar
1 vote
0 answers
36 views

How would you assign read-only permissions to run ls -l /proc/{pid}/fd for processes you don't own using SELinux in Android

I am developing an application on Android as a non-root user.  However, I need read access to all the /proc/{pid}/fd files so as to check the inode numbers from the symlink under fd. How do I do that ...
Mahavir Surana's user avatar
6 votes
1 answer
345 views

"Others" cannot read 'smaps_rollup' file with -r--r--r-- permission under /proc/PID/. Why?

I'm trying to read two specific files, namely status and smaps_rollup for all the processes under /proc. All process directories have dr-xr-xr-x permission and I'm able to enter every one of these ...
Firelord's user avatar
  • 342
3 votes
1 answer
71 views

zathura and ownership of files in /proc/PID

Yesterday, while writing an answer to How to get full path names of all opened pdf files (in zathura) - like rofi does, I noticed something weird about the ownership of files the /proc/PID/ directory ...
cas's user avatar
  • 77.1k
1 vote
1 answer
122 views

Accessing /proc from foreign chroot

I am trying to set up a foreign chroot environment with QEMU, mostly as described at https://www.hellion.org.uk/blog/posts/foreign-chroots-with-schroot-and-qemu/. The host system is Ubuntu x86_64 (on ...
user149408's user avatar
  • 1,125
0 votes
0 answers
28 views

Why Linux kernel randomness is limited? [duplicate]

Why linux kernel has limited size of entropy. If you run cat /proc/sys/kernel/random/poolsize you get 4096. What is that "magic" number and why can't the randomness of the kernel increase ...
user561594's user avatar
2 votes
0 answers
146 views

How can I find out what changes the value in /proc/sys/kernel/sysrq?

For some reason the value stored in the /proc/sys/kernel/sysrq file on my system changes to 16. It happens quite frequently, like once-twice an hour but in a random moment of time. As I understand, I ...
GRbit's user avatar
  • 21
1 vote
0 answers
94 views

Why is there more `time_wait` displayed in `sockstat` than it actually is?

Why is there more time_wait displayed in /proc/net/sockstat than it actually is? And how to fix it? [root@node09 ~]# netstat -ant | grep TIME_WAIT | wc -l 28 [root@node09 ~]# netstat -ant|awk '/^tcp/ ...
LiangZheng's user avatar
0 votes
1 answer
189 views

How Do Logs Get From "Kernel Ring Buffer" to "/proc/kmgs" and "/dev/kmsg"?

I can not get any reliable information about how do kernel logs get from Kernel Ring Buffer to /proc/kmgs and /dev/kmsg. Is there any source I could have possbily missed or does perhaps anyone know ...
GabrijelOkorn's user avatar
0 votes
0 answers
87 views

What does it mean when /proc/[PID]/stat instruction pointer is zero?

I am trying to retrieve the instruction pointer of some process on an Oracle Linux operating system. According to the man page of proc filesystem the 30's field of the stat file holds this value: (30)...
joepol's user avatar
  • 101
3 votes
2 answers
1k views

What does the SPID abbreviation stand for?

The ps command with the -T flag outputs the SPID column, which is also called TID(Thread ID). But what does SPID stand for? The ps source code doesn't seem to know why this name is either: trace("...
deevroman's user avatar
0 votes
1 answer
159 views

Output text file contents (/proc/interrupts) as they change [duplicate]

Is there some command I can use to monitor changes in /proc/interrupt? For example, using head -4 I can see that the file is changing, but only if I run head again and again: > head -4 /proc/...
emacs drives me nuts's user avatar
0 votes
1 answer
64 views

Setting file contexts on /proc files

I want to restrict access to files in /proc as much as possible using SELinux. When I try to chcon a directory in /proc, it fails: $ chcon -t staff_proc_t /proc/acpi chcon: failed to change context of ...
jiwopene's user avatar
  • 1,022
0 votes
0 answers
102 views

Why would the mount command not detect file systems reported as active in /proc/mounts?

cat /proc/mounts shows that the file systems in question are active. Running mount --fake --all --verbose shows successfully mounted instead of already mounted meaning that it wasn't detected as ...
user658182's user avatar
0 votes
0 answers
118 views

How do you map a pointer location to /proc/self/{map,mem}?

I am trying to write a light weight test to determine if sensitive parameters are getting zero'd in active memory after use. Here is what I thought would work: Get the pointer location of the ...
Liam Kelly's user avatar
0 votes
1 answer
339 views

How to dump the stack and heap of a running application to determine if zeroization is occuring?

I am trying to ensure that after the use of sensitive parameters, a program zero-es them from all active memory (stack and heap). The simple test I was hoping to perform was to dump the active memory ...
Liam Kelly's user avatar
4 votes
1 answer
701 views

What mechanism prevents me from reading /proc/<PID>/environ in containers with a PID namespace shared with the host?

While investigating sharing the PID namespace with containers, I noticed something interesting that I don't understand. When a container shares the PID namespace with the host, some processes have ...
Dejan Zelic's user avatar
2 votes
0 answers
113 views

Java threads and /proc/ directory on linux

I have a Java program that uses a pool of worker threads, that execute the work. These threads are dynamic, so the program creates and removes threads dynamically. The thread is running while a ...
Tom Eeraerts's user avatar
4 votes
3 answers
1k views

is it safe to do chmod 640 /etc/passwd /etc/group?

I want to prevent users being able to see other system users. I've prevented listing of processes with hidepid=2 mount option to /proc, prevented listing of other users' home directories, but they can ...
Tomasz's user avatar
  • 87
3 votes
1 answer
176 views

Binary format of IPv6 loopback address

In one terminal, I ran $ nc -l -6 ::1 5000 In another terminal, I ran $ cat /proc/net/tcp6 and saw this line: 0: 00000000000000000000000001000000:1388 00000000000000000000000000000000:0000 ... ...
Daniel Walker's user avatar
1 vote
0 answers
153 views

Safe to write to /proc/self/fd/N

Is it safe to write to /proc/self/fd/N where N is any file descriptor owned by the process. My use case is to ssh into a remote machine and cat many remote files to local files. The local files were ...
user138645's user avatar
1 vote
1 answer
244 views

Number of open sockets in /proc/pid/fd does not agree with netstat

I'm running into a weird socket issue when running my own crawler. It opens and cloees a lot of TCP sockets rapidly due to the protocol design. It's something I have to live with. I'm very sure in ...
Mary Chang's user avatar
8 votes
1 answer
734 views

How does /proc interact with PID namespaces?

I do not understand how namespaces interact with /proc. I assumed that /proc returns values based on the process that queries them. For example, let's determine the PID of the current process inside ...
Georg Schölly's user avatar
-1 votes
1 answer
1k views

file /proc/kcore took up all free space in the system and and it won't let you install programs

I have Kali linux OS. When I try install dkms I have got this: └─# sudo apt install dkms Reading package lists... Done Building dependency tree... Done Reading state information... Done The following ...
Dmitriy Ogureckiy's user avatar
2 votes
0 answers
47 views

Overlapping address ranges in /proc/.../maps

On some Android devices (possibly only on Android 10 and newer), looking at /proc/self/maps, I observed entries like the following two lines: 79cfd4d000-79cfff5000 --xp 0012e000 fd:00 286 /apex/com....
David Scherfgen's user avatar
1 vote
1 answer
3k views

Why is VmallocTotal 34359738367 kB?

/proc/meminfo has a memory statistic VmallocTotal. It is described as Total size of vmalloc memory area. in proc's man page and elsewhere as Total memory available in kernel for vmalloc allocations ...
Arthur Tarasov's user avatar
3 votes
2 answers
1k views

What do the permissions mean in /proc/<pid>/fd/?

I'm looking at the result of running ls -l on /proc/<pid>/fd/: lr-x------ 1 root root 64 Apr 22 23:13 0 -> /dev/null lrwx------ 1 root root 64 Apr 22 23:13 1 -> 'socket:[19700]' lrwx------ ...
Daniel Walker's user avatar
2 votes
1 answer
291 views

How to get NSPid on kernel 3.10

In kernel 4.1 and above, /proc/[pid]/status contains these 4 lines: NStgid: 1 NSpid: 1 NSpgid: 1 NSsid: 1 This allow a process in parent namespace to know about that process' PID in all namespaces. ...
yoru's user avatar
  • 23
0 votes
1 answer
38 views

Kernel option in /sys change

If /proc/sys and /sys are the same, can I change the kernel options in /sys not in /proc/sys? If not, why?
quber's user avatar
  • 65
1 vote
1 answer
779 views

Linux: difference between "/usr/bin/env" and "/usr/bin/strings /proc/$$/environ"

I am learning about linux and I have a question that I have encountered in one of the books I read: The following are two different ways to print out environment variables. Please describe their ...
linuxbeginner's user avatar
1 vote
3 answers
950 views

Given we have the API /proc/pid/status should/could /proc/pid/stat be deprecated?

I have a few questions about the process information avaiable in GNU/Linux via procfs. This was originally prompted by a desire to extract vmPeak, vmSize, vmRSS & vmHWM from within an application....
Bruce Adams's user avatar
0 votes
1 answer
4k views

/proc won't mount in kali linux running under Android

I'm now using kali Linux on termux. I had several problems like /proc is not mounted, /proc permission denied, etc. ps -auxtells this: > root@localhost:~# ps -aux > > Error: /proc must be ...
Mus_90YT's user avatar
0 votes
1 answer
590 views

How can `cat` read a file without a file descriptor?

I'm learning Linux procfs, which utilizes a virtual file system where operations like open, read, write, and release are processed by functions registered to it. I've left the open and release to null ...
victrid's user avatar
  • 183
0 votes
1 answer
1k views

How to find the amount of time a process spends in user mode or kernel mode

I read through the docs for cat /proc/pid/stat It displays many numbers. The process I am calculating this for is running in an infinite loop. So the values will keep on changing. I see that there is ...
rohit's user avatar
  • 1
-1 votes
1 answer
238 views

Modify the number of interruption cat /proc/interruption

As you can see, when running the command cat /proc/interrupts, in the second column the number of interrupts delivered to each CPU per device driver. test@test:~$ cat /proc/interrupts CPU0 ...
Mahmoud Kallel's user avatar
0 votes
1 answer
293 views

Programmatically ascertain aspects of socket file

I'm trying to write a program (in C) which, as one of its features, walks the procfs to find open sockets and ascertain things like the destination/source ports/addresses (similar to what netstat and ...
Daniel Walker's user avatar
1 vote
1 answer
380 views

from where htop collects IO read/write data for one current user proccess without root?

I cant find a way to capture htop output for a single process about IO_RATE IO_READ_RATE IO_WRITE_RATE. I need it (the last few seconds IO (or just 1s), not the overall accumulated IO) to determine if ...
Aquarius Power's user avatar
0 votes
3 answers
1k views

How to change /proc/*/environ of a bash shell

This is the shell's PID: nathan@guixlaptop ~ $ $$ bash: 10984: command not found I export an environment variable: nathan@guixlaptop ~ $ export TESTVAR=test The variable is not found in the shell's ...
Gooberpatrol66's user avatar
0 votes
2 answers
635 views

What PSI cpu full means?

I've found two articles about PSI, and both of them say that cpu has only "some" metric. atop shows only "cpu some" too. But my system has "cpu full" metric: $ cat /proc/...
magras's user avatar
  • 101
0 votes
1 answer
325 views

Where in the filesystem can I get metadata about a socket?

I know lsof and ss provide metadata about connections. Where do they get it from? For example, this represents a connection: ls -al /proc/102922/fd/98 lrwx------ 1 me me 64 dic 21 06:06 /proc/102922/...
user717847's user avatar
2 votes
2 answers
385 views

Format the output of "read_file uptime" in i3status

I'm trying to display my system uptime with i3status. This is what I have in my i3status.conf file: read_file uptime { format = "%title: %content" path = "/proc/uptime" } ...
Zsargul's user avatar
  • 81

1
2 3 4 5
11