LinuxCommandLibrary

vdir

List directory contents in verbose format

TLDR

List files and directories in the current directory, one per line, with details

$ vdir
copy

List with sizes displayed in human-readable units (KB, MB, GB)
$ vdir [[-h|--human-readable]]
copy

List including hidden files (starting with a dot)
$ vdir [[-a|--all]]
copy

List files and directories sorting entries by size (largest first)
$ vdir -S
copy

List files and directories sorting entries by modification time (newest first)
$ vdir -t
copy

List grouping directories first
$ vdir --group-directories-first
copy

Recursively list all files and directories in a specific directory
$ vdir [[-R|--recursive]] [path/to/directory]
copy

SYNOPSIS

vdir [OPTION]... [FILE]...

PARAMETERS

All ls options
    Since vdir is fundamentally an alias for ls -l, it accepts and processes all options that the ls command supports. The -l option is implicitly applied, meaning any additional ls options will modify the detailed output further. For example, options like -a (to show hidden files), -h (for human-readable sizes), or -t (to sort by modification time) can be combined with vdir.

-a, --all
    Do not ignore entries starting with '.'. This reveals hidden files and directories that typically start with a dot.

-h, --human-readable
    With -l, print human readable sizes (e.g., 1K, 234M, 2G) instead of raw bytes, making output easier to read.

-r, --reverse
    Reverse order while sorting. This can be used to reverse the default alphabetic sort or a time/size sort.

-t
    Sort by modification time, newest first. If two files have the same modification time, their order is then determined by their name.

-S
    Sort by file size, largest first. If two files have the same size, their order is then determined by their name.

-R, --recursive
    List subdirectories recursively. This displays the contents of directories and their subdirectories, providing a comprehensive view.

DESCRIPTION

vdir is a command that acts as a convenience wrapper or symbolic link, typically to ls -l. Its primary function is to display the contents of directories in a detailed, long listing format. This format includes essential file information such as file permissions, the number of hard links, the owner's username, the group's name, the file size (in bytes by default), the last modification date and time, and the filename or directory name.

Essentially, vdir provides a quick way to get a verbose listing of files and directories, equivalent to typing 'ls -l' in the terminal. It is part of the GNU coreutils package and is widely available on most Unix-like operating systems, streamlining common file system inspection tasks by reducing keystrokes for a frequently desired output format.

CAVEATS

The behavior of vdir is entirely dependent on the underlying ls command on the system. It does not introduce any new or unique functionality beyond what ls -l provides. If ls is configured with aliases or specific environment variables (e.g., LS_COLORS), vdir will inherit those as well, which might slightly alter its output appearance (e.g., colorized output).

IMPLEMENTATION

On most Linux distributions, vdir is implemented as a hard link or symbolic link to the ls executable. When vdir is executed, it effectively calls ls internally with the -l option pre-applied. This lightweight implementation means it consumes minimal additional system resources compared to directly calling ls -l, serving purely as a syntactic convenience.

HISTORY

vdir is part of the GNU coreutils, a fundamental package of utilities for Unix-like operating systems. Its inclusion reflects a common usage pattern where users frequently require detailed listings of directory contents. Rather than repeatedly typing 'ls -l', vdir (along with dir for 'ls -C') was provided as a convenient shorthand. This practice of offering specific aliases for common command option combinations enhances usability and efficiency for command-line users, making frequently used commands more accessible.

SEE ALSO

ls(1), dir(1), stat(1)

Copied to clipboard