* lsof for Windows processes?
@ 2023-08-11 15:45 Cedric Blancher
2023-08-11 16:21 ` Brian Inglis
0 siblings, 1 reply; 4+ messages in thread
From: Cedric Blancher @ 2023-08-11 15:45 UTC (permalink / raw)
To: cygwin
Good evening!
Does Cygwin have a tool like lsof which can list which files or
directories are in use by a Windows process?
Ced
--
Cedric Blancher <cedric.blancher@gmail.com>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: lsof for Windows processes?
2023-08-11 15:45 lsof for Windows processes? Cedric Blancher
@ 2023-08-11 16:21 ` Brian Inglis
2023-08-12 11:34 ` Cedric Blancher
0 siblings, 1 reply; 4+ messages in thread
From: Brian Inglis @ 2023-08-11 16:21 UTC (permalink / raw)
To: cygwin; +Cc: Cedric Blancher
On 2023-08-11 09:45, Cedric Blancher via Cygwin wrote:
> Does Cygwin have a tool like lsof which can list which files or
> directories are in use by a Windows process?
You can check these things yourself using the Cygwin Search Packages page:
https://cygwin.com/packages/
type "usr/bin/lsof" and hit Enter:
https://cygwin.com/cgi-bin2/package-grep.cgi?grep=usr%2Fbin%2Ffuser
Search Results
Found 0 matches for usr/bin/lsof
and the same on the command line:
$ cygcheck -p usr/bin/lsof
Found 0 matches for usr/bin/lsof
but Cygwin does have fuser:
$ cygcheck -p usr/bin/fuser
Found 6 matches for usr/bin/fuser
cygfuse-3.2.0-2 - cygfuse: Cygwin interface to Windows FUSE providers
cygfuse-3.2.0-3 - cygfuse: Cygwin interface to Windows FUSE providers
psmisc-debuginfo-22.20-1 - psmisc-debuginfo: Debug info for psmisc
psmisc-debuginfo-23.4-4 - psmisc-debuginfo: Debug info for psmisc
psmisc-22.20-1 - psmisc: Utilities for managing processes on your system
psmisc-23.4-4 - psmisc: Utilities for managing processes on your system
and Windows has openfiles:
$ cmd /c help openfiles
OPENFILES /parameter [arguments]
Description:
Enables an administrator to list or disconnect files and folders
that have been opened on a system.
Parameter List:
/Disconnect Disconnects one or more open files.
/Query Displays files opened locally or from shared
folders.
/Local Enables / Disables the display of local open files.
/? Displays this help message.
Examples:
OPENFILES /Disconnect /?
OPENFILES /Query /?
OPENFILES /Local /?
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: lsof for Windows processes?
2023-08-11 16:21 ` Brian Inglis
@ 2023-08-12 11:34 ` Cedric Blancher
2023-08-12 17:14 ` Brian Inglis
0 siblings, 1 reply; 4+ messages in thread
From: Cedric Blancher @ 2023-08-12 11:34 UTC (permalink / raw)
To: cygwin
Good afternoon!
On Fri, 11 Aug 2023 at 18:21, Brian Inglis <Brian.Inglis@shaw.ca> wrote:
>
> On 2023-08-11 09:45, Cedric Blancher via Cygwin wrote:
> > Does Cygwin have a tool like lsof which can list which files or
> > directories are in use by a Windows process?
>
> You can check these things yourself using the Cygwin Search Packages page:
>
> https://cygwin.com/packages/
>
> type "usr/bin/lsof" and hit Enter:
>
> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=usr%2Fbin%2Ffuser
>
> Search Results
>
> Found 0 matches for usr/bin/lsof
>
> and the same on the command line:
>
> $ cygcheck -p usr/bin/lsof
> Found 0 matches for usr/bin/lsof
>
> but Cygwin does have fuser:
>
> $ cygcheck -p usr/bin/fuser
> Found 6 matches for usr/bin/fuser
> cygfuse-3.2.0-2 - cygfuse: Cygwin interface to Windows FUSE providers
> cygfuse-3.2.0-3 - cygfuse: Cygwin interface to Windows FUSE providers
> psmisc-debuginfo-22.20-1 - psmisc-debuginfo: Debug info for psmisc
> psmisc-debuginfo-23.4-4 - psmisc-debuginfo: Debug info for psmisc
> psmisc-22.20-1 - psmisc: Utilities for managing processes on your system
> psmisc-23.4-4 - psmisc: Utilities for managing processes on your system
>
> and Windows has openfiles:
>
> $ cmd /c help openfiles
>
> OPENFILES /parameter [arguments]
>
> Description:
> Enables an administrator to list or disconnect files and folders
> that have been opened on a system.
>
> Parameter List:
> /Disconnect Disconnects one or more open files.
>
> /Query Displays files opened locally or from shared
> folders.
>
> /Local Enables / Disables the display of local open files.
>
> /? Displays this help message.
>
> Examples:
> OPENFILES /Disconnect /?
> OPENFILES /Query /?
> OPENFILES /Local /?
Thank you.
But neither openfiles or fuser seem to work in this case, even if I
have a file open in my bash shell, and call fuser in the same bash
script:
bash -c 'command exec {n}</mynfsmount/myfile.txt ; echo "fd=$n" ;
fuser -a /mynfsmount ; true'
gives
fd=10
/mynfsmount:
(no processes listed, which might be correct, as maybe a non cygwin
process has that file open)
Ced
--
Cedric Blancher <cedric.blancher@gmail.com>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: lsof for Windows processes?
2023-08-12 11:34 ` Cedric Blancher
@ 2023-08-12 17:14 ` Brian Inglis
0 siblings, 0 replies; 4+ messages in thread
From: Brian Inglis @ 2023-08-12 17:14 UTC (permalink / raw)
To: cygwin; +Cc: Cedric Blancher
On 2023-08-12 05:34, Cedric Blancher via Cygwin wrote:
> Good afternoon!
>
> On Fri, 11 Aug 2023 at 18:21, Brian Inglis <Brian.Inglis@shaw.ca> wrote:
>>
>> On 2023-08-11 09:45, Cedric Blancher via Cygwin wrote:
>>> Does Cygwin have a tool like lsof which can list which files or
>>> directories are in use by a Windows process?
>>
>> You can check these things yourself using the Cygwin Search Packages page:
>>
>> https://cygwin.com/packages/
>>
>> type "usr/bin/lsof" and hit Enter:
>>
>> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=usr%2Fbin%2Ffuser
>>
>> Search Results
>>
>> Found 0 matches for usr/bin/lsof
>>
>> and the same on the command line:
>>
>> $ cygcheck -p usr/bin/lsof
>> Found 0 matches for usr/bin/lsof
>>
>> but Cygwin does have fuser:
>>
>> $ cygcheck -p usr/bin/fuser
>> Found 6 matches for usr/bin/fuser
>> cygfuse-3.2.0-2 - cygfuse: Cygwin interface to Windows FUSE providers
>> cygfuse-3.2.0-3 - cygfuse: Cygwin interface to Windows FUSE providers
>> psmisc-debuginfo-22.20-1 - psmisc-debuginfo: Debug info for psmisc
>> psmisc-debuginfo-23.4-4 - psmisc-debuginfo: Debug info for psmisc
>> psmisc-22.20-1 - psmisc: Utilities for managing processes on your system
>> psmisc-23.4-4 - psmisc: Utilities for managing processes on your system
>>
>> and Windows has openfiles:
>>
>> $ cmd /c help openfiles
>>
>> OPENFILES /parameter [arguments]
>>
>> Description:
>> Enables an administrator to list or disconnect files and folders
>> that have been opened on a system.
>>
>> Parameter List:
>> /Disconnect Disconnects one or more open files.
>>
>> /Query Displays files opened locally or from shared
>> folders.
>>
>> /Local Enables / Disables the display of local open files.
>>
>> /? Displays this help message.
>>
>> Examples:
>> OPENFILES /Disconnect /?
>> OPENFILES /Query /?
>> OPENFILES /Local /?
>
> Thank you.
>
> But neither openfiles or fuser seem to work in this case, even if I
> have a file open in my bash shell, and call fuser in the same bash
> script:
>
> bash -c 'command exec {n}</mynfsmount/myfile.txt ; echo "fd=$n" ;
> fuser -a /mynfsmount ; true'
>
> gives
>
> fd=10
> /mynfsmount:
>
> (no processes listed, which might be correct, as maybe a non cygwin
> process has that file open)
I use it to tell me when build processes close their logs.
Currently on X (lightly sanitized):
$ fuser -av ~/.xsession-errors
Cannot stat file /proc/14838/fd/0: No such device or address
Cannot stat file /proc/14838/fd/1: No such device or address
Cannot stat file /proc/14838/fd/2: No such device or address
Cannot stat file /proc/14931/fd/0: No such device or address
Cannot stat file /proc/14931/fd/1: No such device or address
Cannot stat file /proc/14931/fd/2: No such device or address
USER PID ACCESS COMMAND
$HOME/.xsession-errors:
$USER 14962 F.... fbxkb
$USER 14935 F.... xwin-xdg-menu
$USER 14964 F.... mintty
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-12 17:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11 15:45 lsof for Windows processes? Cedric Blancher
2023-08-11 16:21 ` Brian Inglis
2023-08-12 11:34 ` Cedric Blancher
2023-08-12 17:14 ` Brian Inglis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).