tree

Without being root

Install and run tree as not-root on an Ubuntu Linux system where it is not installed. If you have an account on the Swedish HPC centers, you will not have root-access and so have to install tree this way if it is missing.

  1. Create a directory to work in:
    mkdir ~/tree
    
  2. Change to that directory:
    cd ~/tree
    
  3. Download tree:
    apt download tree
    
  4. Extract the files:
    dpkg-deb -xv ./*deb ./
    
  5. Now you can run the tree command by giving the full path:
    ~/tree/usr/bin/tree
    

In order to run it without having to give the full path, create an alias in your ~/.bashrc file: 1. Open ~/.bashrc without your favourite editor. 2. Add this line at the end or with your other alias’es:

alias tree="$HOME/tree/usr/bin/tree"
3. Save the file. 4. source the file:
source ~/.bashrc

You can now run tree by just giving the command tree.

As root

  • sudo apt install tree