Skip to content

Instantly share code, notes, and snippets.

@dalgu90
Created February 19, 2018 03:03
Show Gist options
  • Save dalgu90/4c2b3dd68e6fe84c1f5017775019de78 to your computer and use it in GitHub Desktop.
Save dalgu90/4c2b3dd68e6fe84c1f5017775019de78 to your computer and use it in GitHub Desktop.
Install linux tree command on local path
#!/bin/sh
PREFIX="$HOME/.local/"
install_tree() {
# The project page of linux "tree" command is located at http://mama.indstate.edu/users/ice/tree
TMP_TREE_DIR="/tmp/$USER/tree"; mkdir -p $TMP_TREE_DIR
wget -nc -O $TMP_TREE_DIR/tree.tgz "http://mama.indstate.edu/users/ice/tree/src/tree-1.7.0.tgz"
tar -xvzf $TMP_TREE_DIR/tree.tgz -C $TMP_TREE_DIR --strip-components 1
cd $TMP_TREE_DIR
make
mkdir -p "$PREFIX/bin"
mv -v tree "$PREFIX/bin"
# Maybe $PREFIX/bin was added to $PATH, if you run the wookayin/dotfiles script
# echo "export PATH=$PREFIX/bin:$PATH"
}
install_tree
@338rajesh
Copy link

Thanks!
It helped me to install tree without super user permissions.

@feevos
Copy link

feevos commented Feb 15, 2021

thanks, super helpful!

@thirumoorthyguna
Copy link

thirumoorthyguna commented Nov 12, 2024

source install_tree_local.sh
--2024-11-12 09:11:07-- http://mama.indstate.edu/users/ice/tree/src/tree-1.7.0.tgz
Resolving mama.indstate.edu (mama.indstate.edu)... failed: Name or service not known.
wget: unable to resolve host address \u2018mama.indstate.edu\u2019

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
make: *** No targets specified and no makefile found. Stop.
mv: cannot stat \u2018tree\u2019: No such file or directory

Getting this error when I run that code. Can you please help ?

@gcjyzdd
Copy link

gcjyzdd commented Apr 4, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment