Can I use a command (such as "tree") without installing it system wide?

tree doesn't seem to have particular dependencies (libc6) so I guess you can simply copy the executable (located in which tree on another system with tree installed or alternatively you can compile it from source, here's the home page of the project) in a directory on the Linux box which you're connected, say ~/bin/, then you just need to update your $PATH environment variable to add that directory.

If you're using Bash put this in your ~/.bashrc:

PATH=$PATH:~/bin/

Note: Be sure to match architecture and OS.


cd $HOME
# download latest tree source to home directory
wget http://mama.indstate.edu/users/ice/tree/src/tree-1.7.0.tgz
# unpack
tar xzfv tree-1.7.0.tgz
cd tree-1.7.0/
make
# install to $HOME directory
make install prefix=$HOME/bin
# this will create folders bin, and man
cd $HOME
# remove original source folder
rm -rf tree-1.7.0

# run tree
$HOME/bin/tree
# view man page
$HOME/man tree

You would usually build and install it on the prefix $HOME. That means the binary would go into $HOME/bin, libraries into $HOME/lib and so on. Then you insure that these directories appear on $PATH, $LD_LIBRARY_PATH, $MAN_PATH, etc (usualy by editting your shell startup files) and it will work transparently.

Here's a recipe that will work with many programs

$ cd $HOME
$ mkdir src
$ cd src
$ wget http://host.name/path/to/program.tgz
$ tar xzfv program.tgz
$ cd program
$ ./configure --PREFIX=$HOME
$ make
$ make install

Note that unlike installing on /usr/local there is never any need for root privilege.