linux introduction - read the docs · linux introduction you will not learn this now. google it or...

53

Upload: others

Post on 27-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)
Page 2: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Linux Introduction

150209Martin Dahlö

[email protected]

Page 3: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

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 - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

UPPMAX

Uppsala Multidisciplinary Center for Advanced Computational Science

(Uppsala supercomupter center)

Clusters Milou Tintin

Uses Linux

Page 5: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

UPPMAX

Uppsala Multidisciplinary Center for Advanced Computational Science

(Uppsala supercomupter center)

Clusters Milou Tintin

Uses Linux

Page 6: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

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 - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

Page 8: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

ls – list the content of a directory

Page 9: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

ls – list the content of a directory

Page 10: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

ls – list the content of a directory

Page 11: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

ls – list the content of a directory

Page 12: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

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

Page 13: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

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

Page 14: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

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

Page 15: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

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

Page 16: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

pwd – print working directory

Page 17: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

pwd – print working directory

Page 18: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Navigation Commands

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

Page 19: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

Copy a file

cp <name of original> <name of copy>

Page 20: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

Copy a file

cp <name of original> <name of copy>

cp myText.txt copy_of_my_text.txt

Page 21: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

Copy a file

cp <name of original> <name of copy>

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

Page 22: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

Move a file

mv <name of original> <name of copy>

mv myText.txt copy_of_my_text.txt

Page 23: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

Move a file

mv <name of original> <name of copy>

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

Page 24: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

View content of a file

less <file name>

less readme.txt

Page 25: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

View content of a file

less <file name>

less readme.txt

Page 26: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

View content of a file

less <file name>

less readme.txt

(q to exit)

Page 27: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Head

View the first rows of a file head <filename>

Page 28: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Head

View the first rows of a file head <filename>

Page 29: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Head

View the first rows of a file head <filename>

Page 30: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Head

View the first rows of a file head <filename>

Page 31: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Head

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

Page 32: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Tail

View the last rows of a file tail <filename>

Page 33: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Tail

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

Page 34: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

Edit content of a file

nano <file name>

nano readme.txt

Page 35: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Interaction Commands

Edit content of a file

nano <file name>

nano readme.txt ^ = ctrl

Page 36: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

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 - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Wildcards

*

Works with most Linux commands

Page 38: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Wildcards

*

Works with most Linux commands

Page 39: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Wildcards

*

Works with most Linux commands

Page 40: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Wildcards

*

Works with most Linux commands

Ex: cp *.txt directory1/

Page 41: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Wildcards

*

Works with most Linux commands

Ex: rm *.tmp

Page 42: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Good to Know Commands

TABCOMPLETION

Never write a path or filename without it!

Page 43: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 44: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 45: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 46: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Good to Know Commands

TAB COMPLETION

Never write a path or filename without it!

Page 47: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Good to Know Commands

How much is the computer working?

top

Page 48: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

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 - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Good to Know Commands

How do I log out? exit

Exits only the current terminal

Page 50: Linux Introduction - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

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 - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

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 - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Reservations

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

--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 - Read the Docs · Linux Introduction You will not learn this now. Google it or look at lecture slides when you need it. Practice makes perfect :)

Laboratory time!