If you want to refer to a directory in UNIX (and, with little differences, in Windows too) you can use:
- Relative path
- Absolute path
We used some very simple commands during our first lab. Let see a new command. This post shows how to use two handy features of the shell: output redirection and program piping.
grep look for a patter into a line, and print it only if the pattern is present in the line. If we have a multifasta file, each header has a “>” sign. If we want to view all headers we can type:
grep ">" multifasta.fa
Most UNIX commands prints their output to screen. If we want to save that output we can use the “>” character:
ls -l > filelist.txt
we won’t see as usual the file listing with this command, because the “>” redirects ls’s output to the filelist.txt file. If we print the file:
we will have a proof.
A very useful feature of the UNIX shell is the possibility to send the output of a program to another program. This is done with the pipe character: |.
ls -la | head -n 3
With this command we will see the first three lines of the ls output. Nice?
cat multifasta.fa | grep ">" | wc -l