This is a random collection of useful shell scripts that I have accumulated over time. To use them, make sure you mark them as executable and place them in a folder on the path. My preferred location is ~/bin/.
compiler
: Script to compile LaTeX files into PDFs. Syntax iscompiler myfile.tex
which producesmyfile.pdf
in the working directory.compilerClean
: Script to compile LaTeX files into PDFs, but also remove all ancillary files that are not.tex
source or.pdf
output. Syntax iscompilerClean myfile.tex
which producesmyfile.pdf
in the working directory and deletes all intermediate compilation files.ducustom
: Custom disk usage that displays files sorted by size (largest to smallest) with arbitrary folder depth, e.g.ducustom 2
lists all files and directories in the current folder as well as its subfolder. Helpful for finding large files.find_replace_in_files
: Find and replace text in all files of a (set of) directories. Useful if workflow is dependent on file paths, and you just migrated servers.find_replace_in_files_input
: Similar to find_replace_in_files, but it allows you to execute the command from the terminal at the top of the directory tree you want to make changes in.git_find_big
: Find large files in a git tree. Found here.pdf2eps
: Convert PDF files to EPS format. Found here.ps2eps
: Convert PS files to EPS format (i.e. "encapsulate" them). Found here.shellexec
: Submit a generic shell script usingnohup
and send email upon completion.statampbatch
: Sample SLURM script for running a program in Stata-MP. Note that SLURM configurations differ by server, so check with your admin before attempting to use this.*hup
: Commands for submitting various statistical program scripts usingnohup
and sending email upon completion. Includes capabilities for Julia, Matlab, R, Stata, and SAS.
Finally, many of these files were created with the help of Jared Ashworth, which I gratefully acknowledge.