This will do almost exactly what dir
does (it will ignore ..
and it won't print symlinks' resolved path along with their acual path), but it will print full paths instead of relative paths, including directories, files, symlinks and hidden entries:
find . -maxdepth 1 -exec realpath -s {} +
find . -maxdepth 1 -exec [...] {} +
: will list every directory / file / symlink in the current working directory, including hidden entries, recursively, limiting the recursion's depth to 1 level (i.e. to the current working directory), passing each line of the output as an argument to[...]
;realpath -s
: will print the full path of an entry, without resolving symlinks' paths
Since this will print entries based on find
's output, I'd sort the output and put it in an alias for convenience:
alias my_dir='find . -maxdepth 1 -exec realpath -s {} + | LC_COLLATE=C sort'
% tree -a .├── dir│ ├── file1│ ├── file2│ └── file3├── file├── .hidden└── symlink -> /bin3 directories, 5 files% dir totale 2,1M-rw-rw-r-- 1 user user 0 mag 18 04:12 .hidden-rw-rw-r-- 1 user user 0 mag 18 04:11 filelrwxrwxrwx 1 user user 4 mag 18 04:12 symlink -> /bindrwxrwxr-x 2 user user 4,0K mag 18 04:12 dirdrwxr-x--- 24 user user 4,0K mag 18 04:14 ..drwxrwxr-x 3 user user 2,1M mag 18 04:12 .% alias my_dir='find . -maxdepth 1 -exec realpath -s {} + | LC_COLLATE=C sort'% my_dir/home/user/playground/home/user/playground/.hidden/home/user/playground/dir/home/user/playground/file/home/user/playground/symlink