Unix Ninja-ry…Baby Steps

Learning to be a Unix Ninja from our very own Sensei:

Dr. Julian Catchen
University of Oregon

So today’s session was all about getting comfortable on the command line and learning how to bash around  a bit, manipulating files, moving through file systems developing the unix cunning which will work wonders for bioinformatic analysis in the future…though in the here and now it’s probably quite maddening and overwhelming.

  • By the end of these two weeks he plans to make us Unix/Linux converts
  • We googled ‘unix commands’ to obtain a cheat sheet of commands to help us if we forget.
  • By the end of this session you should know about the following, if not, go back to his slides and the Unix Tutorial
  1. change directories
  2. list files, list all files, list files that humans can read
  3. move up and down commands on the command line
  4. create directories
  5. know what relative vs. absolute paths are
  6. know how to figure out where you are
  7. know three ways to ‘get home’ from anywhere on the computer system
  8. know what tab and tab tab do and why they are totally cool
  9. more, head, tail and cat
  10. know how to unzip and de-tar files or do both at once
  11. what is grep?
  12. how to obtain line counts in a file

Here are the highlights!

  • Unix was originally developed by AT&T!
  • Steve Jobs was fired from Apple, developed Nextstep, Apple went into the tubes, re-hired Steve Jobs–Steve Jobs promptly threw their operating system out and applied Nextstep which because OSX (it’s Unix based).
  • Google Android runs Linux
  • Again, do check out the webpage Unix Tutorial which has a run down of all the specific commands and how to use them when navigating file structures, creating directories and files, copying, viewing, contatenating, moving, deleting as well as a review of the commands we used tonight to cut, search, count and manipulate text sequence files.
  • Also check out Lisa Johnson Cohen, one of our attendees, she has a great lab notebook with a run down of the powerpoint exercises you did in class tonight along with some pretty fetching pictures!

Live free or die: Unix! (on a license plate)

Computational biology is the art of learning Unix

  • If you can operate Unix well you can do anything, cure world hunger, advance world peace…ok maybe not but you could sure code like a maniac!

Commit yourself to the command prompt

  • Unix history is fantastically complicated
  • Lots of Unixes extinct
Holy *** that is a lot of Unix...
Holy *** that is a lot of Unix…

Today and tomorrow are just the beginning, not the end

  • There are two types of people: White with black text and Black with green text
  • Cheat sheets are awesome
  • Everything in Unix is a hierarchy
  • Bin = binary
  • Key concept is paths
  • Names do not make objects unique, paths do
  • mkdir = make directory

Type everything avoid your mouse at all costs!

  • Relative paths: Given from “here”  and are shorter easier to write but you have to remember and understand where here is
  • .  = here
  • .. = one level above where you currently are

bouncingman

Follow the bouncing stick man… Where are you in your file system? 

  • Foo
  • Bar
  • Foobar (Don’t ask why…it’s a computer scientist thing, in this case the less you know the better!)
  • All those little commands you type to help navigate files and file systems are actually little programs themselves. For example: ‘ls’ is a program developed in the 1970s

If you are typing you are doing it wrong, Unix people don’t like to type

  • Use the tab for completion
  • Up arrow gives you history
  • Type “history” copy paste a previous command
  • Ways to view text files
    • more
    • head
    • tail
    • cat
  • Keyboard maps: Are absolute MAYHEM!!! We’ll attempt to hopefully sort the chaos tomorrow!

Actual student Quote: “What I wouldn’t give the type a Tilde or @ sign right now!”

  • Ctrl V + tab

Here are the commands and terms we covered tonight…do you remember what they all mean?

mkdir   cd   shell   ls   direct/absolute paths   relative paths (uses dots)   /bin   cd ~/ (evil tilde!)  pwd   ls –l   
ls –la   ls –lh   man   more   head   tail   cp   gzip   gunzip   tar   tar xvfz   tar xvf   fasta format   fastq format   quality score   wc   wc -l   grep   grep –c   grep –v   |   cut   cut –f   cat   sort   uniq   >

Remember you can always type man followed by the command to learn more about the specific commands as well as all the options or ‘flags’ that you can set to help get the command to do what you want…

For instance:

>man wc

  • This will give you information on all the flags/options you can use with the word count command, like ‘-l’ which means count all the lines in the file…well gee that sounds useful!
The Ninja-ry continues tomorrow! And don’t forget about Lisa’s notebook which is a great resource for reviewing the exercise you all did today, the Evomics Unix Tutorial and Julian’s slides!
credit: Totem Head
credit: Totem Head

 

Leave a Reply

Your email address will not be published.