The command to list files in bash shell is "ls".
Few Examples of ls command usage:
Get the list of all files in the current directory
# ls Annual-Queries-2023.xlsx Archive-2020-2030 prod-script.py Archive-2010-2020 ToDo-List.txt satge-script.py
Get the list of all the files and directories in the current directory with more details.
# ls -l total 0 -rw-r--r--@ 1 c2ctech staff 0 May 4 21:46 Annual-Queries-2023.xlsx drwxr-xr-x@ 2 c2ctech staff 64 May 4 21:46 Archive-2010-2020 drwxr-xr-x@ 2 c2ctech staff 64 May 4 21:47 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
Get the list of all files including hidden ones
# ls -la total 0 drwxr-xr-x@ 11 c2ctech staff 352 May 4 21:50 . drwx------@ 17 c2ctech staff 544 May 4 21:48 .. -rw-r--r-- 1 c2ctech staff 234 May 4 21:50 .config -rw-r--r-- 1 c2ctech staff 0 May 4 21:50 .secret-records.csv drwxr-xr-x 2 c2ctech staff 3264 May 4 21:50 .unclassified -rw-r--r--@ 1 c2ctech staff 0 May 4 21:46 Annual-Queries-2023.xlsx drwxr-xr-x@ 2 c2ctech staff 26341 May 4 21:46 Archive-2010-2020 drwxr-xr-x@ 2 c2ctech staff 62341 May 4 21:47 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
Get all files and directories details in human-readable file sizes.
# ls -lh total 0 -rw-r--r--@ 1 c2ctech staff 12K May 4 21:46 Annual-Queries-2023.xlsx drwxr-xr-x@ 2 c2ctech staff 23K May 4 21:46 Archive-2010-2020 drwxr-xr-x@ 2 c2ctech staff 64B May 4 21:47 Archive-2020-2030 -rw-r--r--@ 1 c2ctech staff 1M May 4 21:46 ToDo-List.txt -rw-r--r-- 1 c2ctech staff 134B May 4 21:48 prod-script.py -rw-r--r-- 1 c2ctech staff 243B May 4 21:48 satge-script.py

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 Display content of a file in Terminal Screen? - Linux
- [FIX] AndroidRuntime: FATAL EXCEPTION: main - java.lang.RuntimeException NullPointerException - Android
- Read Java JDBC Connection Details from Properties File - Java
- How to turn off AirPods Nearyby notifications on macOS Big Sur? - Apple
- How to Install CVS Version Control on Linux/Ubuntu - Linux
- How to check your IP using bash for Windows? - Bash
- How to remove or uninstall Java from Ubuntu using apt-get - Linux
- Angular CLI ng Error: You need to specify a command before moving on. Use --help to view the available commands - HowTos