Ls Filedot Better
The ls -ld command is a variation of the ls command that provides detailed information about files and directories. The -l option stands for "long format," which displays file information in a detailed, human-readable format. The -d option stands for "directory," which tells ls to treat the specified directory as a file and display its information instead of listing its contents.
If you want to avoid listing . and .. while filtering for hidden files, use the following regular expression pattern: ls -d .[!.]* Use code with caution. Speeding Up with Aliases
Note: The -p flag adds a / to directories, helping you distinguish them from files. B. Using ls -d
Typing ls -lah or ls -lA continuously can become tedious. You can permanently save these commands into your shell's filedot configurations ( .bashrc or .zshrc ) as shortcuts. Open your configuration file: nano ~/.bashrc Use code with caution. Add custom aliases at the bottom of the file: alias l.='ls -d .[!.]*' alias la='ls -la' Use code with caution. Save the file and reload the shell configuration: source ~/.bashrc Use code with caution. ls filedot
: This represents the directory one level above your current location in the file system hierarchy . The ls command | Computing
# List all Python files ls *.py # List all Text documents ls *.txt Use code with caution. List Only Hidden Files with an Extension
The ls command is one of the very first tools you learn when entering a Linux or Unix terminal. By default, typing ls shows you the visible files and folders inside your current directory. However, you will quickly notice that some critical files—like configuration files, environmental variables, and system settings—are missing from this standard view. The ls -ld command is a variation of
Beyond hidden files, the single dot ( . ) is a special directory entry present in every Unix directory. It always points to the directory itself. When used as an argument to ls — ls . —it explicitly lists the contents of the current directory. This is functionally equivalent to ls with no arguments, but it becomes vital in relative path construction: cp /etc/hosts . copies a file into the current directory.
By default, file sizes display in bytes. Adding the -h flag converts those numbers into Kilobytes (K), Megabytes (M), or Gigabytes (G). ls -lah Use code with caution. Common Filedots and Their Purposes
While "ls filedot" might seem like a unique command, mastering ls involves understanding how to use ls . for the current directory and ls -a for hidden files. By combining ls with options like -l , -h , and -r , you can effectively manage, sort, and visualize your file system, making you a more efficient Linux user. If you want to avoid listing
find . -maxdepth 1 -type f -name ". " -o -name " .*"
The -t flag sorts by modification time, placing the newest files at the top, which is excellent for debugging recent system changes.
You can use the touch command to create a brand-new hidden file. touch .my_hidden_notes.txt Use code with caution. Hiding an Existing File