Linux short workshop

Section 1. Connecting to the server

You are assigned a server for this workshop. Find the server name on the workshop website. Instructions to connect can be found on this page.

https://biohpc.cornell.edu/lab/doc/remote_access.pdf

Section 2. The basics

2.1 create a working directory. ($USER is a Linux variable that is the same as your user ID)

pwd

mkdir /workdir/$USER

cd /workdir/$USER

pwd

2.2 Navigate around the Linux file system. Pay attention to whether absolute or relative path is used in each command. Try to use "copy-paste" and "tab" key to simplify typing.

cd /workdir/$USER

mkdir mytmp

ls -la

ls -la /workdir/$USER/mytmp

cd mytmp

pwd

cd ..

pwd

 

2.3 Operations on files.

Copy files ("./" mean current directory. It is necessary here as the "cp" command requires two parameters: source path and destination path. )

cd /workdir/$USER

cp /shared_data/Linux_workshop/examples.tgz ./

Compress/de-compress your copy of the examples.tgz file. "*" is used as wildcard in Linux

ls -al

tar -xzvf examples.tgz

ls -al

gzip flygenome.fa

ls -al flygenome*

gunzip flygenome.fa.gz

ls -al flygenome*

Moving file locations and change file names with "mv"

mkdir sequences

mv flygenome.fa sequences

mv short_reads.fastq sequences

ls -al ./

ls -al ./sequences/

 

Section 3. Something extra

3.1 Examine file content.

cd sequences

head -n 12 short_reads.fastq

tail -n 12 short_reads.fastq

more short_reads.fastq

wc -l short_reads.fastq

 

3.2 Working with .gz files

gzip short_reads.fastq

ls -l short*

zcat short_reads.fastq.gz | wc -l

zcat short_reads.fastq.gz | head -n 10

zcat short_reads.fastq.gz | grep AATTCGT

 

3.3 use Screen

screen

cd /workdir/$USER/sequences

zcat short_reads.fastq.gz | more 

Press "ctrl-a d" to detach from screen. Then run command "screen -r" to re-attach

More screen commands:

ctrl-a c: create a new session

ctrl-a n: switching between different screen session

ctrl-a d: detach from screen

ctrl-d: terminate a screen session

 

3.4 Use VNC (optional)

From a web browser, login to https://biohpc.cornell.edu. Open "My reservation" page, click "Connect VNC".

Open "VNC viewer", and the host name should be "cbsumm11.biohpc.cornell.edu:59xx" (replace 59xx with your VNC port number)

Click "Activities", click the "terminal" icon, and enter command "igv".