System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf ·...

14
System Directory Hierarchy homes050 unixst02 others others others unixinst unixst01 quotation Quotation sequences bin a4_bovin.sw 1O91.pdb others pbtech_mounts © J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018. 1 /

Transcript of System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf ·...

Page 1: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

System Directory Hierarchy

homes050

unixst02 othersothersothersunixinst unixst01

quotationQuotationsequences bin

a4_bovin.sw 1O91.pdb others

pbtech_mounts

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

1

/

Page 2: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

homes050

unixst02 othersothersothersunixinst unixst01

quotationQuotationsequences bin

a4_bovin.sw 1O91.pdb others

pbtech_mounts

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

2

/

Relative Pathnamescat ../unixinst/quotation

Page 3: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

Your Directory Hierarchyunixstxx

human

dat

struct seq

cow

struct seq

rodent

struct seq

*.pdb *.fasta *.pdb *.pdb*.fasta *.fasta

othersothersothers

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

3

Page 4: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

stdout

UNIX Commands: No Redirectionsort

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

4

Page 5: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

stdout

UNIX Commands: Redirect inputsort < in.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

5

Page 6: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

stdout

UNIX Commands: Redirect Outputsort > sorted.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

6

Page 7: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

stdout

UNIX Commands: Redirect Outputsort > sorted.txt 2> err.log

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

7

Page 8: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

stdout

UNIX Commands: Combined Redirection

sort > sorted.txt 2>&1

stdin

stderr

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

8

Page 9: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

stdout

UNIX Commands: More examplessort < in.txt > sorted.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

9

Page 10: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

stdout

UNIX Commands: More examplessort < in.txt >> sorted.txt

stdin

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

stderr

10

Page 11: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

UNIX Commands: More examples sort < in.txt > sorted.txt 2>&1

stdoutstdin

stderr

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

11

Page 12: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

UNIX Commands: Pipesegrep PAT < in.txt | sort | head -1 > first.txt

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

12

Page 13: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

The csplit Commandcsplit seq.fasta '%^>%' '/^>/' '{3}’

csplit seq.fasta '%^>%' '/^>/' '/^>/' '/^>/' '/^>/'

xx00

xx01

xx02

xx03

xx04

5 patterns = 6 groups• Lines before the first match.• Lines from the first match up to

(but not including) the second match.• Lines from the second match up to

(but not including) the third match.• Lines from the third match up to

(but not including) the fourth match.• Lines from the fourth match up to

(but not including) the fifth match.• Lines from the fifth match up to

the end of the file.

>seqAMNSGVRMVTRSKVPVWEPQNWQ>seqBMEPPVPQSSVPGPPELAPTPAR>seqCPLDLKGPTAPPCTNEDDEGSCA>seqDSVICKAASGDTMNWNNITLTIV>seqESFRNFLGDIGCLISSNLLSYIK

%pattern% skip over this group (no file)/pattern/ create file for this group{n} repeat previous pattern n times

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

13

Page 14: System Directory Hierarchy - Cornell Universitychagall.med.cornell.edu/UNIXcourse/UnixSlides.pdf · System Directory Hierarchy homes050 unixst02 othersothers others unixinst unixst01

© J. Banfelder, L. Skrabanek, Weill Cornell Medicine, 2004-2018.

Modes of vi

SURF

EDIT

COMMAND

Aa

Ii

Oo

:

:wq

:q!

<Esc>

14