Monday, June 28, 2010

Creating Aliases to work on the most recent file

Often while compiling latex files you need to access the most recent .tex, .ps or .pdf file. Sometimes if those file names are long it is often annoying to write them everytime. Here is a set of commands which will work on the last edited/touched file of the specified type.

alias latex. 'latex `ls -t *.tex | head -1` &'
alias emacs. 'emacs `ls -t *.tex | head -1` &'
alias pdf. 'acroread `ls -t *.pdf | head -1` &'
alias acroread. 'acroread `ls -t *.pdf | head -1` &'
alias ps2pdf. 'ps2pdf `ls -t *.ps | head -1` &'
alias lpr.. 'lpr `ls -t *.ps | head -1` &'
alias gv. 'gv `ls -t *.ps | head -1` &'
alias gvl. 'gv --orientation=landscape `ls -t *.ps | head -1` &'
alias lpr. 'lpr `ls -t *.ps | head -1` &'
alias lpdf. 'lpdf `ls -t *.pdf | head -1` &'

Combine several pdf files using ghostview

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=all.pdf -dBATCH a.pdf b.pdf c.pdf

Opening display configuration from commandline

Often in a dual head one of the screens is stuck. You can open the display configuration using

sudo /usr/bin/system-config-display


and then when nvidia refreshes ... just cancel the configuration. You will get you screens back without having to Ctrl-Alt-Backspace