The -R parameter of the ls command prints a recursive listing of a directory’s content, meaning that it
will list not only the files and directories in the current directory, but also the files and directories in
all the subdirectories12. For example, if you have a directory structure like this:
/home/user/ ├── dir1 │ ├── file1 │ └── file2 └── dir2 ├── file3 └── file4
You can use the command ls -R /home/user/ to list all the files and directories recursively, and the
output will look like this:
/home/user/: dir1 dir2
/home/user/dir1: file1 file2
/home/user/dir2: file3 file4
The -R parameter is also known as the --recursive option, which is the long form of the same
parameter12. You can use either -R or --recursive to achieve the same result.
Reference:
Use ls Command Recursively - Linux Handbook
How to List Files Recursively in Linux command line