The ls command lists all the directories and files in the current directory that you are in. If you have subdirectories within the current directory and you want to know using the ls command what are the files within the subdirectories in a single execution you will need to make use of the -R option.
Example 1:# total 0
-rw-r--r--@ 1 c2ctech staff 0 May 4 21:46 Annual-Queries-2023.xlsx
drwxr-xr-x@ 5 c2ctech staff 160 May 4 22:00 Archive-2010-2020
drwxr-xr-x@ 4 c2ctech staff 128 May 4 22:01 Archive-2020-2030
-rw-r--r--@ 1 c2ctech staff 0 May 4 21:46 ToDo-List.txt
-rw-r--r-- 1 c2ctech staff 0 May 4 21:48 prod-script.py
-rw-r--r-- 1 c2ctech staff 0 May 4 21:48 satge-script.py
./Archive-2010-2020:
total 0
-rw-r--r-- 1 c2ctech staff 0 May 4 22:00 Annual-Queries-2010.xlsx
-rw-r--r-- 1 c2ctech staff 0 May 4 22:00 Annual-Queries-2011.xlsx
-rw-r--r-- 1 c2ctech staff 0 May 4 22:00 Annual-Queries-2018.xlsx
./Archive-2020-2030:
total 0
-rw-r--r-- 1 c2ctech staff 0 May 4 22:01 Annual-Queries-2021.xlsx
-rw-r--r-- 1 c2ctech staff 0 May 4 22:01 Annaul-Queries-2022.xlsx
As you can see in the above example, we have two subdirectories Archive-2010-2020 and Archive-2020-2030 and both of them have files in them. Using the -R flag we are able to recursively list all files and directories in the current directory and all of its subdirectories.
Example 2:

Have Questions? Post them here!
- How to Assign Bash Command to Variable
- How to Kill a port using bash terminal command?
- Bash For Loop Example
- bash: netstat: command not found
- Bash getopts Command Example
- How to fix bash ping command not found error
- [Fix] bash: script.sh: /bin/bash^M: bad interpreter: No such file or directory
- [fix] bash: ssh: command not found
- Fix bash: script.sh: Permission denied Error
- bash: ls command to see list files in current directory all subdirectories
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- How to use Autocomplete and Autosuggestion in Shell Commands
- Bash Hello World! Script Tutorial
- Install Bash Completion on macOS
- bash get year 2021 calendar
- How to create new user account in Windows bash
- Bash command to wait for seconds
- Know Bash shell version command
- How to start or open a new bourne-again shell (bash) session on Windows using Command Line CMD
- How to check your IP using bash for Windows?
- Bash Script to prefix files with sequential numbers in a directory
- How to Compare Strings in Bash
- Command to Sort File In Reverse Order [Unix/Linux/macOS]
- How to know the current shell you are logged in?
- List all Username and User ID using Bash Command
- How to generate ssh key? - HowTos
- JavaScript : redirect page to other url - Android
- How to add a Task List to Quick View Menu in SharePoint Online Site - SharePoint
- How to Use Command Prompt on a Mac? - MacOS
- [javaScript] Convert text case to lowercase - JavaScript
- How to find AUTO_INCREMENT Fields value in MySQL table - MySQL
- String Boot + Redis - SET and GET String Commands Examples - Java
- Implementing Android Text to Speech Example - Android