Special filenamesSpecial files in /etcCertain files in Cygwin's /etc directory are
read by Cygwin before the mount table has been established. The list
of files is
/etc/fstab
/etc/fstab.d/$USER
/etc/passwd
/etc/group
These file are read using native Windows NT functions which have
no notion of Cygwin symlinks or POSIX paths. For that reason
there are a few requirements as far as /etc is
concerned.To access these files, the Cygwin DLL evaluates it's own full
Windows path, strips off the innermost directory component and adds
"\etc". Let's assume the Cygwin DLL is installed as
C:\cygwin\bin\cygwin1.dll. First the DLL name as
well as the innermost directory (bin) is stripped
off: C:\cygwin\. Then "etc" and the filename to
look for is attached: C:\cygwin\etc\fstab. So the
/etc directory must be parallel to the directory in which the cygwin1.dll
exists and /etc must not be a Cygwin symlink
pointing to another directory. Consequentially none of the files from
the above list, including the directory /etc/fstab.d
is allowed to be a Cygwin symlink either.However, native NTFS symlinks and reparse points are transparent
when accessing the above files so all these files as well as
/etc itself may be NTFS symlinks.Last but not least, make sure that these files are world-readable.
Every process of any user account has to read these files potentially,
so world-readability is essential. The only exception are the user
specific files /etc/fstab.d/$USER, which only have
to be readable by the $USER user account itself.Invalid filenamesFilenames invalid under Win32 are not necessarily invalid under Cygwin.
There are a few rules which apply to Windows filenames. Most notably, DOS
device names like AUX, COM1,
LPT1 or PRN (to name a few)
cannot be used as filename or extension in a native Win32 application.
So filenames like prn.txt or foo.aux
are invalid filenames for native Win32 applications.This restriction doesn't apply to Cygwin applications. Cygwin
can create and access files with such names just fine. Just don't try
to use these files with native Win32 applications.Forbidden characters in filenamesSome characters are disallowed in filenames on Windows filesystems.
These forbidden characters are the ASCII control characters from ASCII
value 1 to 31, plus the following characters which have a special meaning
in the Win32 API:
" * : < > ? | \
Cygwin can't fix this, but it has a method to workaround this
restriction. All of the above characters, except for the backslash,
are converted to special UNICODE characters in the range 0xf000 to 0xf0ff
(the "Private use area") when creating or accessing files by adding 0xf000
to the forbidden characters' code points.The backslash has to be exempt from this conversion, because Cygwin
accepts Win32 filenames including backslashes as path separators on input.
Converting backslashes using the above method would make this impossible.Additionally Win32 filenames can't contain trailing dots and spaces
for DOS backward compatibility. When trying to create files with trailing
dots or spaces, all of them are removed before the file is created. This
restriction only affects native Win32 applications. Cygwin applications
can create and access files with trailing dots and spaces without problems.
An exception from this rule are some network filesystems (NetApp,
NWFS) which choke on these filenames. They return with an error like
"No such file or directory" when trying to create such files. Cygwin
recognizes these filesystems and works around this problem by applying
the same rule as for the other forbidden characters. Leading spaces and
trailing dots and spaces will be converted to UNICODE characters in the
private use area. This behaviour can be switched on explicitely for a
filesystem or a directory tree by using the mount option
dos.Filenames with unusual (foreign) characters Windows filesystems use Unicode encoded as UTF-16
to store filename information. If you don't use the UTF-8
character set (see ) then there's a
chance that a filename is using one or more characters which have no
representation in the character set you're using.In the default "C" locale, Cygwin creates filenames using
the UTF-8 charset. This will always result in some valid filename by
default, but again might impose problems when switching to a non-"C"
or non-"UTF-8" charset.To avoid this scenario altogether, always use UTF-8 as the
character set.If you don't want or can't use UTF-8 as character set for whatever
reason, you will nevertheless be able to access the file. How does that
work? When Cygwin converts the filename from UTF-16 to your character
set, it recognizes characters which can't be converted. If that occurs,
Cygwin replaces the non-convertible character with a special character
sequence. The sequence starts with an ASCII CAN character (hex code
0x18, equivalent Control-X), followed by the UTF-8 representation of the
character. The result is a filename containing some ugly looking
characters. While it doesn't look nice, it
is nice, because Cygwin knows how to convert
this filename back to UTF-16. The filename will be converted using your
usual character set. However, when Cygwin recognizes an ASCII CAN
character, it skips over the ASCII CAN and handles the following bytes as
a UTF-8 character. Thus, the filename is symmetrically converted back to
UTF-16 and you can access the file.Please be aware that this method is not entirely foolproof.
In some character set combinations it might not work for certain native
characters.Only by using the UTF-8 charset you can avoid this problem safely.
Case sensitive filenamesIn the Win32 subsystem filenames are only case-preserved, but not
case-sensitive. You can't access two files in the same directory which
only differ by case, like Abc and
aBc. While NTFS (and some remote filesystems)
support case-sensitivity, the NT kernel does not support it by default.
Rather, you have to tweak a registry setting and reboot. For that reason,
case-sensitivity can not be supported by Cygwin, unless you change that
registry value.If you really want case-sensitivity in Cygwin, you can switch it
on by setting the registry value
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive
to 0 and reboot the machine.
When installing Microsoft's Services For Unix (SFU), you're asked if
you want to use case-sensitive filenames. If you answer "yes" at this point,
the installer will change the aforementioned registry value to 0, too. So, if
you have SFU installed, there's some chance that the registry value is already
set to case sensitivity.
After you set this registry value to 0, Cygwin will be case-sensitive
by default on NTFS and NFS filesystems. However, there are limitations:
while two programsAbc.exe
and aBc.exe can be created and accessed like other files,
starting applications is still case-insensitive due to Windows limitations
and so the program you try to launch may not be the one actually started. Also,
be aware that using two filenames which only differ by case might
result in some weird interoperability issues with native Win32 applications.
You're using case-sensitivity at your own risk. You have been warned! Even if you use case-sensitivity, it might be feasible to switch to
case-insensitivity for certain paths for better interoperability with
native Win32 applications (even if it's just Windows Explorer). You can do
this on a per-mount point base, by using the "posix=0" mount option in
/etc/fstab, or your /etc/fstab.d/$USER
file./cygdrive paths are case-insensitive by default.
The reason is that the native Windows %PATH% environment variable is not
always using the correct case for all paths in it. As a result, if you use
case-sensitivity on the /cygdrive prefix, your shell
might claim that it can't find Windows commands like attrib
or net. To ease the pain, the /cygdrive
path is case-insensitive by default and you have to use the "posix=1" setting
explicitly in /etc/fstab or
/etc/fstab.d/$USER to switch it to case-sensitivity,
or you have to make sure that the native Win32 %PATH% environment variable
is using the correct case for all paths throughout.Note that mount points as well as device names and virtual
paths like /proc are always case-sensitive! The only exception are
the subdirectories and filenames under /proc/registry, /proc/registry32
and /proc/registry64. Registry access is always case-insensitive.
Read on for more information.Case sensitive directoriesWindows 10 1803 introduced a new feature: NTFS directories can be marked
as case-sensitive, independently of the obcaseinsensitive
registry key discussed in the previous section. This new per-directory
case-sensitivity requires setting a flag in the NTFS filesystem header which
is, unfortunately, undocumented. The result is that you have to activate
Windows Subsystem for Linux (WSL), a
feature available via Programs and Features ->
Turn Windows features on or off. You only have to activate
WSL, you don't have to install any actual Linux. After
turning WSL on and performing the compulsory reboot,
case-sensitive directories are activated.Of course, there's a drawback. While these case-sensitive directories
work like charm on the local machine, there are massive interoperability
problems when trying to access these directories from remote machines at
the time of writing this. We opened a bug report for that at
Microsoft's WSL issue tracker,
if you're interested in the details.If you want case-sensitivity and need interoperability with remote
machines, better stick to switching the kernel to case-sensitivity as
outlined in With WSL activated and starting with Cygwin 3.0.0,
Cygwin's mkdir system call automatically created all
directories below the Cygwin installation directory as case-sensitive.
With Cygwin 3.0.2, this feature had been disabled again for hopefully
obvious reasons.However, you can still use Cygwin's new
tool with the -C option
to control case-sensitivity of directories on NTFS filesystems.Please keep in mind that switching off
case-sensitivity on a directory has a condition attached to it: If
the directory contains two files which only differ in case (e. g.,
foo and FOO), Windows
refuses to convert the dir back to case-insensitive. First you have
to fix the filename collision, i. e., you have to rename one of these
files.POSIX devicesWhile there is no need to create a POSIX /dev
directory, the directory is automatically created as part of a Cygwin
installation. It's existence is often a prerequisit to run certain
applications which create symbolic links, fifos, or UNIX sockets in
/dev. Also, the directories /dev/shm
and /dev/mqueue are required to exist to use named POSIX
semaphores, shared memory, and message queues, so a system without a real
/dev directory is functionally crippled.
Apart from that, Cygwin automatically simulates POSIX devices
internally. The /dev directory is automagically
populated with existing POSIX devices by Cygwin in a way comparable with a
udev based virtual
/dev directory under Linux.
Cygwin supports the following character devices commonly found on POSIX systems:
/dev/null
/dev/zero
/dev/full
/dev/console Pseudo device name for the current console window of a session.
Cygwin's /dev/console is not quite comparable with the console
device on UNIX machines.
/dev/cons0 Console sessions are numbered from /dev/cons0 upwards.
/dev/cons1 Console device names are pseudo device names, only accessible
... from processes within this very console session. This is due
to a restriction in Windows.
/dev/tty The current controlling tty of a session.
/dev/ptmx Pseudo tty master device.
/dev/pty0 Pseudo ttys are numbered from /dev/pty0 upwards as they are
/dev/pty1 requested.
...
/dev/ttyS0 Serial communication devices. ttyS0 == Win32 COM1,
/dev/ttyS1 ttyS1 == COM2, etc.
...
/dev/pipe
/dev/fifo
/dev/kmsg Kernel message pipe, for usage with sys logger services.
/dev/random Random number generator.
/dev/urandom
/dev/dsp Default sound device of the system.
Cygwin also has several Windows-specific devices:
/dev/com1 The serial ports, starting with COM1 which is the same as ttyS0.
/dev/com2 Please use /dev/ttySx instead.
...
/dev/conin Same as Windows CONIN$.
/dev/conout Same as Windows CONOUT$.
/dev/clipboard The Windows clipboard, text only
/dev/windows The Windows message queue.
Block devices are accessible by Cygwin processes using fixed POSIX device
names. These POSIX device names are generated using a direct conversion
from the POSIX namespace to the internal NT namespace.
E.g. the first harddisk is the NT internal device \device\harddisk0\partition0
or the first partition on the third harddisk is \device\harddisk2\partition1.
The first floppy in the system is \device\floppy0, the first CD-ROM is
\device\cdrom0 and the first tape drive is \device\tape0.The mapping from physical device to the name of the device in the
internal NT namespace can be found in various places. For hard disks and
CD/DVD drives, the Windows "Disk Management" utility (part of the
"Computer Management" console) shows that the mapping of "Disk 0" is
\device\harddisk0. "CD-ROM 2" is \device\cdrom2. Another place to find
this mapping is the "Device Management" console. Disks have a
"Location" number, tapes have a "Tape Symbolic Name", etc.
Unfortunately, the places where this information is found is not very
well-defined.
For external disks (USB-drives, CF-cards in a cardreader, etc) you can use
Cygwin to show the mapping. /proc/partitions
contains a list of raw drives known to Cygwin. The df
command shows a list of drives and their respective sizes. If you match
the information between /proc/partitions and the
df output, you should be able to figure out which
external drive corresponds to which raw disk device name.Apart from tape devices which are not block devices and are
by default accessed directly, accessing mass storage devices raw
is something you should only do if you know what you're doing and know how to
handle the information. Writing to a raw
mass storage device you should only do if you
really know what you're doing and are aware
of the fact that any mistake can destroy important information, for the
device, and for you. So, please, handle this ability with care.
You have been warned.
Last but not least, the mapping from POSIX /dev namespace to internal
NT namespace is as follows:
POSIX device name Internal NT device name
/dev/st0 \device\tape0, rewind
/dev/nst0 \device\tape0, no-rewind
/dev/st1 \device\tape1
/dev/nst1 \device\tape1
...
/dev/st15
/dev/nst15
/dev/fd0 \device\floppy0
/dev/fd1 \device\floppy1
...
/dev/fd15
/dev/sr0 \device\cdrom0
/dev/sr1 \device\cdrom1
...
/dev/sr15
/dev/scd0 \device\cdrom0
/dev/scd1 \device\cdrom1
...
/dev/scd15
/dev/sda \device\harddisk0\partition0 (whole disk)
/dev/sda1 \device\harddisk0\partition1 (first partition)
...
/dev/sda15 \device\harddisk0\partition15 (fifteenth partition)
/dev/sdb \device\harddisk1\partition0
/dev/sdb1 \device\harddisk1\partition1
[up to]
/dev/sddx \device\harddisk127\partition0
/dev/sddx1 \device\harddisk127\partition1
...
/dev/sddx15 \device\harddisk127\partition15
if you don't like these device names, feel free to create symbolic
links as they are created on Linux systems for convenience:
ln -s /dev/sr0 /dev/cdrom
ln -s /dev/nst0 /dev/tape
...
The .exe extensionWin32 executable filenames end with .exe
but the .exe need not be included in the command,
so that traditional UNIX names can be used. However, for programs that
end in .bat and .com, you
cannot omit the extension. As a side effect, the ls filename gives
information about filename.exe if
filename.exe exists and filename
does not. In the same situation the function call
stat("filename",..) gives information about
filename.exe. The two files can be distinguished
by examining their inodes, as demonstrated below.
bash$ls *
a a.exe b.exe
bash$ls -i a a.exe
445885548 a 435996602 a.exe
bash$ls -i b b.exe
432961010 b 432961010 b.exe
If a shell script myprog and a program
myprog.exe coexist in a directory, the shell
script has precedence and is selected for execution of
myprog. Note that this was quite the reverse up to
Cygwin 1.5.19. It has been changed for consistency with the rest of Cygwin.
The gcc compiler produces an executable named
filename.exe when asked to produce
filename. This allows many makefiles written
for UNIX systems to work well under Cygwin.The /proc filesystem
Cygwin, like Linux and other similar operating systems, supports the
/proc virtual filesystem. The files in this
directory are representations of various aspects of your system,
for example the command cat /proc/cpuinfo
displays information such as what model and speed processor you have.
One unique aspect of the Cygwin /proc filesystem
is /proc/registry, see next section.
The Cygwin /proc is not as complete as the
one in Linux, but it provides significant capabilities. The
procps package contains several utilities
that use it.
2020-11-24Cygwin Projectproc52020-11-24CygwinCygwin User's Manualprocprocess and system information pseudo-filesystemDescriptionThe proc filesystem is a pseudo-filesystem
which provides an interface to Cygwin data structures.
It is commonly mounted at /proc.
Typically, it is mounted automatically by the system.
OverviewUnderneath /proc, there are the following
general groups of files and subdirectories:
/proc/[pid] subdirectoriesEach one of these subdirectories contains files and
subdirectories exposing information about the process with the
corresponding process id.
The /proc/[pid] subdirectories are
visible when iterating through /proc with
readdir2
(and thus are visible when one uses
ls1
to view the contents of /proc).
/proc/selfWhen a process accesses this magic symbolic link, it resolves
to the process's own /proc/[pid] directory.
/proc/[a-z]*Various other files and subdirectories under
/proc expose system-wide information.
All of the above are described in more detail below.
Files and directories
The following list provides details of many of the files
and directories under the /proc hierarchy.
/proc/[pid]
There is a numerical subdirectory for each running
process; the subdirectory is named by the process id.
Each /proc/[pid] subdirectory
contains the pseudo-files and directories described below.
The files inside each /proc/[pid]
directory are normally owned by the effective user and
effective group id of the process.
/proc/[pid]/cmdlineThis read-only file holds the complete command line for the
process, unless the process is a zombie.
In the latter case, there is nothing in this file: that is, a
read on this file will return 0 characters.
The command-line arguments appear in this file as a set of
strings followed by null bytes ('\0').
/proc/[pid]/ctty
This read-only file holds the name of the console or control
terminal device for the process, unless the process is detached
from any terminal.
In the latter case, there is only a newline in this file.
/proc/[pid]/cwd
This is a symbolic link to the current working directory of the
process.
To find out the current working directory of process 20, for
instance, you can do this:
$cd /proc/20/cwd; /bin/pwdNote that the pwd command
is often a shell built-in, and might not work properly. In
bash1,
you may use pwd -P.
/proc/[pid]/environ
This read-only file contains the current environment that may
have been changed by the currently executing program.
The entries are separated by null bytes ('\0'),
and there may be a null byte at the end.
Thus, to print out the environment of process 1, you would do:
$cat -A /proc/1/environIf, after an
execve2,
the process modifies its environment (e.g., by calling
functions such as
putenv3
or modifying the
environ7
variable directly), this file will reflect those changes.
That may not be the case on other systems such as Linux.
/proc/[pid]/exe
This file is a symbolic link containing the actual pathname of
the executed command.
This symbolic link can be dereferenced normally; attempting to
open it will open the executable.
You can even type /proc/[pid]/exe
to run another copy of the same executable that is being run by
process [pid].
/proc/[pid]/exe is a pointer to
the binary which was executed, and appears as a symbolic link.
/proc/[pid]/exename
This read-only file contains the actual pathname of the executed
command.
/proc/[pid]/fd/
This is a subdirectory containing one entry for each
file which the process has open, named by its file
descriptor, and which is a symbolic link to the actual
file.
Thus, 0 is standard input, 1 standard output, 2 standard
error, and so on.
For file descriptors for pipes and sockets, the entries will
be symbolic links whose content is the file type with the
inode. A
readlink2
call on this file returns a string in the format:
type:[inode]For example, socket:[2248868]
will be a socket and its inode is 2248868.
Programs that take a filename as a command-line argument, but
don't take input from standard input if no argument is supplied,
and programs that write to a file named as a command-line
argument, but don't send their output to standard output if no
argument is supplied, can nevertheless be made to use standard
input or standard output by using
/proc/[pid]/fd files as command-line
arguments.
For example, assuming that is the flag
designating an input file and is the flag
designating an output file:
$foobar -i /proc/self/fd/0 -o /proc/self/fd/1 ...
and you have a working filter.
/proc/self/fd/N is approximately
the same as /dev/fd/N in some Unix
and Unix-like systems.
Most Linux makedev scripts symbolically
link /dev/fd to
/proc/self/fd, in fact.
Most systems provide symbolic links
/dev/stdin,
/dev/stdout, and
/dev/stderr, which respectively link
to the files 0, 1,
and 2 in /proc/self/fd.
Thus the example command above could be written as:
$foobar -i /dev/stdin -o /dev/stdout ...
Note that for file descriptors referring to inodes (pipes and
sockets, see above), those inodes still have permission bits and
ownership information distinct from those of the
/proc/[pid]/fd entry, and that the
owner may differ from the user and group ids of the process.
An unprivileged process may lack permissions to open them, as in
this example:
$echo test | sudo -u nobody cattest$echo test | sudo -u nobody cat /proc/self/fd/0cat: /proc/self/fd/0: Permission denied
File descriptor 0 refers to the pipe created by the shell and
owned by that shell's user, which is not
nobody, so cat
does not have permission to create a new file descriptor to
read from that inode, even though it can still read from its
existing file descriptor 0.
/proc/[pid]/gid
This read-only file contains the primary group id for the
process.
/proc/[pid]/maps
A file containing the currently mapped memory regions and their
access permissions. See
mmap2
for some further information about memory mappings.
The format of the file is:
address perms offset dev inode pathname
00010000-00020000 rw-s 00000000 0000:0000 0 [win heap 1 default shared]
...
00080000-00082000 rw-p 00000000 0000:0000 0 [win heap 0 default grow]
00082000-0009A000 ===p 00002000 0000:0000 0 [win heap 0 default grow]
000A0000-000A1000 rw-p 00000000 0000:0000 0 [win heap 2 grow]
000A1000-000BA000 ===p 00001000 0000:0000 0 [win heap 2 grow]
000C0000-000D9000 rw-p 00000000 0000:0000 0 [win heap 0 default grow]
000D9000-001C0000 ===p 00019000 0000:0000 0 [win heap 0 default grow]
00200000-00377000 ===p 00000000 0000:0000 0
00377000-00378000 rw-p 00177000 0000:0000 0 [peb]
00378000-0037A000 rw-p 00178000 0000:0000 0 [teb (tid 8844)]
...
00400000-005F9000 ===p 00000000 0000:0000 0 [stack (tid 8884)]
005F9000-005FC000 rw-g 001F9000 0000:0000 0 [stack (tid 8884)]
005FC000-00600000 rw-p 001FC000 0000:0000 0 [stack (tid 8884)]
00600000-006C7000 r--s 00000000 EE45:4341 281474976741117 /proc/cygdrive/c/Windows/System32/locale.nls
...
100400000-100401000 r--p 00000000 EE45:4341 281474978095037 /usr/bin/sh.exe
100401000-100413000 r-xp 00001000 EE45:4341 281474978095037 /usr/bin/sh.exe
100413000-100414000 rw-p 00013000 EE45:4341 281474978095037 /usr/bin/sh.exe
...
180010000-180020000 rw-s 00000000 0000:0000 0 [procinfo]
180020000-180029000 rw-s 00000000 0000:0000 0 [cygwin-user-shared]
180030000-18003C000 rw-s 00000000 0000:0000 0 [cygwin-shared]
180040000-180041000 r--p 00000000 EE45:4341 2251799814294868 /usr/bin/cygwin1.dll
180041000-18022D000 r-xp 00001000 EE45:4341 2251799814294868 /usr/bin/cygwin1.dll
18022D000-180231000 rwxp 001ED000 EE45:4341 2251799814294868 /usr/bin/cygwin1.dll
180231000-18026A000 rw-p 001F1000 EE45:4341 2251799814294868 /usr/bin/cygwin1.dll
...
800000000-800090000 rw-p 00000000 0000:0000 0 [heap]
800090000-820000000 ===p 00090000 0000:0000 0 [heap]
7FF4FDEB0000-7FF4FDEB5000 r--s 00000000 0000:0000 0
7FF4FDEB5000-7FF4FDFB0000 ===s 00005000 0000:0000 0
7FF4FDFB0000-7FF5FDFD0000 ===p 00000000 0000:0000 0
...
7FFBEEAC0000-7FFBEEAC1000 r--p 00000000 EE45:4341 844424934724994 /proc/cygdrive/c/Windows/System32/kernel32.dll
7FFBEEAC1000-7FFBEEB36000 r-xp 00001000 EE45:4341 844424934724994 /proc/cygdrive/c/Windows/System32/kernel32.dll
7FFBEEB36000-7FFBEEB68000 r--p 00076000 EE45:4341 844424934724994 /proc/cygdrive/c/Windows/System32/kernel32.dll
7FFBEEB68000-7FFBEEB6A000 rw-p 000A8000 EE45:4341 844424934724994 /proc/cygdrive/c/Windows/System32/kernel32.dll
7FFBEEB6A000-7FFBEEB72000 r--p 000AA000 EE45:4341 844424934724994 /proc/cygdrive/c/Windows/System32/kernel32.dll
...
The address field is the address
space in the process that the mapping occupies.
The perms field is a set of permissions:
rreadwwritexexecute===reservedssharedgguardpprivateThe offset field is the offset
into the file/whatever;
dev is the device (major:minor);
inode is the inode on that device.
0 indicates that no inode is associated with the memory
region, as would be the case with BSS (uninitialized data).
The pathname field will usually
be the file that is backing the mapping.
There are additional helpful pseudo-paths:
[cygwin-shared]Global shared Cygwin process information.[cygwin-user-shared]Global shared Cygwin user information.[peb]Windows Process Environment Block.[procinfo]Cygwin process information.[shared-user-data]Shared user information.[heap]The process's heap.[stack]
The initial process's (also known as the main
thread's) stack.
[stack
(tid <tid>)]
A thread's stack (where the
<tid> is a thread id).
[teb
(tid <tid>)]
Windows Thread Environment Block (where
<tid> is a thread id).
[win heap <n>
default shared exec grow noserial debug]
Windows extended heap (where
<n> is a heap id)
and the rest of the words are heap flags:
defaultdefault heap flagssharedshareable and mapped heap flagsexecexecutable heap flaggrowgrowable heap flagnoserialdo not serialize heap flagdebugdebugged heap flagIf the pathname field is blank,
this is an anonymous mapping as obtained via
mmap2.
There is no easy way to coordinate this back to a process's
source, short of running it through
gdb1,
strace1,
or similar.
pathname is shown unescaped except
for newline characters, which are replaced with an
octal escape sequence.
As a result, it is not possible to determine whether the
original pathname contained a newline
character or the literal \e012
character sequence.
If the mapping is file-backed and the file has been deleted,
the string " (deleted)"
is appended to the pathname.
Note that this is ambiguous too.
/proc/[pid]/mountinfo
This file contains information about mount points in the
process's mount namespace (see
mount_namespaces7).
It supplies various information (e.g., propagation state, root
of mount for bind mounts, identifier for each mount and its
parent) that is missing from the (older)
/proc/[pid]/mounts
file, and fixes various other problems with that file (e.g.,
nonextensibility, failure to distinguish per-mount versus
per-superblock options).
The file contains lines of the form:
36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
(1)(2)(3) (4) (5) (6) (?) (7) (8) (9) (10)
The numbers in parentheses are labels for the descriptions below:
(1)mount id: a unique id for the mount (may be reused after
umount2).
(2)parent id: the id of the parent mount (or of self for
the root of this mount namespace's mount tree).
(3)major:minor:
the value of st_dev
for files on this filesystem (see
stat2).
(4)root: the pathname of the directory in the filesystem
which forms the root of this mount.
(5)mount point: the pathname of the mount point relative to
the process's root directory.
(6)mount options: per-mount options (see
mount2).
(?)optional fields: zero or more fields of the form
"tag[:value]";
see below.
(7)separator: the end of the optional fields is marked by a
single hyphen.
(8)filesystem type: the filesystem type in the form
"type[.subtype]".
(9)mount source: filesystem-specific information or
"none".
(10)super options: per-superblock options (see
mount2).
/proc/[pid]/mounts
This file lists all the filesystems currently mounted in the
process's mount namespace (see
mount_namespaces7).
The format of this file is documented in
fstab5.
/proc/[pid]/pgid
This read-only file contains the process group id for the
process.
/proc/[pid]/ppid
This read-only file contains the parent process id for the
process.
/proc/[pid]/root
UNIX and Linux support the idea of a per-process root of the
filesystem, set by the
chroot2 system call.
This file is a symbolic link that points to the process's root
directory, and behaves in the same way as
exe, and
fd/*.
/proc/[pid]/sid
This read-only file contains the session id for the process.
/proc/[pid]/stat
Status information about the process.
This is used by some implementations of
ps1.
The fields, in order, with their proper
scanf3 format specifiers, are listed below.
(1) pid %dThe process id.(2) comm %s
The filename of the executable, in parentheses.
This is visible whether or not the executable is swapped
out.
(3) state %c
One of the following characters, indicating process state:
RRunnableORunningSSleeping in an interruptible waitDWaiting in uninterruptible disk sleepZZombieTStopped (on a signal) or trace stopped(4) ppid %dThe PID of the parent of this process.(5) pgrp %dThe process group id of the process.(6) session %dThe session id of the process.(7) tty_nr %d
The controlling terminal of the process.
(The minor device number is contained in the combination
of bits 31 to 20 and 7 to 0; the major device number is in
bits 15 to 8.)
(8) tpgid %d
The id of the foreground process group of the controlling
terminal of the process.
(9) flags %uThe kernel flags word of the process.(10) minflt %lu
The number of minor faults the process has made which have
not required loading a memory page from disk.
(11) cminflt %lu
The number of minor faults that the process's waited-for
children have made.
(12) majflt %lu
The number of major faults the process has made which have
required loading a memory page from disk.
(13) cmajflt %lu
The number of major faults that the process's waited-for
children have made.
(14) utime %lu
Amount of time that this process has been scheduled in
user mode, measured in clock ticks (divide by
sysconf(_SC_CLK_TCK)).
(15) stime %lu
Amount of time that this process has been scheduled in
kernel mode, measured in clock ticks (divide by
sysconf(_SC_CLK_TCK)).
(16) cutime %ld
Amount of time that this process's waited-for children
have been scheduled in user mode, measured in clock ticks
(divide by sysconf(_SC_CLK_TCK)).
(See also
times2).
(17) cstime %ld
Amount of time that this process's waited-for children
have been scheduled in kernel mode, measured in clock
ticks (divide by sysconf(_SC_CLK_TCK)).
(18) priority %ld
For processes running a real-time scheduling policy
(policy below; see
sched_setscheduler2),
this is the negated scheduling priority, minus one; that
is, a number in the range -2 to -100, corresponding to
real-time priorities 1 to 99. For processes running
under a non-real-time scheduling policy, this is the raw
nice value
(setpriority2)
as represented in the kernel.
The kernel stores nice values as numbers in the range 0
(high) to 39 (low), corresponding to the user-visible nice
range of -20 to 19.
(19) nice %ld
The nice value (see
setpriority2), a value in the range 19 (low priority)
to -20 (high priority).
(20) num_threads %ld
Number of threads in this process. Currently shown as 0.
(21) itrealvalue %ld
The time in jiffies before the next
SIGALRM
is sent to the process due to an interval timer.
This field is no longer maintained, and is hard coded as 0.
(22) starttime %llu
The time the process started after system boot.
The value is expressed in clock ticks (divide by
sysconf(_SC_CLK_TCK)).
(23) vsize %luVirtual memory size in bytes.(24) rss %ld
Resident Set Size: number of pages the process has in real
memory.
This is just the pages which count toward text, data, or
stack space.
This does not include pages which have not been
demand-loaded in, or which are swapped out.
(25) rsslim %lu
Current soft limit in bytes on the rss of the process; see
the description of RLIMIT_RSS in
getrlimit2.
/proc/[pid]/statm
Provides information about memory usage, measured in pages.
The columns are:
(1) sizetotal program size
(same as VmSize in /proc/[pid]/status)(2) residentresident set size
(same as VmRSS in /proc/[pid]/status)(3) sharednumber of resident shared pages
(i.e., backed by a file) (same as RssFile+RssShmem in
/proc/[pid]/status)(4) texttext (code)(5) liblibrary(6) datadata + stack(7) dtdirty pages (always 0)/proc/[pid]/status
Provides much of the information in
/proc/[pid]/stat and
/proc/[pid]/statm
in a format that's easier for humans to parse.
Here's an example:
$cat /proc/$$/status
Name: bash
Umask: 0022
State: S (sleeping)
Tgid: 17248
Pid: 17248
PPid: 17200
Uid: 1000 1000 1000 1000
Gid: 100 100 100 100
VmSize: 131168 kB
VmLck: 0 kB
VmRSS: 13484 kB
VmData: 10332 kB
VmStk: 136 kB
VmExe: 992 kB
VmLib: 2104 kB
SigPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000000000384004
The fields are as follows:
Name:
Command run by this process.
Umask:
Process umask, expressed in octal with a leading zero; see
umask2.
State:
Current state of the process.
One of:
RrunnableOrunningSsleepingDdisk sleepTstopped or tracing stopZzombieTgid:
Thread group id (i.e., Process id).
Pid:
Thread id (see
gettid2).
PPid:
PID of parent process.
Uid,
Gid:
Real, effective, saved set, and filesystem UIDs (GIDs).
VmSize:
Virtual memory size.
VmLck:
Locked memory size (see
mlock2).
VmRSS:
Resident set size.
VmData,
VmStk,
VmExe:
Size of data, stack, and text segments.
VmLib:
Shared library code size.
SigPnd:
Number of signals pending for process as a whole (see
pthreads7 and
signal7).
SigBlk,
SigIgn:
Masks indicating signals being blocked and ignored (see
signal7).
/proc/[pid]/uid
This read-only file contains the user id for the process.
/proc/[pid]/winexename
This read-only file contains the Windows pathname of the
executed command.
/proc/[pid]/winpid
This read-only file contains the Windows process id for the
process.
/proc/cpuinfo
This is a collection of CPU and system architecture dependent
items, for each supported architecture a different list.
Two common entries are processor
which gives CPU number and
bogomips, a system constant
that is calculated during kernel initialization.
SMP machines have information for each CPU.
The
lscpu1
command gathers its information from this file.
/proc/cygdrive
This file is a symbolic link that points to the user's
Windows mapped drive mount point, similar to
root.
/proc/devices
Text listing of major numbers and device groups.
This can be used by makedev
scripts for consistency with the system.
/proc/filesystems
A text listing of the filesystems which are supported by Cygwin.
(See also
filesystems5.)
If a filesystem is marked with "nodev", this means that it
does not require a block device to be mounted (e.g., virtual
filesystem, network filesystem).
/proc/loadavg
The first three fields in this file are load average figures
giving the number of jobs in the run queue (state R)
averaged over 1, 5, and 15 minutes.
They are the same as the load average numbers given by
uptime1 and other programs.
The fourth field consists of two numbers separated by a slash (/).
The first of these is the number of currently runnable
scheduling entities (processes, threads).
The value after the slash is the number of scheduling entities
that currently exist on the system.
/proc/meminfo
This file reports statistics about memory usage on the system.
It is used by
free1
to report the amount of free and used memory (both physical
and swap) on the system as well as the shared memory and
buffers used by the system.
Each line of the file consists of a parameter name, followed by
a colon, the value of the parameter, and an option unit of
measurement (e.g., "kB").
The list below describes the parameter names and the format
specifier required to read the field value.
Some fields are displayed only if the system was configured
with various options; those dependencies are noted in the
list.
MemTotal %lu
Total usable RAM (i.e., physical RAM minus a few reserved
bits and the system binary code).
MemFree %lu
The sum of LowFree +
HighFree.
HighTotal %luTotal amount of highmem.HighFree %luAmount of free highmem.LowTotal %lu
Total amount of lowmem.
Lowmem is memory which can be used for everything that
highmem can be used for, but it is also available for the
system's use for its own data structures.
Bad things happen when you're out of lowmem.
LowFree %luAmount of free lowmem.SwapTotal %luTotal amount of swap space available.SwapFree %luAmount of swap space that is currently unused./proc/misc
Text listing of minor device numbers and names of devices with
major device number of the misc device group.
This can be used by makedev scripts
for consistency with the system.
/proc/mounts
With the introduction of per-process mount namespaces, this file
became a link to
/proc/self/mounts,
which lists the mount points of the process's own mount
namespace.
The format of this file is documented in
fstab5.
/proc/net
This directory contains various files and subdirectories
containing information about the networking layer.
The files contain ASCII structures and are, therefore, readable
with
cat1.
However, the standard
netstat8
suite provides much cleaner access to these files.
/proc/net/if_inet6
This file contains information about IP V6 interface adapters,
if used.
Each line represents an IP V6 interface adapter.
fe800000000000002c393d3da6108636 12 40 20 80 {C6B5FBE5-A3AC-4DB0-A308-8EE94E1406A4}
fe8000000000000039da016f76bd92bc 13 40 20 20 {E06B8972-0918-41FC-851B-090C446C7D1C}
fe8000000000000050ba9cedf1fe1628 0b 40 20 20 {680ED6FD-DFAC-4398-AA85-FB33E17E38EA}
fe8000000000000030c5c6a0b30f109d 11 40 20 20 {B9E39F53-1659-4065-BDA5-F41162250E03}
20021840ac2c12343427e3b9ec6fa585 08 40 00 80 {4083A7F8-99CF-4220-8715-6FDF268B002F}
20021840ac2c12342403e3b2c7a5a32f 08 80 00 20 {4083A7F8-99CF-4220-8715-6FDF268B002F}
20021840ac2c1234284e8d0ecb4160cb 08 80 00 20 {4083A7F8-99CF-4220-8715-6FDF268B002F}
20021840ac2c123468cb06ea72f1d678 08 80 00 80 {4083A7F8-99CF-4220-8715-6FDF268B002F}
20021840ac2c12346cb59aca97c36e3b 08 80 00 20 {4083A7F8-99CF-4220-8715-6FDF268B002F}
20021840ac2c123498af9881de1fb828 08 80 00 20 {4083A7F8-99CF-4220-8715-6FDF268B002F}
20021840ac2c1234cd62a3d73a498611 08 80 00 20 {4083A7F8-99CF-4220-8715-6FDF268B002F}
20021840ac2c1234e410c873be09df93 08 80 00 20 {4083A7F8-99CF-4220-8715-6FDF268B002F}
fe800000000000003427e3b9ec6fa585 08 40 20 80 {4083A7F8-99CF-4220-8715-6FDF268B002F}
00000000000000000000000000000001 01 80 10 80 {2B5345AC-7502-11EA-AC73-806E6F6E6963}
(1) (2)(3)(4)(5) (6)
The fields in each line are:
(1)The IP V6 address of the interface adapter.(2)The IP V6 interface adapter index.(3)
The prefix length of the IP V6 interface address.
(4)The scope of the IP V6 interface address.(5)The state of the IP V6 interface address.(6)
The DUID/GUID/UUID of the IP V6 interface adapter.
The last number exists only for compatibility reasons and is
always 1.
/proc/partitions
Contains the major and minor numbers of each partition as well
as the number of 1024-byte blocks and the partition name.
/proc/registry
Under Cygwin, this directory contains subdirectories for
registry paths, keys, and subkeys, and files named for registry
values which contain registry data, for the current process.
/proc/registry32
Under 64 bit Windows, this directory contains subdirectories for
registry paths, keys, and subkeys, and files named for registry
values which contain registry data, for 32 bit processes.
/proc/registry64
Under 64 bit Windows, this directory contains subdirectories for
registry paths, keys, and subkeys, and files named for registry
values which contain registry data, for 64 bit processes.
/proc/self
This directory refers to the process accessing the
/proc filesystem, and is identical to the
/proc directory named by the process id
of the same process.
/proc/stat
system statistics.
Varies with architecture.
Common entries include:
cpu 10132153 0 3084719 46828483cpu0 1393280 0 572056 13343292
The amount of time, measured in units of USER_HZ
(1/100ths of a second on most architectures, use
sysconf(_SC_CLK_TCK)
to obtain the right value), that the system ("cpu"
line) or the specific CPU
("cpu N" line)
spent in various states:
(1) userTime spent in user mode.(2) nice
Time spent in user mode with low priority
(nice).
(3) systemTime spent in system mode.(4) idleTime spent in the idle task.page 5741 1808
The number of pages the system paged in and the number
that were paged out (from disk).
swap 1 0
The number of swap pages that have been brought in and
out.
intr 1462898The number of interrupts serviced.ctxt 115315
The number of context switches that the system
underwent.
btime 769041601
boot time, in seconds since the Epoch,
1970-01-01 00:00:00 +0000 (UTC).
/proc/swaps
Swap areas in use.
See also
swapon8.
/proc/sys
This directory contains a number of files and subdirectories
linking to Windows objects, which can be read using these
entries.
String values may be terminated by either '\0'
or '\n'.
Integer and long values may be either in decimal or in
hexadecimal notation (e.g. 0x3FFF).
Multiple integer or long values may be separated by any of the
following whitespace characters:
' ', '\t', or
'\n'.
/proc/sysvipc
Subdirectory containing the pseudo-files
msg, semand
shm.
These files list the System V Interprocess Communication (IPC)
objects (respectively: message queues, semaphores, and shared
memory) that currently exist on the system, providing similar
information to that available via
ipcs1.
These files are only available if the cygserver Cygwin service
is running.
These files have headers and are formatted (one IPC object per
line) for easy understanding.
svipc7
provides further background on the information shown by these
files.
/proc/uptime
This file contains two numbers (values in seconds): the uptime
of the system (including time spent in suspend) and the amount
of time spent in the idle process.
/proc/version
This string identifies the Cygwin version that is currently
running.
For example:
CYGWIN_NT-10.0-18363 version 3.1.7-340.x86_64 (corinna@calimero) (gcc version 9.3.0 20200312 (Fedora Cygwin 9.3.0-1) (GCC) ) 2020-08-22 17:48 UTC
Notes
Many files contain strings (e.g., the environment and command
line) that are in the internal format, with subfields terminated
by null bytes ('\0').
When inspecting such files, you may find that the results are
more readable if you use a command of the following form to
display them:
$cat -A file
This manual page is incomplete, possibly inaccurate, and is the kind
of thing that needs to be updated very often.
See Alsocat1,
find1,
free1,
ps1,
pstree1,
tr1,
uptime1,
chroot2,
mmap2,
readlink2,
syslog2,
hier7,
arp8,
mount8,
netstat8,
route8.
The /proc/registry filesystem
The /proc/registry filesystem provides read-only
access to the Windows registry. It displays each KEY
as a directory and each VALUE as a file. As anytime
you deal with the Windows registry, use caution since changes may result
in an unstable or broken system. There are additionally subdirectories called
/proc/registry32 and /proc/registry64.
They are identical to /proc/registry on 32 bit
host OSes. On 64 bit host OSes, /proc/registry32
opens the 32 bit processes view on the registry, while
/proc/registry64 opens the 64 bit processes view.
Reserved characters ('/', '\', ':', and '%') or reserved names
(. and ..) are converted by
percent-encoding:
bash$regtool list -v '\HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices'
...
\DosDevices\C: (REG_BINARY) = cf a8 97 e8 00 08 fe f7
...
bash$cd /proc/registry/HKEY_LOCAL_MACHINE/SYSTEMbash$ls -l MountedDevices
...
-r--r----- 1 Admin SYSTEM 12 Dec 10 11:20 %5CDosDevices%5CC%3A
...
bash$od -t x1 MountedDevices/%5CDosDevices%5CC%3A
0000000 cf a8 97 e8 00 08 fe f7 01 00 00 00
The unnamed (default) value of a key can be accessed using the filename
@.
If a registry key contains a subkey and a value with the same name
foo, Cygwin displays the subkey as
foo and the value as foo%val.
The @pathnamesTo circumvent the limitations on shell line length in the native
Windows command shells, Cygwin programs, when invoked by non-Cygwin processes, expand their arguments
starting with "@" in a special way. If a file
pathname exists, the argument
@pathname expands recursively to the content of
pathname. Double quotes can be used inside the
file to delimit strings containing blank space.
In the following example compare the behaviors
/bin/echo when run from bash and from the Windows command prompt. Using @pathnamebash$/bin/echo 'This is "a long" line' > mylistbash$/bin/echo @mylist
@mylist
bash$cmdc:\>c:\cygwin\bin\echo @mylist
This is a long line