linux introduction · linux introduction you will not learn this now. google it or look at lecture...

53

Upload: others

Post on 20-May-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible
Page 2: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Linux Introduction

150914Martin Dahlö

[email protected]

Page 3: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Linux IntroductionIntroduction

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

Practice makes perfect :)

Page 4: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

UPPMAX

Uppsala Multidisciplinary Center for Advanced Computational Science

(Uppsala supercomupter center)

Clusters Milou Tintin

Uses Linux

Page 5: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

UPPMAX

Uppsala Multidisciplinary Center for Advanced Computational Science

(Uppsala supercomupter center)

Clusters Milou Tintin

Uses Linux

Page 6: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Why Text?

UPPMAX is only accessible through SSH (Secure Shell) for security and speed

Command Line Interface (CLI)

Scary at first, but wonderful to work with Automation and scripts Super computing not

possible without it

Page 7: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

Page 8: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

ls – list the content of a directory

Page 9: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

ls – list the content of a directory

Page 10: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

ls – list the content of a directory

Page 11: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

ls – list the content of a directory

Page 12: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

cd – change working directory cd <directory name> = down cd .. = up

Page 13: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

cd – change working directory cd <directory name> = down cd .. = up

Page 14: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

cd – change working directory cd <directory name> = down cd .. = up

Page 15: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

cd – change working directory cd <directory name> = down cd .. = up

Page 16: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

pwd – print working directory

Page 17: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

pwd – print working directory

Page 18: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Navigation Commands

Summary ls – list content of directroy cd – change working directory pwd – print working directory

Page 19: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Copy a file

cp <name of original> <name of copy>

Page 20: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Copy a file

cp <name of original> <name of copy>

cp myText.txt copy_of_my_text.txt

Page 21: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Copy a file

cp <name of original> <name of copy>

cp /home/dahlo/test.txt ../../myDocs/

Page 22: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Move a file

mv <name of original> <name of copy>

mv myText.txt copy_of_my_text.txt

Page 23: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Move a file

mv <name of original> <name of copy>

mv /home/dahlo/test.txt ../../myDocs/

Page 24: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

View content of a file

less <file name>

less readme.txt

Page 25: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

View content of a file

less <file name>

less readme.txt

Page 26: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

View content of a file

less <file name>

less readme.txt

(q to exit)

Page 27: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Head

View the first rows of a file head <filename>

Page 28: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Head

View the first rows of a file head <filename>

Page 29: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Head

View the first rows of a file head <filename>

Page 30: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Head

View the first rows of a file head <filename>

Page 31: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Head

View the first n rows of a file head -n <nr of lines> <filename>

Page 32: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Tail

View the last rows of a file tail <filename>

Page 33: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Tail

View the last n rows of a file tail -n <nr of lines> <filename>

Page 34: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Edit content of a file

nano <file name>

nano readme.txt

Page 35: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Edit content of a file

nano <file name>

nano readme.txt ^ = ctrl

Page 36: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Interaction Commands

Remove a file

rm <file name>

Ex.

rm readme.txt

rm ../../../file1.txt

rm /home/dahlo/test.txt

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

Page 37: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Wildcards

*

Works with most Linux commands

Page 38: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Wildcards

*

Works with most Linux commands

Page 39: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Wildcards

*

Works with most Linux commands

Page 40: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Wildcards

*

Works with most Linux commands

Ex: cp *.txt directory1/

Page 41: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Wildcards

*

Works with most Linux commands

Ex: rm *.tmp

Page 42: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

TABCOMPLETION

Never write a path or filename without it!

Page 43: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 44: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 45: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 46: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 47: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

How much is the computer working?

top

Page 48: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

Instructions how to use programs Easy to forget syntax Manual pages

man <program name>

Ex.

man ls

(q to quit)

Page 49: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands

How do I log out? exit

Exits only the current terminal

Page 50: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Good to Know Commands 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 curren terminal

Page 51: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Connect to UPPMAX

Secure SHell connection (ssh)

ssh -X <username>@milou.uppmax.uu.se Ex: ssh -X [email protected]

Terminal in Linux and OSX MobaXterm in Windows (http://mobaxterm.mobatek.net/)

Putty also alternative, but not as good..

Page 52: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Reservations

Special for this course salloc -A g2015031 -t 07:00:00 -p core -n 1 --no-shell --reservation=g2015031_14 &

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

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

Page 53: Linux Introduction · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :) UPPMAX ... UPPMAX is only accessible

Laboratory time!