Seeing What's Inside
The ls command (List) is one of the most fundamental commands. It displays the contents (files and directories) of a given directory.
Basic Usage
If you run ls without any arguments, it lists the contents of your current working directory.
bash $ ls Desktop Documents Downloads Music Pictures Public Templates Videos
Listing Contents of Another Directory
You can specify a directory path as an argument to ls:
bash $ ls /etc
This will list the configuration files and folders found inside the /etc directory, regardless of where you currently are.
Color Coding
In most modern shells, ls uses color coding to help you differentiate types of entries:
- Blue: Directory
- White/Default: Regular File
- Green: Executable file or script
- Cyan: Symbolic Link