Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15...

63

Transcript of Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15...

Page 1: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se
Page 3: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Linux Introduction

You will not learn this now.Google it or look at lecture slides when you need it.

Practice makes perfect :)

Page 4: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Linux

Page 5: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Linux

Page 6: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Uppsala Multidisciplinary Center for Advanced Computational Science

(Uppsala supercomputer center)

UPPMAX

Page 7: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computer clustersMilou

Rackham

Bianca

Page 8: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computer clustersMilou

Rackham

Bianca

Page 9: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Why Text?

UPPMAX is accessible over the internet

Command Line Interface (CLI)

Terminal

Page 10: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computers

Files and programs

Page 11: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Files and directories

File structure(directory tree)

Page 12: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Directory tree

Page 13: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computers

Files and programs

Page 14: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Commands

programs = commands

Page 15: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Commands

program_name -parameter1 -parameter2 input_file output_file

Page 16: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

home directoryyour own (account) directory

working directorythe directory you are “sitting” in now

Page 17: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

pwd – print working directory

Page 18: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

pwd – print working directory

Page 19: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

ls – list the content of a directory

Page 20: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

ls – list the content of a directory

Page 21: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

ls – list the content of a directory

Page 22: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

ls – list the content of a directory

Page 23: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

cd – change working directory

cd <directory name> = down/forward

Page 24: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

cd – change working directory

cd <directory name> = down/forward

Page 25: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

cd – change working directory

cd <directory name> = down/forward

cd .. = up/back

Page 26: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

cd – change working directory

cd <directory name> = down/forward

cd .. = up/back

Page 27: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

cd – change working directory

cd <directory name> = down/forward

cd .. = up/back

cd = go home= cd /home/dahlo/

Page 28: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

Summarypwd – print working directoryls – list content of directorycd – change working directory

Page 29: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

cp - copy a filecp <name of original> <name of copy>

Page 30: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

cp - copy a filecp <name of original> <name of copy> cp myText.txt copy_of_my_text.txt

Page 31: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

cp - copy a filecp <name of original> <name of copy> cp /home/dahlo/test.txt ../../myDocs/

Page 32: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

mv - move a filemv <name of the file> <name of the “copy”> mv /home/dahlo/test.txt ../../myDocs/

Page 33: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

mv - rename a filemv <original name> <new name> mv myText.txt copy_of_my_text.txt

Page 34: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

less - view content of a fileless <file name> less readme.txt

Page 35: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

less - view content of a fileless <file name> less readme.txt

Page 36: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

less - view content of a fileless <file name> less readme.txt

press Q to exit less

Page 37: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Head

head - view the first rows of a filehead <filename>

Page 38: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Head

head - view the first rows of a filehead <filename>

Page 39: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Head

head - view the first rows of a filehead <filename>

Page 40: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Head

head - view the first rows of a filehead <filename>

Page 41: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Head

head - view the first rows of a filehead -n <nr of lines> <filename>

Page 42: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Tail

tail - view the last rows of a filetail <filename>

Page 43: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Tail

tail - view the last n rows of a filetail -n <nr of lines> <filename>

Page 44: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

nano - edit content of a filenano <file name> nano readme.txt

Page 45: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

nano - edit content of a filenano <file name>nano readme.txt

^ = ctrl

Page 46: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Interaction Commands

rm - remove a filerm <file name> Ex.

rm readme.txtrm ../../../file1.txtrm /home/dahlo/test.txt

There is no trash bin in CLI! Gone is gone..

Page 47: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Page 48: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Page 49: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Page 50: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Ex:

cp *.txt directory1/

Page 51: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Ex:

rm *.tmp

Page 52: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

The most important thing

TABCOMPLETION

(try to) never type a path or filename without it!

Page 53: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

TAB COMPLETION(try to) never type a path or filename without it!

Page 54: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

TAB COMPLETION(try to) never type a path or filename without it!

Page 55: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

TAB COMPLETION(try to) never type a path or filename without it!

Page 56: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

TAB COMPLETION(try to) never type a path or filename without it!

Page 57: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Good to Know Commands

top - how much is the computer working?top

Page 58: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Instructions how to use programsEasy to forget syntaxManual pages man <program name>Ex.

man ls

(q to quit)

Good to Know Commands

Page 59: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

How do I log out?exit

Exits only the current terminal

Good to Know Commands

Page 60: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

■ Summary■ cp – copy a file■ mv – move a file■ less – view a file ■ nano – view and edit a file■ rm – remove a file■ head / tail■ wildcards■ tab completion – use it!!!■ top – see active processes■ man – manual pages■ exit – Log out current terminal

Good to Know Commands

Page 61: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Connect to UPPMAX

ssh - Secure SHell connection (ssh)

ssh -Y <username>@milou.uppmax.uu.seEx:

ssh -Y [email protected] in Linux and OSXMobaXterm in Windows (http://mobaxterm.mobatek.net/)Putty also alternative, but not as good..

Page 62: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Reservations

Special for this coursesalloc -A g2017014 -t 07:00:00 -p core -n 1 --no-shell --reservation=g2017014_mon &

--reservation will be proj id and dayWill start a node which you have access to

Check which node with squeue -u usernamessh to given node, from within UPPMAX

Page 63: Linux Introduction - GitHub Pages › ... › linux-tutorial.pdf · Linux Introduction 2017-05-15 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Laboratory time!