Internal Pages

Unix tips/reference

Useful command line statements

grep -H -r "text to search for" /home/user/*.txt
Search in files for a text string and return the filename (-H) and the text string

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
Stitch together multiple pdf files

montage -adjoin -frame 0 -tile 3x4 -mode concatenate -geometry 300x300 1.png 2.png 3.png null: 4.png null: null: 5.png null: null: 6.png null: montage.png
Stitch together multiple images files in a particular formation
convert -append spectral_width_differences_3* spw_output.png
Simpler, but less versatile, version of montage command

rename from to file_selector
e.g. rename .txt .csv *.txt
Will replace the file extension of all .txt files with .csv

tar -cvzf jpegarchive.tar.gz /path/to/images/*.jpg
Create compressed archive of files

tar -zxvf backup.tar.gz file.txt
Extract a file (file.txt) from a compressed archive. Omit last file name to extract all.
Replace -zxvf with -ztvf to list the files in an archive, rather than extract them all.

ps2pdf -dEPSCrop input_file.eps output_file.pdf
Convert an eps file to a pdf and crop tight to the figure (leaving almost no whitespace surrounding it)
can be followed by
mogrify -format png -density 200 -trim +repage output_file.pdf output_file.png
to convert that to a png file - use density 300 for extra high resolution output figure

ffmpeg -r 25 -pattern_type glob -i '*.JPG' -vb 20M movie_hires.mpg
Create a MPEG movie from a sequence of timestamped-JPEG images (usually ffmpeg requires sequentially numbered files)

Command-line keyboard shortcuts

Ctrl-A
Move cursor to beginning of line

Ctrl-E
Move cursor to end of line

Ctrl-T
Swap the order of the last two characters you typed

Ctrl-K
Cut the text to the right of the cursor and put it in the clipboard (to be pasted elsewhere, or not)
(useful with Ctrl-A, Ctrl-K to move to beginning of line and clear current line)

Things to do now

Links

Contact

Content-type: text/html

Page navigation