delete open file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers delete open file
# 1  
Old 01-13-2009
delete open file

hi,
I have a little problem. I deleted a file, which was opened in vim editor. it was bad idea... now "df" still display same space.
I kill process vim, but maybe file was controlled or opened by another application.
Is any eventuallity to find which process has lock file?
Command "ps -ax" show no process with deleted file name.

please, any idea?
# 2  
Old 01-13-2009
vim usually creates a swap file with filename .filename.swp for recovery of crashed sessions. If you killed vim, you may still find the .swp file. To find processes using a file try lsof.
# 3  
Old 01-14-2009
Solution

hi, thank you for your reply.

"lsof" command did not find any swp file. But lsof displays this information "/var/www/myfile.out (deleted)" and inode number of this file.
Well, I did this:
find . -inum 123456 -exec rm -i {} \;

and everything is fine:-)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Need Script to ZIP/SAVE & then DELETE Log file & DELETE ZIPS older than 12 months

ENVIROMENT Linux: Fedora Core release 1 (Yarrow) iPlanet: iPlanet-WebServer-Enterprise/6.0SP1 Log Path: /usr/iplanet/servers/https-company/logs I have iPlanet log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I... (7 Replies)
Discussion started by: zachs
7 Replies

2. Shell Programming and Scripting

Newbie.. Find if a file exists and open, if not create the desired file..

Hey all, I'm brand new to script writing, I'm wanting to make a script that will ask for a file and then retrieve that file if it exists, and if it doesn't exist, create the file with the desired name, and I'm completely stuck.. so far.. #! bin/bash echo "Enter desired file" read "$file" if ... (5 Replies)
Discussion started by: Byrang
5 Replies

3. Shell Programming and Scripting

fatal: cannot open file `TNAME' for reading (No such file or directory)

Hi, I am running this command through a shell script and getting the error mentioned in the subject line: testing.awk -f x.txt TNAME My testing.awk file contains something like ++++++++++++++++++ #!/usr/bin/awk -f BEGIN{ TAB_NAME="INSERT_ONE_" ARGV ; } if ( $1=="JAM_ONE" &&... (1 Reply)
Discussion started by: kunwar
1 Replies

4. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

5. Red Hat

cannot set user id: Resource temporarily unavailable (not open file/open process related)

First post, sorry to be a bother but this one has been dogging me. I have a process user (java application server) that trips a resource limit every couple weeks and need help finding what limit we're hitting. First, this is what's running: This is the error when jobs are run or the... (0 Replies)
Discussion started by: Katahdin
0 Replies

6. Programming

Some how the open(file,flag, acc) returns 0 and write to the screen, instead of the file ???

I am out of idea what to do to resolve the problem! I need to use the open(file, for.., access) function to write a file. Never have the situation like that: it is return 0 - zero. As a result all write(..) going to the screen! What the problem it could be? I do not even know... (2 Replies)
Discussion started by: alex_5161
2 Replies

7. UNIX for Advanced & Expert Users

Unable to delete an open file

I am working on a unix server. I killed all the processes with my id on the machine. After that I tried to delete a file, I got an error:- file not removed.Text File busy. Deletion of directory prompted:- Directory not empty. Can anyone help me regarding this...??? Thanks, Vikas (11 Replies)
Discussion started by: vikasrout
11 Replies

8. Programming

libRmath.so: cannot open shared object file: No such file or directory

% locate Rmath /m/backup/backup/lib/R/include/Rmath.h /usr/lib/R/include/Rmath.h % gcc -g -o stand stand.c -I/usr/lib/R/include/ -lRmath -lm % ./stand ./stand: error while loading shared libraries: libRmath.so: cannot open shared object file: No such file or directory What's the trouble... (6 Replies)
Discussion started by: cdbug
6 Replies

9. UNIX for Dummies Questions & Answers

how to open a text file by double clicking on the file name in gtk+

how to open a text file by double clicking on the file name shown in a label widget in gtk+. thanks (0 Replies)
Discussion started by: cy163
0 Replies

10. UNIX for Dummies Questions & Answers

file activity (open/closed) file descriptor info using KORN shell scripting

I am trying to find a way to check the current status of a file. Such as some cron job processes are dependent on the completion of others. if a file is currently being accessed / modified or simply open state I will wait until it is done being processed before attempting the next process on that... (3 Replies)
Discussion started by: Gary Dunn
3 Replies
Login or Register to Ask a Question