fuser not showing file open by vi


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users fuser not showing file open by vi
# 1  
Old 02-23-2008
fuser not showing file open by vi

hi,

I opened a simple text file by vi. I then started another shell, and did fuser myFile. I expected it to show the pid of the vi session that had that file open, but it just returned a blank.

why would this be?

thanks
# 2  
Old 02-23-2008
have you tried as "root" user also?
# 3  
Old 02-23-2008
no. Not as root.

The funny thing is, if I do

Code:
fuser -cu /

then I can see a whole bunch of processed, one of which is my vi with my file open.

But I don;t want that.

I want to do

Code:
fuser myFile.ksh

as I only want to see if myFile.ksh is open. Am I missing something here?

thanks
# 4  
Old 02-25-2008
Bug

Quote:
Originally Posted by JamesByars
no. Not as root.

The funny thing is, if I do

Code:
fuser -cu /

then I can see a whole bunch of processed, one of which is my vi with my file open.

But I don;t want that.

I want to do

Code:
fuser myFile.ksh

as I only want to see if myFile.ksh is open. Am I missing something here?

thanks
===============================================

Hey,

Try to use following..

MYPATH="/clocal/user/dir1/dir2/"
for file_dir in `find $MYPATH -amin -1`
do

echo `fuser -uf "$file_dir" ` >> temp.txt.$$
echo " $file_dir is being accessed" >> temp.txt.$$
done

or

fuser -uf /dir1/dir2/file1


It perfectly works. and it shows the name of the user, who has accessed the file.
Catch : fuser returns a process id !! Below command stores the process id, thats being returned by fuser command.

var_pid = `fuser -uf "$file_dir"`


Hope this'll help you.

Thanks
VarunSmilie
# 5  
Old 02-25-2008
Power

Smilie
Quote:
Originally Posted by JamesByars
hi,

I opened a simple text file by vi. I then started another shell, and did fuser myFile. I expected it to show the pid of the vi session that had that file open, but it just returned a blank.

why would this be?

thanks
-------------------------------------------
hey,

for more help you can visit my post under the same forum:
"awk and fuction (recursion) !! Urgent !! "

Definetly this'll help you out !!
Thanks
Varun.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Fuser alternative OR running fuser on a script

Hi, Not sure whether there is a fuser alternative or any better way to check for file in use or not. I am wanting to check whether files are in use or not before removing them. Using fuser, the awk seems to be giving me 'weird' output not to mention that it is giving me 2 lines instead of... (0 Replies)
Discussion started by: newbie_01
0 Replies

2. Solaris

./curl -V showing fatal: libldap.so.5: open failed: No such file or directory

Hi Guys, I am facing this Error bash-2.03$ ./curl -V ld.so.1: curl: fatal: libldap.so.5: open failed: No such file or directory Killed bash-2.03$ while executing ./curl -V in /opt/sfw/bin directory. I am using Sun Solaris 10. which package upgrage can give me this missing... (9 Replies)
Discussion started by: manalisharmabe
9 Replies

3. UNIX for Dummies Questions & Answers

Why Linux is not showing file in use ?

Hi i have written a infinite loop which writes to a file log.txt while do echo " file in use " >> log.txt done i have started this process in one terminal , from another terminal i issued cp command cp log.txt log2.txt i was expecting a File in use message but didnt ? i have... (6 Replies)
Discussion started by: rakeshkumar
6 Replies

4. UNIX for Dummies Questions & Answers

fuser

if filename.txt is in used, exit, else continue. i tried to use fuser -c filename.txt, but returned bunch out PIDs eventhough filename.txt is not in used. any idea ? (10 Replies)
Discussion started by: tjmannonline
10 Replies

5. Shell Programming and Scripting

Showing the first 4 lines of a file?

Is there a way to show the first 4 lines of a file without using head -4? In sed would it be sed '1,4d' ? What if I just wanted to display the 2nd line ONLY? How could this be done with AWK?...correctly with SED? (6 Replies)
Discussion started by: puttster
6 Replies

6. UNIX and Linux Applications

Showing all open programs on your bottom toolbar

http://i255.photobucket.com/albums/hh133/COKEDUDEUSF/toolbar.jpg Take a look at my picture to understand what I'm talking about. I have a bunch of programs open right now and I can't see the name of the programs on my toolbar. Is there hopefully a way to see all open programs on your toolbar... (1 Reply)
Discussion started by: cokedude
1 Replies

7. AIX

not showing the year of file

Hi I am facing strange issue in one direcotry it is not showing year of file, can you please suggest me wheather there is any limitation on year, on some other file though it is showing the dates. Regards, Manoj. (1 Reply)
Discussion started by: manoj.solaris
1 Replies

8. 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

9. UNIX for Dummies Questions & Answers

fuser

Anyone ever use fuser, i tried this command fuser /database.bk but it only returns datbase.bk: I read some of the forums online, one of them said when he used fuser, it broke down the box, i really don't want that happen. I thought fuser is to see who is accessing that file, right? any... (8 Replies)
Discussion started by: adrianlearnpro
8 Replies

10. UNIX for Advanced & Expert Users

STDOUT redirect to a FILE, when fuser command is used !!

Hi all, I have the following script: ------------------------------------------------- #SCRIPT TO CHECK WHO HAS ACCESSED THE LOG/FILE IN PAST 'N' MINUTES, AND MAIL ACCORDINGLY. MYPATH="/clocal/mqbrkrs/user/mqsiadm/sanjay/" MAIL_RECIPIENTS="vg517@dcx.com" Subject="File accessed in last... (6 Replies)
Discussion started by: varungupta
6 Replies
Login or Register to Ask a Question