Re: lsof for Windows processes?

2023-08-12 Thread Brian Inglis via Cygwin

On 2023-08-12 05:34, Cedric Blancher via Cygwin wrote:

Good afternoon!

On Fri, 11 Aug 2023 at 18:21, Brian Inglis  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}

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

--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: lsof for Windows processes?

2023-08-12 Thread Cedric Blancher via Cygwin
Good afternoon!

On Fri, 11 Aug 2023 at 18:21, Brian Inglis  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}
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

-- 
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: lsof for Windows processes?

2023-08-11 Thread Brian Inglis via Cygwin

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

--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


lsof for Windows processes?

2023-08-11 Thread Cedric Blancher via 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 
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

-- 
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: name of pkg contaning lsof and netstat

2018-05-24 Thread Brian Inglis
On 2018-05-24 02:41, Csaba Raduly wrote:
> On 5/23/18, FHDATA wrote:
>> what package(s) do i need to install to get  lsof and netstat ?
> A search for lsof in the Cygwin package search:
> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=%5Cblsof%5Cb&arch=x86_64
> says that lsof is in the busybox package.
> A search for netstat
> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=%5Cbnetstat%5Cb&arch=x86_64
> returns no hits. You are probably out of luck with netstat:
> https://cygwin.com/ml/cygwin/2006-07/msg00936.html

A version of netstat is included with Windows:

$ /proc/cygdrive/c/Windows/System32/netstat -?

Displays protocol statistics and current TCP/IP network connections.

NETSTAT [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-x] [-t] [interval]

  -aDisplays all connections and listening ports.
  -bDisplays the executable involved in creating each connection or
listening port. In some cases well-known executables host
multiple independent components, and in these cases the
sequence of components involved in creating the connection
or listening port is displayed. In this case the executable
name is in [] at the bottom, on top is the component it called,
and so forth until TCP/IP was reached. Note that this option
can be time-consuming and will fail unless you have sufficient
permissions.
  -eDisplays Ethernet statistics. This may be combined with the -s
option.
  -fDisplays Fully Qualified Domain Names (FQDN) for foreign
addresses.
  -nDisplays addresses and port numbers in numerical form.
  -oDisplays the owning process ID associated with each connection.
  -p proto  Shows connections for the protocol specified by proto; proto
may be any of: TCP, UDP, TCPv6, or UDPv6.  If used with the -s
option to display per-protocol statistics, proto may be any of:
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.
  -qDisplays all connections, listening ports, and bound
nonlistening TCP ports. Bound nonlistening ports may or may not
be associated with an active connection.
  -rDisplays the routing table.
  -sDisplays per-protocol statistics.  By default, statistics are
shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;
the -p option may be used to specify a subset of the default.
  -tDisplays the current connection offload state.
  -xDisplays NetworkDirect connections, listeners, and shared
endpoints.
  -yDisplays the TCP connection template for all connections.
Cannot be combined with the other options.
  interval  Redisplays selected statistics, pausing interval seconds
between each display.  Press CTRL+C to stop redisplaying
statistics.  If omitted, netstat will print the current
configuration information once.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: name of pkg contaning lsof and ...

2018-05-24 Thread Csaba Raduly
On 5/23/18, FHDATA wrote:
> what package(s) do i need to install to get  lsof and netstat ?
>

A search for lsof in the Cygwin package search:

https://cygwin.com/cgi-bin2/package-grep.cgi?grep=%5Cblsof%5Cb&arch=x86_64

says that lsof is in the busybox package.

A search for netstat

https://cygwin.com/cgi-bin2/package-grep.cgi?grep=%5Cbnetstat%5Cb&arch=x86_64

returns no hits. You are probably out of luck with netstat:
https://cygwin.com/ml/cygwin/2006-07/msg00936.html

Csaba
-- 
You can get very substantial performance improvements by not doing the
right thing.
   - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformat way
to get the wrong information: this is what you want. - Scott Meyers
(C++TDaWYK)

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



name of pkg contaning lsof and ...

2018-05-23 Thread FHDATA



hello,


what package(s) do i need to install to get  lsof and netstat ?



thank you,
F-



--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: lsof?

2018-05-03 Thread Ulli Horlacher
On Thu 2018-05-03 (20:57), Brian Inglis wrote:
> On 2018-05-03 15:46, Ulli Horlacher wrote:
> 
> > I need to know if a file is opened by another process, but there is no
> > lsof cygwin package. 
> > Is there an alternative?
> 
> Program fuser in package psmisc.

Great!

~: uname
CYGWIN_NT-6.1

~: fuser -v /tmp/test
 USERPID ACCESS COMMAND
/tmp/test:   admin  1328 F perl

~: man fuser | fpg -p AUTHORS
AUTHORS
   Werner Almesberger 

Werner is an old friend of mine! The world is a village :-)


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: lsof?

2018-05-03 Thread Brian Inglis
On 2018-05-03 15:46, Ulli Horlacher wrote:
> I need to know if a file is opened by another process, but there is no
> lsof cygwin package. 
> Is there an alternative?

Program fuser in package psmisc.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



lsof?

2018-05-03 Thread Ulli Horlacher
I need to know if a file is opened by another process, but there is no
lsof cygwin package. 
Is there an alternative?


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:<20180503214600.ga12...@rus.uni-stuttgart.de>

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple