November 4, 2024
Listing file permissions and user id when using Tree

Having a lot of folders and subfolders within them can make it somewhat messy to manage them.

Tree is a useful Linux tool that shows the entire directory/folder  structure in an easy to read tree like form using a nicely colored output all through the Linux Terminal.

To install it :

Open Terminal in Linux Mint / Ubuntu and type :

sudo apt-get install tree

After it is installed, type either “tree” or add the specific directory path after it to see the entire folder structure. (If nothing is specified, tree will list the structure of present working directory). For example, to see the directory structure of /var/log, simply type :

tree /var/log

Some useful parameters that can be used with tree are :

Listing only directories with the -d parameter :

Listing only directories using Tree command

Listing the user id as well as file permissions using the -u and -p parameters :

Listing file permissions and user id when using Tree

For really long and deep directory structures, it is better to use the ‘less’ switch to avoid the output from scrolling by typing tree|less.

For getting the directory/folder size in easy to read form like kilobytes (K), megabytes (MB) and so on, add the -h parameter :

Tree output with human readable format for folder size

Cheers.

By admin

Related Post