Questions tagged [lsof]

Unix command that lists the files, sockets, and other file-descriptors that processes have open.

236 questions
0
votes
1 answer

Postgres database port 5432. Is it connecting to the internet?

I am a newbie to connections. I ran the following command on my ubuntu server: lsof -nP -iTCP -sTCP:LISTEN and this came up, among other connections: postgres 29826 postgres 7u IPv6 192275 0t0 TCP [::1]:5432 (LISTEN) postgres …
user8558694
0
votes
1 answer

Use of lsof Command

When I open a file in a Python Program sptxt = open('output.txt','w') And then run following: i@raspberrypi:~/Watson $ lsof /home/pi/Watson/output.txt COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python3.7 16665 pi 6w REG …
Hankp
  • 47
  • 5
0
votes
1 answer

How to kill all processes which have '/var/' string in the description?

I am using lsof to find out all processes which have /var/ in the description. [root@localhost ~]# lsof | grep /var/ | less systemd 1 root 105u unix 0xffff9b25fae49680 0t0 21311 /var/run/cups/cups.sock…
meallhour
  • 13,921
  • 21
  • 60
  • 117
0
votes
0 answers

HDFS + lsof + how to find the files that are currently being used for each HDFS folder

We are trying to find the currently being used of opened files on each folder in HDFS. So we try the following hadoop fs -lsof /user/hdfs/.sparkStaging/application_1586272450810_3249 But this doesn’t work. We can do the following in order to…
jessica
  • 2,426
  • 24
  • 66
0
votes
1 answer

Meaning of localhost:dsf

I am working on a Python Server application that runs on 127.0.0.1 : 555 and I am trying to show the port 555 on lsof, or netstat. My system is macOS and when I type sudo lsof | grep localhost on terminal, I cannot see the port as localhost:555…
efedoganay
  • 133
  • 2
  • 11
0
votes
1 answer

How to list open files in read-write and write-only on a BTRFS filesystem?

I'm writing a bash backup script, which creates BTRFS subvolume snapshots on a mounted volume (i.e. /mnt/btrfs/subvolume). As usual I would use "lsof /mnt/btrfs/subvolume" and pipe its output to something like "awk 'NR==1 || $4~/[0-9][uw]/'", so…
tio78
  • 11
  • 4
0
votes
0 answers

Any negative consequences when allowing Linux app more file handles?

In Linux, one can configure soft and hard limits of file handles per user, app or system globally. I understand that this is a security feature to prevent one app consuming too many resources. But: Does it have any negative consequences when I raise…
Sebi
  • 8,323
  • 6
  • 48
  • 76
0
votes
1 answer

How is it possible to identify a website using the process id and port?

I am trying to link a website to a particular opened port. However, using both netstat and lsof, I found that when I open a single website on firefox (say facebook), there are multiple process and ports opened.I don't understand why a single website…
bislinux
  • 193
  • 2
  • 3
  • 12
0
votes
2 answers

lsof shell command in php denied

i have the following code: $cmd="lsof | awk '{print $1 \" \" $2 \" \" $3 \" \" $9}'"; $info = shell_exec($cmd); $processors = preg_split('/\s?\n\s?\n/', trim($info)); $processors =…
somejkuser
  • 8,856
  • 20
  • 64
  • 130
0
votes
1 answer

understanding TYPE in lsof output

I opened a file through python. So, i did a lsof on the python process. output of lsof has the following line COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python 15855 inaflash 3w REG 0,25 0 4150810088…
rawwar
  • 4,834
  • 9
  • 32
  • 57
0
votes
1 answer

How to use the lsof command using pssh/fabric library? Bash: lsof command not found

Lsof: Bash command not found while connecting to remote server. The same works on the terminal perfectly. I've tried to work with three of these libraries for ssh in python: pssh, fabric and paramiko. The main error is that with the pssh and fabric…
Lipsa
  • 9
  • 2
0
votes
1 answer

Is it possible to monitor all programs for accessing a file that does not exist?

I have a database driver that is launched by php through a PDO connection (and thus by Apache). This driver seeks for a file which it cannot find, but I do not know where it searches in order to place the file there. But is it possible to monitor…
L.A. Rabida
  • 416
  • 3
  • 15
0
votes
0 answers

Calculate Linux open file limit?

Is there a way of calculating some kind of optimal level of maximum file handles for a Linux system? The reason for why I'm asking is that I'm running a bunch of dockerized elasticsearch-containers and noticed that the host sever has more than…
DrWily
  • 1
  • 1
0
votes
0 answers

Running php script through cli doesn't show file as open using lsof

I have a sample script test.php. If I run ps aux | grep php it shows: myuser 12539 0.0 0.0 164404 17872 pts/2 S+ 19:11 0:00 php test.php Then if I run lsof -p 12539, test.php doesn't appear. Only php extensions,…
0
votes
1 answer

Cannot see files opened by a process

I know I can use lsof -p or ls /proc//fd to lists the files open by a process. However, my question is, lets suppose I have a bash script running which is accessing a certain file X. When I run the bash script and do a lsof -p or ls /proc//fd, I…
PeterJ
  • 35
  • 1
  • 8