In this tutorial you will learn about the tree command on Ubuntu Server in order to list contents of directories in a tree-like format.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# tree command on Ubuntu Server # List contents of directories in a tree-like format # Install tree sudo apt-get update sudo apt-get install tree # Usage cd ~/ tree /var/www/http.liviubalan.com/ cd /var/www/http.liviubalan.com/ tree # Listing options # All files are printed tree -a # List directories only tree -d # Prints the full path prefix for each file. tree -f tree -f /var/www/http.liviubalan.com/ # Max display depth of the directory tree tree -L 2 tree -L 3 # List only those files that match the wild-card pattern tree -P "*.txt" # Do not list those files that match the wild-card pattern tree -I "*.txt" # File options # Quote the names of files in double quotes tree -Q # Print the file type and permissions for each file (as per ls -l) tree -p # Print the username of the file tree -u # Print the group of the file tree -g # Print the size in bytes of the file tree -s # Human readable size of the file tree -h # Sorting options # Sort the output in reverse alphabetic order tree -r # Output options # XML output tree -X # Man page man tree # Useful links http://askubuntu.com/questions/431251/how-to-print-the-directory-tree-in-terminal |
Useful links:
http://askubuntu.com/questions/431251/how-to-print-the-directory-tree-in-terminal