Here are some useful shortcuts and options for the ls command in Bash:
-
ls -l: Lists files in long format, showing details like permissions, owner, size, and modification date.ls -l -
ls -a: Displays all files, including hidden files (those starting with a dot).ls -a -
ls -h: Shows file sizes in a human-readable format (e.g., KB, MB) when used with-l.ls -lh -
ls -R: Recursively lists all files and directories within the current directory and its subdirectories.ls -R -
ls -t: Sorts files by modification time, showing the most recently modified files first.ls -lt -
ls -S: Sorts files by size, with the largest files listed first.ls -lS -
ls -1: Lists one file per line, which can be useful for readability.ls -1 -
ls -d */: Lists only directories in the current directory.ls -d */ -
ls -F: Appends a character to each file name to indicate its type (e.g.,/for directories,*for executables).ls -F -
Combining Options: You can combine multiple options for more specific listings.
ls -laht # Lists all files in long format, human-readable sizes, sorted by time
These options enhance the functionality of the ls command, making it easier to view and manage files. If you have any specific scenarios in mind or need further details, let me know!
