← Previous | ↑ Home | → Next |
dk-ls [_options_] [_files_]
The dk-ls program shows information about files and directories. There are some differences to traditional "ls" or "dir" programs:
Option | Purpose |
---|---|
-p string --print-order=string |
Specify print order, see table below. The default is "mtpn" on non-Windows systems, "mtn" on Windows. |
-r --recursive |
Recursive listing. |
-f --stay-on-filesystem |
Stay on current file system for recursive listings. |
-s --summary |
Show summary at end (number of reported directories and files and total size in bytes). |
-t string --types=string |
Restrict output to directories (character "d") or files and other non-directory items (character "f"). Default is to show both. |
-m string ‑‑message‑digest=string |
Message digest type and encoding, see table below. The default is "md5.hex". |
-R --reset |
Reset, ignore preference settings for print order and message digest type. |
Each character in the print order string represents an output column.
Character | Information |
---|---|
n | File name For symbolic links the target file name is shown if the "n" character is the final character in the print order string. |
N | File name For symbolic links the target file name is not shown. |
s | File size. |
t | File type. |
p | File permissions (attributes on Windows systems). |
u | User ID of file owner (not on Windows systems). |
g | Group ID owning the file (not on Windows systems). |
c | Creation timestamp. |
m | Modification timestamp. |
a | Last access timestamp. |
l | Number of links (not on Windows systems). |
d | Device number (volume serial number on Windows systems). |
r | Relative device number (volume serial number on Windows systems). |
i | Inode number (file index on Windows systems). |
w | Windows reparse point tag value (only on Windows systems). |
x | Message digest (checksum). |
Output columns are separated by a space, except "di" by a colon and "tp" not separated, as "di" together form the unique file identifier and printing type and permission without space is the default in the "ls" program.
Message digest type and encoding. Digest type and encoding are separated by dot. The message digest type is one from:
The encoding is one from:
The default is "md5.hex".
File type output consists of two characters:
Link indicator | Type of link |
---|---|
- | Not a symbolic link. |
l | Symbolic link, target is in same file system as link. |
L | Symbolic link, target is in different file system. |
! | Dangling link, target does not exist. |
Type indicator | File type |
---|---|
- | Regular file. |
d | Directory. |
p | Pipe (FIFO). |
c | Character special device. |
b | Block special device. |
s | Socket. |
C | Multiplexed character special device. |
B | Multiplexed block special device. |
D | Name service door. |
e | Event port. |
o | Xenix special file. |
n | Xenix semaphore. |
m | Xenix shared data. |
v | VXFS compressed file. |
n | Network special file. |
w | Whiteout. |
a | ACL shadow entry. |
Short summary: Permissions are shown in the same notation as "ls -l" does.
The output consists of 3 groups:
Each group consists of 3 characters:
Character number | Character | Permission |
---|---|---|
1 | r | Read permission granted. |
- | No read permission granted. | |
2 | w | Write permission granted. |
- | Write permission not granted. | |
3 | x | Execute permission granted. |
- | Execute permission not granted. |
If the set user ID bit is set, the execution permission character for the user is changed from "x" to "s" or from "-" to "S".
If the set group ID bit is set, the execution permission character for the group is changed from "x" to "s" or from "-" to "S".
If the restricted deletion flag or sticky bit is set, the execution permission character for others is changed from "x" to "t" or from "-" to "T".
The file type on Windows consists of a reparse point character and a file type character.
Reparse point character | Indicates |
---|---|
- | File is not a reparse point. |
m | Mount point. |
l | Symbolic link. |
w | Mounted WIM image. |
s | SIS reparse point. |
n | NFS reparse point. |
c | CSV reparse point. |
d | DFS reparse point. |
f | DFSR reparse point. |
u | Deduplication reparse point. |
h | HSM reparse point. |
2 | HSM2 reparse point. |
File type character | Indicates |
---|---|
- | Regular file. |
d | Directory. |
b | Block device |
Attributes are written as group of characters.
Position | Character | Indicates |
---|---|---|
1 | R | Read only. |
- | Not read only. | |
2 | S | System file. |
- | Not a system file. | |
3 | H | Hidden. |
- | Not hidden. | |
4 | I | Indexed. |
- | Not indexed. | |
5 | C | Compressed. |
- | Not compressed. | |
6 | E | Encrypted. |
- | Not encrypted. | |
7 | O | Offline. |
- | Not offline. | |
8 | P | Sparse. |
- | Not sparse. | |
9 | T | Temporary. |
- | Not temporary. | |
10 | V | Virtual. |
- | Not virtual. |
0 on success, all other status codes indicate an error.
A sequence of question marks is printed if the program fails to obtain device number, volume serial number, inode number, or file index number.
A single question mark is printed if the program fails to obtain number of links, file owner UID, or file owner GID.
A sequence of "x" characters is printed if a message digest is requested for anything else than a regular file or if the program failed to read the file.
The following preferences can be used to set defaults:
Preference | Purpose |
---|---|
print.order | Print order if the -p option was not used. |
message.digest | Message digest type and encoding if the -m option was not used. |
On systems supporting hard links the program reports incorrect
directory sizes for directories containing the same file multiple
times as hard links. Each occurance is counted.
On Windows the file name length is restricted to _MAX_PATH (260) characters if the file name contains a wildcard (* or ? character).
On Windows systems user management and file permission concepts differ significantly from the concepts on Linux and Unix systems. The characters "u" and "g" in the print order specification have no effect.
On Windows systems there are different functions available to obtain information about files. Sometimes a function delivering less information succeeds for files where the default function delivering more information fails (i.e. when non-privileged processes ask for information about c:\pagefile.sys). In such situations we can not print volume serial number, file index or number of links. Question marks are shown instead.
On Windows systems the backslash is used for two purposes:
Quotes are used around text containing spaces to pass the entire text as one argument to a command. Unfortunately quoting also activates processing of backslashes as start of escape sequences.
Text typed in the shell |
Text passed as argument to a command |
Better type in the shell |
---|---|---|
C: | C: | |
"C:" | C: | |
C:\ | C:\ | |
"C:\" | C:" | "C:\\" |
C:\\ | C:\\ | |
"C:\\" | C:\ |
On non-Windows systems there is no reparse point tag, so a "w" in the print order specification has no effect.
This program uses DK libraries version 4.
To find the files last modified:
dk-ls -r -tf -pmtn | dk-sort
Program | Option | Purpose |
---|---|---|
dk-ls | List files. | |
-r | Recursive listing including all subdirectories. | |
-tf | Restrict output to files (non-directory items). | |
-pmtn | Set print order to:
|
|
dk-sort | Sort text line by line alphabetically. |
To find the largest files in a directory:
dk-ls -r -tf -pstn | dk-sort -u
Program | Option | Purpose |
---|---|---|
dk-ls | List files. | |
-r | Recursive listing including all subdirectories. | |
-tf | Restrict output to files (non-directory items). | |
-pstn | Set print order to:
|
|
dk-sort | Sort text line by line. | |
-u | Sort by unsigned number at start of line. |
To list all files, group by file type suffix and sort each group by size:
dk-ls -tf -psn | dk-sort -u -t -s 1
Program | Option | Purpose |
---|---|---|
dk-ls | List files. | |
-tf | Restrict output to files (non-directory items). | |
-psn | Set print order to:
|
|
dk-sort | Sort text line by line. | |
-u | Sort by unsigned number at start of line. | |
-t | Sort by file type suffix. | |
-s 1 | To find the file type suffix, skip the first text word in each line (the size). |
To find the largest subdirectory:
dk-ls -r -td -pstn | dk-sort -u
Program | Option | Purpose |
---|---|---|
dk-ls | List files. | |
-r | Recursive listing including all subdirectories. | |
-td | Restrict output to directories. | |
-pstn | Set print order to:
|
|
dk-sort | Sort text line by line. | |
-u | Sort by unsigned number at start of line. |
To list all files, group by file type suffix and sort each group by modification timestamp:
dk-ls -tf -pmn | dk-sort -t -s 2
Program | Option | Purpose |
---|---|---|
dk-ls | List files. | |
-tf | Restrict output to files (non-directory items). | |
-pmn | Set print order to:
|
|
dk-sort | Sort text line by line. | |
-t | Sort by file type suffix. | |
-s 2 | To find the file type suffix, skip the first two text words in each line (modification date and modification timestamp). |
← Previous | ↑ Home | → Next |