---
# System prepended metadata

title: RNA-Seq Workshop 2019
tags: [RNA-Seq, workshop]

---

---
title: 'RNA-Seq Workshop 2019'
disqus: hackmd
---

RNA-Seq Workshop 2019 -  Unix
===

## Table of Contents

[TOC]

## HTC Login
Open a Mac terminal and ssh using the below command. Before proceeding make sure you have sremote access.

```
ssh <pittusername>@htc.crc.pitt.edu
```

Replace pittusername with your pitt id. Below is an example on how to login into HTC.

```bash
$ ssh abc46@htc.crc.pitt.edu
Warning: the ECDSA host key for 'htc.crc.pitt.edu' differs from the key for the IP address '136.142.217.118'
Offending key for IP in /Users/Anish/.ssh/known_hosts:9
Matching host key in /Users/Anish/.ssh/known_hosts:12
Are you sure you want to continue connecting (yes/no)? yes
abc46@htc.crc.pitt.edu password: 
Last login: Fri Sep 27 14:49:16 2019 from sremote-10-195-22-70.vpn.pitt.edu

abc46: ~
$ 
```
If you have successfully logged in, you should be able to see your login screen.


## Basic Commands I
Few basic commands in unix are given below. Please note that, every command is followed by hitting enter.

1. You can view your login id, using the following command. 
```
$ whoami
abc46
```

2. To know your present working directory, simply type *pwd*.

```
$ pwd
/ihome/uchandran/abc46/rnaseq_wkshop
```
3. To list the contents of a directory, use the command *ls*.

```
$ ls
tmp file.txt
```

We can also list them in a long list format.

```
$ ls -l
drwxr-xr-x  3 abc46 uchandran  47 Oct  2 10:21 tmp
-rw-r--r-- 1 abc46 uchandran 13 Oct  2 10:21 file.txt
```

4. To create directories, we can use the command *mkdir*.
```
$ mkdir Jobs
$ ls
file.txt  Jobs tmp
$ ls -l
total 30
-rw-r--r-- 1 abc46 uchandran 13 Oct  2 10:21 file.txt
drwxr-xr-x 2 abc46 uchandran  0 Oct  2 10:28 Jobs
drwxr-xr-x 2 abc46 uchandran  0 Oct  2 10:18 tmp
$ pwd
/ihome/uchandran/abc46/rnaseq_wkshop
```
5. As you can see from the above *pwd* command, we have not changed directories by creating directories. To change directory, we use the command *cd*.
```
$ cd tmp/
$ pwd
/ihome/uchandran/abc46/rnaseq_wkshop/tmp
```

:::info
You can hit <tab> to auto-complete your commands and file/folder names.
:::

6. To clear the screen, just type the command clear and hit enter.

```
$ clear
```

7. To get the history of commands used, just type history and hit enter.
```
$ history
 1018  cd rnaseq_wkshop/
 1019  ls -lh
 1020  ls
 1021  mv file.txt ../
 1022  ls
 1023  clear
 1024  ls
 1025  ls -lh
 1026  pwd
 1027  mkdir Jobs
 1028  ls
 1029  ls -lh
 1030  mv ../file.txt .
 1031  ls
 1032  ls -lh
 1033  ls -l
 1034  cd tmp/
 1035  pwd
 1036  history
```
:::info
You can get documentation of each command in unix, by typing *man <command-name>*. For e.g., to get a manual page of the command *ls*, just type *man ls* and hit enter.
:::

## Basic commands II

1. We can copy files in unix using the command *cp*.

```
$ pwd
/ihome/uchandran/abc46/rnaseq_wkshop
$ ls
file.txt  Jobs  tmp
$ cp file.txt tmp/
$ ls
file.txt  Jobs  tmp
```

To check if the file has been copied into the folder tmp, we can either:
```
$ cd tmp/
$ ls
file.txt
```
or simply type
```
$ ls tmp/
file.txt
```
But to copy directories, we need use the option *-r*, which means copy contents recursively.

Let's say we are trying the copy the tmp folder and its contents in Jobs folder. You would use the following command:
```
$ cp -r tmp Jobs
$ ls Jobs
tmp
$ ls Jobs/tmp/
file.txt
```

2. We can check the beginning and end of the files using *head* and *tail* commands.
```
$ head file.txt 
one
two
three
four
five
six
seven
eight
nine
ten
$ tail file.txt 
three
four
five
six
seven
eight
nine
ten
eleven
twelve
```

3. We can also search for a pattern/string using *grep* command.
```
$ grep "six" file.txt 
six

```

4. You can also concatenate files using cat command.

```
$ cp file.txt file2.txt
$ cat file.txt file2.txt > combined_files.txt
$ ls
$ combined_files.txt  file2.txt  file.txt
```

5. wc gives the number of words, bytes and newline counts.

```
$ wc file.txt
12 12 63 file.txt
$ wc combined_files.txt
24 24 126 combined_files.txt
```

###### tags: `workshop` `RNA-Seq`
