59

Linux Introduction - GitHub Pages

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Linux Introduction - GitHub Pages
Page 2: Linux Introduction - GitHub Pages

Linux Introduction

2021-05-17

Martin Dahlö[email protected]

Page 3: Linux Introduction - GitHub Pages

Linux Introduction

Look up the links from Pre-course material, use Google, and ...

Learn by practice and repetition!!!

Page 4: Linux Introduction - GitHub Pages

UPPMAX

● Uppsala Multidisciplinary Center for Advanced Computational Science○ (Uppsala supercomputer center)

● Clusters○ Rackham○ Bianca○ Snowy

● Uses Linux

Page 5: Linux Introduction - GitHub Pages

UPPMAX

● Uppsala Multidisciplinary Center for Advanced Computational Science○ (Uppsala supercomputer center)

● Clusters○ Rackham○ Bianca○ Snowy

● Uses Linux

Page 6: Linux Introduction - GitHub Pages

Linux

● Why Linux?

- A powerful command-line interface

- Built for multi-user systems.

- An enormous amount of software is freely available

Page 7: Linux Introduction - GitHub Pages

Linux

Page 8: Linux Introduction - GitHub Pages

Linux

Page 9: Linux Introduction - GitHub Pages

Directory tree

Page 10: Linux Introduction - GitHub Pages

Navigation Commands

● ls – list the content of a directory

Page 11: Linux Introduction - GitHub Pages

Navigation Commands

● ls – list the content of a directory

Page 12: Linux Introduction - GitHub Pages

Navigation Commands

● ls – list the content of a directory

Page 13: Linux Introduction - GitHub Pages

Navigation Commands

● ls – list the content of a directory

Page 14: Linux Introduction - GitHub Pages

Navigation Commands

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

Page 15: Linux Introduction - GitHub Pages

Navigation Commands

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

Page 16: Linux Introduction - GitHub Pages

Navigation Commands

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

Page 17: Linux Introduction - GitHub Pages

Navigation Commands

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

Page 18: Linux Introduction - GitHub Pages

Navigation Commands

● pwd – print working directory

Page 19: Linux Introduction - GitHub Pages

Navigation Commands

● pwd – print working directory

Page 20: Linux Introduction - GitHub Pages

Absolute/Relative paths

● Absolute paths○ Starts with a /○ Defined from the root of the file system

/home/dahlo/documents/results.csv

/proj/g2019031/nobackup/

Page 21: Linux Introduction - GitHub Pages

Absolute/Relative paths

● Absolute paths○ Starts with a /○ Defined from the root of the file system

/home/dahlo/documents/results.csv

/proj/g2019031/nobackup/

○ Like an addressHusargatan 3, Uppsala, Sweden

Page 22: Linux Introduction - GitHub Pages

Absolute/Relative paths

● Relative paths○ Does not starts with a /○ Relative to where you are when using it

../documents/results.csv

nobackup/dahlo/linux_into/files.zip

Page 23: Linux Introduction - GitHub Pages

Absolute/Relative paths

● Relative paths○ Does not starts with a /○ Relative to where you are when using it

../documents/results.csv

nobackup/dahlo/linux_into/files.zip

○ Like a direction4 blocks to the right, 2nd house

Page 24: Linux Introduction - GitHub Pages

Navigation Commands

● Summary○ ls – list content of directroy○ cd – change working directory○ pwd – print working directory○ Use them to explore absolute/relative paths

Page 25: Linux Introduction - GitHub Pages

Interaction Commands

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

Page 26: Linux Introduction - GitHub Pages

Interaction Commands

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

Page 27: Linux Introduction - GitHub Pages

Interaction Commands

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

Page 28: Linux Introduction - GitHub Pages

Interaction Commands

mv - move a filemv <name of the file> <name of the “copy”>

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

Page 29: Linux Introduction - GitHub Pages

Interaction Commands

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

Page 30: Linux Introduction - GitHub Pages

Interaction Commands

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

Page 31: Linux Introduction - GitHub Pages

Interaction Commands

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

Page 32: Linux Introduction - GitHub Pages

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

press Q to exit less

Interaction Commands

Page 33: Linux Introduction - GitHub Pages

Head

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

Page 34: Linux Introduction - GitHub Pages

Head

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

Page 35: Linux Introduction - GitHub Pages

Head

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

Page 36: Linux Introduction - GitHub Pages

Head

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

Page 37: Linux Introduction - GitHub Pages

Head

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

Page 38: Linux Introduction - GitHub Pages

Tail

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

Page 39: Linux Introduction - GitHub Pages

Tail

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

Page 40: Linux Introduction - GitHub Pages

Interaction Commands

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

Page 41: Linux Introduction - GitHub Pages

Interaction Commands

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

^ = ctrl

Page 42: Linux Introduction - GitHub Pages

Interaction Commands

rm - remove a file

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

rm <file name> Ex.rm readme.txtrm ../../../file1.txtrm /home/dahlo/test.txt

Page 43: Linux Introduction - GitHub Pages

Wildcards

*

Page 44: Linux Introduction - GitHub Pages

Wildcards

*

Page 45: Linux Introduction - GitHub Pages

Wildcards

*

Page 46: Linux Introduction - GitHub Pages

Wildcards

*Works with most Linux commands

Ex: cp *.txt directory1/

Page 47: Linux Introduction - GitHub Pages

Wildcards

*Works with most Linux commands

Ex: rm *.tmp

Page 48: Linux Introduction - GitHub Pages

The most important thing

TABCOMPLETION

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

Page 49: Linux Introduction - GitHub Pages

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

Page 50: Linux Introduction - GitHub Pages

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

Page 51: Linux Introduction - GitHub Pages

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

Page 52: Linux Introduction - GitHub Pages

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

Page 53: Linux Introduction - GitHub Pages

Good to Know Commands

top - how much is the computer working?

top

Page 54: Linux Introduction - GitHub Pages

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

man ls (q to quit)

Good to Know Commands

Page 55: Linux Introduction - GitHub Pages

How do I log out?exit Exits only the current terminal

Good to Know Commands

Page 56: Linux Introduction - GitHub Pages

● 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 57: Linux Introduction - GitHub Pages
Page 58: Linux Introduction - GitHub Pages

Connect to UPPMAX

ssh - Secure SHell connection (ssh)

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

ssh -Y [email protected]

Terminal in Linux and OS X

MobaXterm in Windows (http://mobaxterm.mobatek.net/)

Windows Terminal also alternative, but no graphics

Page 59: Linux Introduction - GitHub Pages

Laboratory time!

https://nbisweden.github.io/workshop-ngsintro/2105/lab_linux_intro.html