---
# System prepended metadata

title: UNIX WIZARDRY
tags: [macmanes, ' unix tools']

---

---
tags: macmanes, unix tools
---

# UNIX WIZARDRY


The explicit goal of this tutorial is to provide you with some tricks and tools and to make your unix life happier. Also, to possibly introduce you to samtools. 


See https://github.com/stephenturner/oneliners for a bunch of examples. 



**ALIASES**: These are 'shortcuts' for make doing stuff more efficient.

```

  alias c='clear'
  alias gh='history | grep'
  alias ll='logout'
  alias l='ls -lth'
  alias mv='mv -i'
  alias cp='cp -i' 
  alias targz='tar -zcf'
  alias utargz='tar -zxf'
  
  alias tn="tmux new -s"
  alias ta="tmux attach -t"
  alias tl="tmux ls"
  alias tk="tmux kill-session -t"
```




**DOWNLOAD SOME DATA**

```

  mkdir /home/ubuntu/data
  cd /home/ubuntu/data
  curl -LO https://www.dropbox.com/s/5fymuyb1f2l8kfj/ngsfile.tar.gz
  utargz ngsfile.tar.gz
```

**Find a file**

```

  cd $HOME
  find / -name Trinity.fasta
  find / -type f -size +10M 2> /dev/null
```
**sed**

```

  cd /home/ubuntu/data/ngs2015
  less Trinity.fasta
  sed 's_|_-_g' Trinity.fasta | grep ^'>' | head
  sed -i 's_|_-_g' Trinity.fasta
 ```
 
**Number fasta def line**

```

  awk '/^>/{print ">" ++i; next}{print}' < Trinity.fasta > Trinity.numbered.fasta
  ```

**awk**

```

  less Trinity.counts.RNAseq.txt
  awk '{print $1 "\t" $3}' Trinity.counts.RNAseq.txt | head
  awk '$1 == "c996_g1_i1"' Trinity.counts.RNAseq.txt
```

**Random Stuff**

```

  cd -
  tmux/screen
```

========================
SAMTOOLS
========================

Let's learn something about samtools

