When you navigate a Linux file system in the terminal, the ls command is the standard utility for listing directory contents. However, by default, ls outputs a bare-bones, space-separated list of filenames. To see file sizes, ownership, and permissions, you have to add the -l (long format) flag every single time you run it. If you find yourself constantly typing ls -l to get the detailed information you need, you should consider using the vdir command instead.
How the vdir Command Works
The vdir command is essentially a pre-packaged alias built directly into the GNU Core Utilities. It is exactly identical to the ls command, but with one critical difference: it is hardcoded to output in the “long” listing format by default.
Running vdir is functionally the exact same as running ls -l -b. The -b flag ensures that any strange, non-printable characters (like spaces) in filenames are safely escaped with backslashes, making the output highly reliable for scripting.
Basic Usage
To list the contents of your current directory in long format, simply type the command and press Enter.
vdir
The output will be an organized, multi-column list. From left to right, you will see:
- The 10-character string detailing file type and permissions (e.g.,
-rw-r--r--). - The number of hard links.
- The owner of the file (user).
- The group the file belongs to.
- The exact size of the file in bytes.
- The date and time the file was last modified.
- The actual name of the file or directory.
Adding Helpful Flags
Because vdir is just a specialized version of ls, it accepts almost all the same flags. By default, vdir hides “dotfiles” (system files that start with a period). It also prints file sizes in raw bytes, which is difficult to read for massive files.
To view absolutely everything, including hidden system files, and format the file sizes into readable Megabytes and Gigabytes, combine the -a (all) and -h (human-readable) flags.
vdir -ah
If you need to investigate a specific directory rather than your current location, just append the absolute path to the end of the command:
vdir -ah /var/log/
While power users often set up custom bash aliases (like mapping ll to ls -la) to achieve similar results, vdir is guaranteed to be available on almost any GNU Linux system out of the box, making it an excellent tool for administrators working on fresh server deployments.