Tips & Examples
EXERCISES
• Additional informal exercises to try at the end of a chapter or section.
• To search for files at the command line using the Spotlight database, use the mdfind
command.
WINDOWS
• Bash shell is available on Windows 10! Note the comment here. More info to come, but you may be able to use that Linux environment directly without (much) extra configuration and installation.
• Installation of Ubuntu in the VirtualBox environment requires some special instructions to enact shared folders. For the latest VirtualBox installations (> v4) use these instructions. For older VirtualBox installations, see the detailed Windows instructions, similar to Appendix 1 of the book. In either case, an alternative is to install Dropbox folders on both systems.
• When using Cygwin, don't launch the cygwin-X terminal program, but use the "regular" Cygwin executable.
LINUX
• If you use the text editor gedit
, there is a plugin that enables using regular expressions during searches. Follow the instructions on the bottom of that web page to install. You may have to create the plugins folder that they refer to... (Thanks WF)
BASH SHELL
• Frustratingly, the cut
and sort
commands treat white space differently as the delimiter between columns. To convert several spaces to a tab character, interject the following in your pipeline:
| sed -E 's/ +/<ctrl-V><tab>/g'
.
- Sub-tip: To enter a tab in the line, precede it with ctrl-V, then the key (can be return, tab, etc.) It will just show the blank space of the character.
For example, to list and sort subdirectories by size using sort
instead of the ls
built-in options, use:
ls -l | sed -E 's/ +/<ctrl-V><tab>/g' |cut -f 5,9 |sort -n
• For curl
to use the same file names as the original, use the capital -O
option:
curl -O "http://www.rcsb.org/pdb/files/{1ema,1gfl,1g7k,1xmz}.pdb"
* To retrieve fasta formatted Genbank records, use a curl
command like:
curl -s "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&rettype=fasta&id=72256905"
See the NCBI Eutils reference page for more details.
PYTHON
• To install matplotlib, try this link.
• For the MySQLdb library, check this forum discussion. In essence, add the line export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
to your .bash_profile
file.
* To get syntax coloring for R in TextWrangler, save this file by Jonathan Bearak into your ~/Library/Application Support/TextWrangler/Language Modules
folder. (You may have to create the folder.) Then in the preferences under Languages, map a .R
suffix to that module.
GRAPHICS
• If you want to use ImageMagick (convert
and mogrify
) with EPS files (encapsulated PostScript), then you will need to install ghostscript
as well. One pre-packaged installer for OSX can be downloaded here.
HARDWARE
Other