|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have look over the fuser manual, and I do following:
#vi recover #fuser -n file recover But the fuser command give nothing while the manual said this command will output the pid of the vi command. So, is this a bug or am I wrong to using the command as above? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
2006-12-02, 20:52(+08), Bo Yang:
> I have look over the fuser manual, and I do following: > > #vi recover > #fuser -n file recover > > But the fuser command give nothing while the manual > said this command will output the pid of the vi command. > > So, is this a bug or am I wrong to using the command as > above? vi only has the "recover" file open when it reads its content upon startup and when it writes the new content upon :w. Some vi implementations will not read the full content in memory, so may keep the file open, or may use mmap, it's up to the implentation, you can't really rely on it. (what's -n, by the way for your fuser?). -- Stéphane |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Hello,
> I have look over the fuser manual, and I do following: > > #vi recover > #fuser -n file recover > > But the fuser command give nothing while the manual > said this command will output the pid of the vi command. > > So, is this a bug or am I wrong to using the command as > above? You don't know when vi will effectively have the 'recover' file opened. You should rather test as follows: # cat > foo & # fuser -n file foo foo: 2060 # ps -eo comm,pid | grep 2060 cat 2060 Cheers, Loic. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
loic-dev@gmx.net :
> Hello, > >> I have look over the fuser manual, and I do following: >> >> #vi recover >> #fuser -n file recover >> >> But the fuser command give nothing while the manual >> said this command will output the pid of the vi command. >> >> So, is this a bug or am I wrong to using the command as >> above? > > You don't know when vi will effectively have the 'recover' file opened. > You should rather test as follows: > > # cat > foo & > # fuser -n file foo > foo: 2060 > # ps -eo comm,pid | grep 2060 > cat 2060 > > Cheers, > Loic. Thank you Loic. I understand it, vi will not have the file, if I only open it but with no writing. But, for a network connection, I have some problem too. #ssh server ping anthoerserver #netstat //I found the ssh port #fuser -n tcp -4 port But the command again give me nothing! Why? This time I use the net connection! |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Hello Bo,
> Thank you Loic. I understand it, vi will not have the file, if I > only open it but with no writing. > > But, for a network connection, I have some problem too. > > #ssh server ping anthoerserver > #netstat //I found the ssh port > #fuser -n tcp -4 port > > But the command again give me nothing! > Why? > This time I use the net connection! Perhaps sshd uses IPv6 by default (well likely, IPv4 mapped IPv6). Try: # fuser -n tcp -6 ssh A simpler command consists to search for both IPv4/6 as follows: # fuser ssh/tcp Cheers, Loic. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
loic-dev@gmx.net :
> Hello Bo, > >> Thank you Loic. I understand it, vi will not have the file, if I >> only open it but with no writing. >> >> But, for a network connection, I have some problem too. >> >> #ssh server ping anthoerserver >> #netstat //I found the ssh port >> #fuser -n tcp -4 port >> >> But the command again give me nothing! >> Why? >> This time I use the net connection! > > Perhaps sshd uses IPv6 by default (well likely, IPv4 mapped IPv6). Try: > # fuser -n tcp -6 ssh > > A simpler command consists to search for both IPv4/6 as follows: > # fuser ssh/tcp > > Cheers, > Loic. > No, all of these give me nothing. Is something wrong with my machine. Or need I enable some kernel feather to make use of this utility? |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Hello Bo,
> No, all of these give me nothing. > Is something wrong with my machine. > Or need I enable some kernel feather to make use of this utility? On which OS are you working? You should perhaps address your problem on a dedicated newsgroup for your OS, as comp.unix.shell mainly deal which shell programming problems under Unix. HTH, Loic. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
loic-dev@gmx.net :
> Hello Bo, > >> No, all of these give me nothing. >> Is something wrong with my machine. >> Or need I enable some kernel feather to make use of this utility? > > On which OS are you working? > > You should perhaps address your problem on a dedicated newsgroup for > your OS, as comp.unix.shell mainly deal which shell programming > problems under Unix. I think there may be something wrong with my environment. I just use lsof instead for the same purpose. Thanks anyway! Thanks! |
|
![]() |
| Outils de la discussion | |
|
|