Linux ls Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux ls Guide
Complete beginner-friendly guide to ls on Linux, covering Arch Linux, CachyOS, and other distributions including listing files, directory contents, and file information.
Table of Contents
Understanding ls
What is ls?
ls lists directory contents.
Uses:
- List files: Show files in directory
- Directory contents: View directory
- File information: See file details
- Navigation: Explore filesystem
Why it matters:
- Essential command: Most used command
- File management: Navigate files
- System exploration: Explore system
ls Basics
List Files
Basic usage:
# List files
ls
# List specific directory
ls /path/to/directory
# List current directory
ls .
Long Format
Detailed listing:
# Long format
ls -l
# Shows:
# - Permissions
# - Owner
# - Group
# - Size
# - Date
# - Name
ls Options
Common Options
Useful options:
# All files (including hidden)
ls -a
# Human readable sizes
ls -h
# Recursive
ls -R
# Sort by time
ls -t
# Reverse order
ls -r
Combined Options
Multiple flags:
# Long format, all files, human readable
ls -lah
# Recursive, long format
ls -lR
File Information
File Types
Identify types:
# Show file types
ls -F
# Indicators:
# / = directory
# * = executable
# @ = symlink
# | = FIFO
Color Output
Colored output:
# Color output
ls --color
# Or
ls --color=auto
Troubleshooting
ls Not Found
Check installation:
# Check ls
which ls
# Usually in coreutils
# Install if missing
sudo pacman -S coreutils
Summary
This guide covered ls usage, file listing, and directory navigation for Arch Linux, CachyOS, and other distributions.
Next Steps
- File Managers - GUI file managers
- find Guide - Finding files
- ls Documentation:
man ls
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.