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 [open-files]

Dealing with files that are currently opened in a program

1
vote
5answers
76 views

Stop program from writing to a deleted file

One of our systems has a growing log file (we will be addressing) but currently the application owner will delete the file with rm then wait for the next maintenance window to reboot. I find myself ...
0
votes
1answer
87 views

Open file limits not increased for redis user despite change in /etc/security/limits.conf

I got ERR max number of clients reached from my redis server so I decidied to increase the allowed max client connections in its configuration. This also requires according to the documentation, ...
0
votes
2answers
37 views

Find out which process has data open on the hard drive that is no longer visible in the directory tree [duplicate]

On my server, the root partition is 73GB, but the disk says, it is full, although there are only about 6GB used on that device: # df -h Filesystem Size Used Avail Use% Mounted on ...
0
votes
1answer
408 views

How to access USB disk from terminal

I have few files in a USB disk named F:. I The files inside it are large. I do not want to move them to my harddisk. I want to make some comparison, e.g. diff between files from inside the USB and in ...
-1
votes
2answers
204 views

Is a file descriptor ever NOT open?

Of course a file can be open, or not open. However, a file descriptor by definition refers to an open file (right?). (Well, except when it refers to something besides a file, like a pipe or what ...
2
votes
1answer
2k views

ulimit vs file-max

Could someone explain limit on open files in linux? The problem is that one of my applications if reporting "Too many open files". I have ulimit -n 1024 but cat /proc/sys/fs/file-max 6578523 and ...
0
votes
0answers
38 views

How can I always bring the application to front when opening a new file?

Running in a GNOME 3.28.0/Wayland desktop. If I right-click on a text file and select "Open with other application", the application I choose is brought to the front when it launches. However, if I ...
3
votes
1answer
5k views

Increase number of open files in mac high sierra [duplicate]

On a mac high sierra 10.13.3 I have 256 open files. I want to raise it and I open a terminal and enter sudo launchctl limit maxfiles 1000000 1000000 This doesnt change anything when I enter ulimit ...
3
votes
0answers
6k views

How to increase the maximum number of open files on Fedora?

I want to increase the maximum number of open files in Fedora 27, since the default settings are too low: $ ulimit -Sn 1024 $ ulimit -Hn 4096 First, I ensure that the system-wide setting is high ...
12
votes
3answers
1k views

Tools for showing which files are accessed by a program?

I'm not going for complicated tools like AppArmor complain mode, I need easy tools to tell me which files are accessed by a specific program.
0
votes
1answer
985 views

How can a process have a higher open file descriptors limit than that set by the hard limit?

I am using Solaris 11 and it is my understanding that a non-privileged user can increase or decrease the soft limit of maximum open file descriptors while staying within the hard limit. It is also ...
0
votes
1answer
679 views

How to increase open files limit for a specific user?

Currently we have below entry in /etc/security/limits.conf * hard nofile 65000 I want to increase that limit for a specific user called oracle, so if I add a line below like oracle hard nofile ...
0
votes
1answer
769 views

RHEL setting a user specific max number of open files

I've set up below values in /etc/security/limits.conf in my RHEL machine. * hard nofile 65535 @student hard nofile 100000 Is this the correct approach when setting a user specific max number of ...
0
votes
0answers
83 views

How to quickly open the parent folder of a file in the OS GUI

Imagine you have a (text) file open, in a window of the GUI of your favorite editor. Imagine you want to be sure of the directory the file is in (maybe, you have multiple files with the same name, but ...
5
votes
3answers
5k views

How to list all the current network connections for a given PID?

If I have a PID, how can I then find all the connections that are open for that process? I have tried with netstat | grep $PID but this does not seem to work. I need a command that will take that ...
0
votes
1answer
1k views

How to access the output of a process after the terminal was closed [duplicate]

I started an application from the terminal which prints the status and various logs in the console so that I can read them from the terminal. I accidentally closed the terminal but the application is ...
3
votes
2answers
624 views

Grab standard input/ouput of a running process under FreeBSD/macOS

Under Linux I often use /proc/<pid>/fd/[0,1,2] to access std[in,out,err] of any running process. Is there a way to achieve the same result under FreeBSD and/or macOS ?
1
vote
2answers
833 views

Why xterm doesn't have /dev/ptmx file opened?

gnome-terminal have the /dev/ptmx file opened: But xterm doesn't have it opened: I thought that each terminal emulator must have the /dev/ptmx file opened, so why xterm doesn't have it opened? Edit:...
1
vote
0answers
121 views

Details about open socket on Solaris [closed]

I truss'ed a stuck process and found the following: 19326/2: read(197, 0xFFFFFC7FFE05E080, 8192) (sleeping...) $ pfiles 19326|grep 197: 197: S_IFSOCK mode:0666 dev:303,0 ino:33422 uid:0 gid:...
5
votes
1answer
396 views

Identify a process that is still using a file on a lazy-unmounted filesystem

I have a /dev/md127 mdadm RAID 0 array that some time ago was mounted as /mnt/storage1. At some point I opened a bash session and changed CWD to /mnt/storage1 and the bash session is still active. I ...
1
vote
2answers
268 views

When is a file freed in an ext file system?

Introduction Until recently, I thought that on ext file system, inodes have reference counters which count the number of times the file is referenced by a directory entry or a file descriptor. Then, ...
4
votes
2answers
2k views

How to recover the deleted binary executable file of a running process

I have a process running very long time. I accidentally deleted the binary executable file of the process. Since the process is still running and doesn't get affected, there must be the original ...
2
votes
3answers
3k views

Does killing a process close all files opened by that process?

I want to kill a process which has an open connection to a database. If I kill the process, can I make sure that the database is unlocked?
8
votes
3answers
8k views

Largest allowed maximum number of open files in Linux

Is there a (technical or practical) limit to how large you can configure the maximum number of open files in Linux? Are there some adverse effects if you configure it to a very large number (say 1-...
16
votes
3answers
41k views

How to list the open file descriptors (and the files they refer to) in my current bash session

I am running in an interactive bash session. I have created some file descriptors, using exec, and I would like to list what is the current status of my bash session. Is there a way to list the ...
1
vote
1answer
379 views

How to make open files limits more than 2000000?

/etc/security/limits.conf contains * soft nofile 2000000 * hard nofile 2000000 After I changed the open files limits to 2000000, the system can't login; error message is "permission denied". If I ...
0
votes
0answers
345 views

Intercept GNU/Linux system calls

Context I am trying to design a tool that would more or less automatically generate a Makefile from a standard shell script. The idea would be that for each command executed by the script: I ...
3
votes
1answer
657 views

Is it possible to find which vim/tmux has my file open?

I use tmux at work as my IDE. I also run vim in a variety of tmux panes and will fairly often background the process (or alternatively I just close the window - I have vim configured not to remove ...
2
votes
1answer
998 views

Are all open files displayed in lsof output?

In all the cases, I have found any file which is open for reading or writing is displayed in lsof output. But today, I am trying to found a logfile that is opened for writing by a java process in lsof ...
4
votes
1answer
6k views

How to find processes using serial port

I'm using uclinux and I want to find out which processes are using the serial port. The problem is that I have no lsof or fuser. Is there any other way I can get this information?
0
votes
2answers
201 views

Will the execution of the binaries that is sitting on a mounted NFS directory fails when network interruption happen?

So I have a Linux machine that acts as an NFS server. Lots of programs has been installed to the folder that is being exported. On another Linux machine, I've been running one of the program that is ...
4
votes
1answer
4k views

How to get number of opened file descriptors for user

I know about lsof and ls /proc/*/fd but none of them are atomic AFAIK. Because in the latter case I would need to get all pids for user and then filter by them and by that time some of the file ...
5
votes
2answers
232 views

Identify files/processes that prevent remounting read-only

My system runs Debian Testing, and / is generally mounted as read-only. The main problem with this is, every time I install something or update the system, I cannot remount the filesystem (I get the ...
2
votes
1answer
1k views

Why lsof reports a higher number of open files of user than what ulimit says should be allowed?

I have checked the result for user kpiserv [kpiserv@***** ~]$ lsof -u kpiserv |wc -l 5358 [kpiserv@***** ~]$ ulimit -a open files (-n) 1024 Why lsof reports a higher ...
3
votes
2answers
5k views

Finding Process Info Associated to a Given Port in HP-UX

I need to find information for a process that's using a given port number, such as 8080. More specifically, I'm interested in finding out the full path of the program. How can I do that in HP-UX?
10
votes
1answer
13k views

Read “/proc” to know if a process has opened a port

I need to know if a process with a given PID as opened a port without using external commands. I must then use the /proc filesystem. I can read the /proc/$PID/net/tcp file for example and get ...
3
votes
1answer
373 views

Can file handles be translated to filenames?

Is there a tool for translating file handles to file names on Solaris 10? I've looked around and found several scripts including the one at: http://heim.ifi.uio.no/kjetilho/hacks/fhfind.perl https://...
3
votes
0answers
3k views

“Too many open files ssh” when the number of open files is far below ulimit

I was trying to set up 2000 concurrent ssh connections, but got the error message in server log (i.e. journalctl): sshd[1356]: error: reexec socketpair: Too many open files I've set both the soft ...
13
votes
4answers
2k views

`ls` error when directory is deleted

I have two shells open. The first is in directory A. In the second, I remove directory A, and then recreate it. When I go back to the first shell, and type ls, the output is: ls: cannot open ...
25
votes
6answers
107k views

Best way to free disk space from deleted files that are held open

Hi I have many files that have been deleted but for some reason the disk space associated with the deleted files is unable to be utilized until I explicitly kill the process for the file taking the ...
18
votes
1answer
29k views

Why file-nr and lsof count on open files differs? [closed]

I am running into a problem all of a sudden; all my applications and the server was running fine and all of a sudden I see the number of open files shoot up. I am checking it with this command: cat /...
10
votes
2answers
13k views

Move file but only if it's closed

I want to move large file created by external process as soon as it's closed. Is this test command correct? if lsof "/file/name" then # file is open, don't touch it! else if [ 1 -eq $...
2
votes
1answer
1k views

Find out to which directory a process is writing?

This question is NOT a duplicate of this question Find out current working directory of a running process?, because the writing directory can be different from the working directory. For example, I ...
1
vote
1answer
1k views

Number of open file descriptors won't change when I set them in CentOS 6.3?

uname -a Linux lab.testing.com 2.6.18-164.el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 i686 i386 GNU/Linux ulimit -Hn 1024 ulimit -Sn 1024 ulimit -n 1024 I opened /etc/sysctl.conf in vi and added ...
28
votes
2answers
3k views

Is it safe to move a file that's being appended to?

I have a node.js process that uses fs.appendFile to add lines to file.log. Only complete lines of about 40 chars per lines are appended, e.g. calls are like fs.appendFile("start-end"), not 2 calls ...
6
votes
1answer
865 views

How to make sure only one instance accessing the file at a time in a folder?

I have a shell script which will be executed by multiple instances and if an instance accessing a file and doing some operation how can I make sure other instances are not accessing the same file and ...
3
votes
1answer
2k views

Daemon's open file limit is reached even though the system limits have been increased

I am running Debian wheezy. File limits are increased to 100000 for every user. ulimit -a and ulimit -Hn / -Sn show me the right amounts of maximum open file limits even in screen. But for some reason ...
37
votes
2answers
19k views

Why does process substitution result in a file called /dev/fd/63 which is a pipe?

I am trying to understand named pipes in the context of this particular example. I type <(ls -l) in my terminal and get the output as, bash: /dev/fd/63: Permission denied. If I type cat <(ls -...
10
votes
3answers
5k views

How can a log program continue to log to a deleted file?

From the Unix Power Tools, 3rd Edition: Instead of Removing a File, Empty It section: If an active process has the file open (not uncommon for log files), removing the file and creating a new one ...
19
votes
2answers
3k views

How to find out what process is writing to STDOUT?

I have two instances of a process running. One of them is "frEAkIng oUT!" and printing errors non stop to STDOUT. I want to kill the broken process but I have to make sure I don't terminate the wrong ...