Computer Scientist, Graduate Student, and Geek

Tag: bash

LaTeX and BibTeX Search Path

October 22, 2009

I often write papers in LaTeX that use the ACM SIG Proceedings Template. Previously, I would put a copy of the LaTeX style file (.sty) in every directory where I had a LaTeX document that used it. Then I discovered I could set an environment variable to automatically have LaTeX search a path for a style file.

The TEXINPUTS environment variable works similar to the PATH environment variable: it is a list of paths where LaTeX should search for necessary class and style dependencies. I created a folder in my home directory where I keep the ACM SIG Proceedings Template LaTeX style file. I set the TEXINPUTS variable in my .bashrc.

There is also a BIBINPUTS environment variable to search for BibTeX files. I have started putting all the references I use in a single file, to avoid having small BibTeX files all over the place. I put my central BibTeX file in the same location as the LaTeX style file and set the BIBINPUTS variable in my .bashrc.

The following few lines in my .bashrc set the two environment variables:

# Include shared LaTeX classes and BibTeX files in path, if LaTeX folder exists
if [ -d "~/latex" ]; then
    export TEXINPUTS=".:~/latex/:"
    export BIBINPUTS=".:~/latex/:"
fi

Categories: Linux

Tags: bash, bibtex, latex


Tab Completion of SSH Hosts

August 28, 2009

I was tired of having to type full hostnames every time I wanted to SSH to a computer I commonly use. So, I setup tab completion for hostnames when I use SSH or SCP. The process involved only 3 simple steps.

  1. Create a file .hosts in your home directory. In the file, put the hostnames of computers you commonly connect to, one per line. Example .hosts file:
    subdomain.domain.com
    computer.domain.com
  2. Add three lines to your .bashrc file:
    HOSTFILE=~/.hosts
    complete -f -A hostname scp
    complete -A hostname ssh
  3. Enter the command
    source ~/.bashrc
    to reload your settings.

Categories: Linux, Networking

Tags: bash, ssh