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

-a, --all
    Do not ignore entries starting with .

-l
    Use a long listing format.

--block-size=SIZE
    Use SIZE-byte blocks.

-d, --directory
    List directory entries instead of contents, and do not dereference symbolic links.

-h, --human-readable
    With -l and -s, print sizes in human readable format (e.g., 1K 234M 2G).

-i, --inode
    Print the index number of each file.

-s, --size
    Print the allocated size of each file, in blocks.

-t, --sort=time
    sort by modification time, newest first

--help
    Display this help and exit.

--version
    Output version information and exit.

[FILE]
    List FILE or directory contents. If no FILE is given, the current directory is assumed.

DESCRIPTION

The vdir command is a variant of the ls -l command, providing a more verbose listing of directory contents. It displays file size in bytes, modification time, ownership, permissions, and other details for each file and subdirectory within the specified directory. While ls -l is widely used and often aliased to provide similar output, vdir explicitly aims for a long listing format, making it useful in situations where a consistent, detailed view is required. It is a legacy command, and modern systems might directly link vdir to ls -l or alias it.

The primary distinction is historical and conceptual. vdir historically emphasized its verbosity and served as a distinct command. Nowadays, ls -l is more prevalent and functionally equivalent, often offering greater flexibility through its various options. The output is formatted for human readability and includes important metadata that can be useful for system administration, debugging, and general file management.

CAVEATS

On many modern systems, vdir is simply an alias or hard link to the ls -l command. Therefore, its behavior may be identical to ls -l. It's crucial to check your system's specific configuration. Any options provided to vdir will be passed to ls -l if it's an alias, potentially modifying the output differently than anticipated based on legacy documentation.

RETURN VALUE

The vdir command returns 0 on successful completion and a non-zero value if an error occurs.

HISTORY

The vdir command was initially developed as a more verbose alternative to the basic ls command. Its purpose was to provide a consistent, detailed view of directory contents, making it easier to assess file attributes such as permissions, size, and modification time. Over time, the functionality of ls has expanded with various options to provide similar verbosity, leading to a decrease in the distinct usage of vdir.

SEE ALSO

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

Copied to clipboard