CentOS Debian Mint openSUSE Red Hat Ubuntu

Tree Command in Linux

Tree Command in Linux

Introduction

Like Windows, Linux also has a program called the tree that allows directories and lists of files to be displayed in a depth-indented. The tree command lists current directory contents. When directory is displayed, the tree command will list the files contained in that directory in turn.

And we will guide you on how to use the tree command in Linux as we did below. Hope you understand.

Installing tree command

Run apt command to install:

$ sudo apt install tree

Output:

The syntax of the tree command

$ tree [options] [directory]

options:

1. list current directory contents. Navigate to the directory and run:

$ tree

Output:

2. -a list all files

$ tree -a

Output:

3. -f print the full path

$ tree -f

Output:

4. -d list directories only

$ tree -d

Output:

5. -p show each file access permission

$ tree -p

Output:

6. -u print the username

$ tree -u

Output:

Conclusion

We have shown you how to use the tree command in Linux.

Thanks for referring!

Similar Posts