LS Options Flashcards
(9 cards)
1
Q
What does ls -l display?
A
- Shows detailed file information in long format including permissions, ownership, size, and timestamps
- Displays file type, links count, owner, group, size in bytes, and modification date
- Essential for viewing file attributes and permissions for system administration
2
Q
How does ls -a differ from regular ls?
A
- Shows all files including hidden files that start with a dot (.)
- Reveals configuration files like .bashrc, .profile, and system files like . and ..
- Critical for finding hidden configuration files and troubleshooting
3
Q
What information does ls -h provide?
A
- Displays file sizes in human-readable format (K, M, G instead of bytes)
- Must be combined with -l to show sizes: ls -lh
- Makes it easier to quickly assess disk usage and file sizes
4
Q
What is the purpose of ls -t?
A
- Sorts files by modification time, newest first
- Helps identify recently changed files for troubleshooting or maintenance
- Often combined with -l for detailed timestamps: ls -lt
5
Q
How does ls -S organize output?
A
- Sorts files by size, largest first
- Useful for identifying large files consuming disk space
- Commonly used with -lh for readable sizes: ls -lhS
6
Q
What does ls -R accomplish?
A
- Recursively lists contents of directories and all subdirectories
- Shows complete directory tree structure beneath current location
- Useful for getting overview of entire directory hierarchy
7
Q
When would you use ls -d?
A
- Lists directories themselves, not their contents
- Prevents ls from entering and listing directory contents
- Example: ls -ld /home/*/ shows only directory names with details
8
Q
What is ls -i used for?
A
- Shows inode numbers for each file and directory
- Useful for identifying hard links (files with same inode number)
- Important for advanced file system troubleshooting and link management
9
Q
How does ls –color enhance output?
A
- Adds color coding to distinguish file types (directories, executables, links, etc.)
- often aliased by default in modern Linux distributions
- Improves readability and quick identification of different file types