dir: command not found

dir command in Linux lists the directory contents using one line per file. The special characters are represented by backslash escape sequences. This works similar to the command:

# ls -C --escape

If you encounter the below error while running the command dir:

dir: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install coreutils
Ubuntu apt-get install coreutils
Alpine apk add coreutils
Arch Linux pacman -S coreutils
Kali Linux apt-get install coreutils
CentOS yum install coreutils
Fedora dnf install coreutils
OS X brew install coreutils
Raspbian apt-get install coreutils

dir Command Examples

1. List all files, including hidden files:

# dir -all

2. List files including their author (`-l` is required):

# dir -l --author

3. List files excluding those that match a specified blob pattern:

# dir --hide=pattern

4. List subdirectories recursively:

# dir --recursive

5. Display help:

# dir --help
Related Post