PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > How to use fuser?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

How to use fuser?

Réponse
 
LinkBack Outils de la discussion
Vieux 02/12/2006, 12h52   #1
Bo Yang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to use fuser?

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?
  Réponse avec citation
Vieux 02/12/2006, 15h05   #2
Stephane CHAZELAS
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use fuser?

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
  Réponse avec citation
Vieux 02/12/2006, 22h38   #3
loic-dev@gmx.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use fuser?

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.

  Réponse avec citation
Vieux 03/12/2006, 03h12   #4
Bo Yang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use fuser?

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!
  Réponse avec citation
Vieux 03/12/2006, 19h59   #5
loic-dev@gmx.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use fuser?

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.

  Réponse avec citation
Vieux 04/12/2006, 02h08   #6
Bo Yang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use fuser?

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?
  Réponse avec citation
Vieux 04/12/2006, 11h10   #7
loic-dev@gmx.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use fuser?

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.

  Réponse avec citation
Vieux 04/12/2006, 11h54   #8
Bo Yang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use fuser?

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!

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h01.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12083 seconds with 16 queries