How To List Directories In Linux or Unix Recursively

I‘m a new Linux and Unix-like system shell user. How can I get a recursive directory listing using command prompt on a Unix-like systems?

You can use any one of the following command to list files and directories in a recursive order on a Linux or Unix-like systems:[donotprint]
Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements None
Time 1m

=> ls command

=> find command

=> du command

Let use see examples of see a recursive directory listing in Unix.

ls command examples: Get a recursive directory

Type the following command list subdirectories recursively using the ls command:

ls -R
ls -l -R
ls -R /etc/
ls -R /nas01/ | more

Sample outputs:

Fig.01: ls command get a recursive directory listing

find command examples: Get a recursive directory

Type the following command:

find . -print
find . -ls
## or ##
find /path/to/search/ -print
find /path/to/search/ -ls

Sample outputs:

Fig.02: find command get a recursive directory listing on a Unix-like system

du command examples: Get a recursive directory

The syntax is as follows to see an entry for each file in a file hierarchy:

du -a .
du -a /path/to/search/
du -a /path/to/search/ | more

Sample outputs:

4	./SOURCES/nginx.suse.init
4	./SOURCES/logrotate
4	./SOURCES/nginx.init
4	./SOURCES/nginx.sysconf
752	./SOURCES/nginx-1.4.4.tar.gz
4	./SOURCES/nginx.vh.default.conf
4	./SOURCES/nginx.conf
4	./SOURCES/nginx.vh.example_ssl.conf
12	./SPECS/nginx.spec
16	./SPECS
804	.

For a more complete discussion of the commands used in this tutorial, see the online manual pages – du(1).

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @