Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Advanced Linux Commands & Shell Scripting

Advanced Linux Commands & Shell Scripting

A short presentation on Advanced Linux Commands & Shell Scripting delivered to aspiring bioinformaticians in Advanced Genomics & Bioinformatics Workshop held at ILRI, Nairobi.

James Oguya

August 10, 2016
Tweet

More Decks by James Oguya

Other Decks in Technology

Transcript

  1. cp ◦ cp source destination • $ cp file1.txt file2.txt

    • $ mkdir files $ cp file2.txt files/ $ cp file1.txt file2.txt files/ $ cp -r files/ new-files/
  2. mv ◦ mv source destination $ mv file1.txt file3.txt $

    mv file3.txt new-files/ $ mv new-files/ old-files/ $ mv old-files/ files/ $ ls files/
  3. $ date >> today.txt $ cat today.txt • $ cat

    < today.txt $ ls files/ file99.txt 2> stderr $ ls files/ file99.txt 1> output 2> error $ cat output $ cat error
  4. ◦ $ cat streams | wc -l $ ls -l

    | less $ cat streams | grep file | wc -l
  5. grep ◦ grep substring file • -i $ grep date

    today.txt $ grep protein_coding gene-description.txt | wc -l
  6. ◦ head ◦ tail head tail ◦ commandA | head

    ◦ commandB | tail $ head -n5 gene-description.txt $ tail -n5 gene-description.txt
  7. script1.sh $ sh script1.sh • Date and time is: Mon

    Aug 8 12:30:54 EAT 2016 Your current directory is: /home/user1
  8. nano script3.sh for num in 1 2 3 do echo

    “we are on number: $num” done script3.sh $ sh script3.sh
  9. script4.sh for num in {1..3} do echo “we are on

    number: $num” done script4.sh $ sh script4.sh
  10. seq ◦ script5.sh for num in $(seq 1 3) do

    echo “we are on number: $num” done ◦ script5.sh $ sh script5.sh •