Unix: Print Directory Tree Structure

The tree command has been around in Windows for a very long time to print out the directory structure but this is still not available in most of the Unix variants. Most of the new Linux distributions do seem to have the tree command available.

If the tree command is not available, you may try to run the following one-liner to simulate the tree command.

If the directories are being printed out without the lines appearing in the above command, try the alternative command below.

The output may not give the exact directory structure output as the native tree command, but it does get the job done.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }

« Previous Article