1 Readings

Practical Computing for Biologists: Chapters 1, 4, 5, Appendix 3.

Unix Basics from UConn CBC:

Software Carpentry Shell Novice lesson: Episodes 1-4:

2 Lesson overview

Command Function
pwd Print Working Directory
cd Change Directoy (cd, cd -, cd ~/<directory>, cd ..)
ls List files (ls -F, ls --help)
man Manual page for a command
mkdir Make a new directory
emacs A rudimentary command-line text editor
rm Delete file(s); use rm -r <directory> to delete directory and contents
touch Create empty file
cp Copy files and directories
mv Move or rename files and directories
wc Word Count (wc -l)
cat Print an entire file, or concatenate multiple files
less Read a file, one page at a time
sort Sort lines (sort -n, sort -r)
head Read beginning lines of a file (head -n #)
tail Read last few lines of a file (tail -n #)

2.1 Concepts:

  • Terminology and basic commands
  • Directory structure
  • Navigating through command line: relative vs absolute paths
  • Examining file contents
  • Using the * wildcard to select multiple files in a directory, using the [] wildcard to select one or more letters, e.g. *[AB].txt for file names ending in A or B.
  • Standard Output (stdout) and Standard Input (stdin) from commands can be combined using with pipes (|).
  • Redirect stdout to files (>).

2.2 Why learn the command-line?

  • The majority of bioinformatics and computational software is developed for command-line use from the shell
  • Low system resource use (processor and memory)
  • Easier to automate and more adaptable than GUIs
  • Web-based tools are at risk of becoming obsolete (e.g. Galaxy, GenomeSpace) as more scientists devolop command-line competence

Notes about reading these documents:

Sections highlighted in grey are shell input or “standard input” (stdin).
Lines following it prefixed by '##' denote shell output or “standard output” (stdout):

x='Welcome to MEDS 5420'
echo $x
## Welcome to MEDS 5420

3 Interacting with your computer: the terminal

You will communicate with the operating system (OS) by typing commands into the terminal window. You can use the terminal window to:

4 Bash, Shell, Terminal, Command Line: What’s the difference?

Command Line is the most general and refers to typing commands directly into a terminal that can be executed by the computer.
Shell (sh) is specific program (language written by Steve Bourne while at Bell Labs) that processes commands and returns output.
Bash stands for Bourne Again Shell and is an updated version of the Shell language. This is the most popular Shell.
Terminal is a user interface that takes input and provides an output in text format; the interface runs the input through Shell or Bash to process the command.