65

Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö [email protected] Valentin Georgiev [email protected]

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se
Page 2: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Linux Introduction

2017-09-25

Martin Dahlö[email protected]

Valentin [email protected]

Page 3: Linux IntroductionLinux Introduction 2017-09-25 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 IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se
Page 5: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Linux

Page 6: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Linux

Page 7: Linux IntroductionLinux Introduction 2017-09-25 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 8: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computer clustersMilou

Rackham

Bianca

Page 9: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computer clustersMilou

Rackham

Bianca

Page 10: Linux IntroductionLinux Introduction 2017-09-25 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 11: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computers

Data

Page 12: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computers

Files and programs

Page 13: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Files and directories

File structure(directory tree)

Page 14: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Directory tree

Page 15: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Computers

Files and programs

Page 16: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Commands

programs = commands

Page 17: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Commands

program_name -parameter1 -parameter2 input_file output_file

Page 18: Linux IntroductionLinux Introduction 2017-09-25 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 19: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

pwd – print working directory

Page 20: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

pwd – print working directory

Page 21: Linux IntroductionLinux Introduction 2017-09-25 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 IntroductionLinux Introduction 2017-09-25 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 IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

ls – list the content of a directory

Page 24: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Navigation Commands

ls – list the content of a directory

Page 25: Linux IntroductionLinux Introduction 2017-09-25 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 26: Linux IntroductionLinux Introduction 2017-09-25 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 27: Linux IntroductionLinux Introduction 2017-09-25 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 28: Linux IntroductionLinux Introduction 2017-09-25 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 29: Linux IntroductionLinux Introduction 2017-09-25 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 30: Linux IntroductionLinux Introduction 2017-09-25 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 31: Linux IntroductionLinux Introduction 2017-09-25 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 32: Linux IntroductionLinux Introduction 2017-09-25 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 33: Linux IntroductionLinux Introduction 2017-09-25 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 ../

Page 34: Linux IntroductionLinux Introduction 2017-09-25 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 35: Linux IntroductionLinux Introduction 2017-09-25 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 36: Linux IntroductionLinux Introduction 2017-09-25 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 37: Linux IntroductionLinux Introduction 2017-09-25 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 38: Linux IntroductionLinux Introduction 2017-09-25 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 39: Linux IntroductionLinux Introduction 2017-09-25 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 IntroductionLinux Introduction 2017-09-25 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 IntroductionLinux Introduction 2017-09-25 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 42: Linux IntroductionLinux Introduction 2017-09-25 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 43: Linux IntroductionLinux Introduction 2017-09-25 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 44: Linux IntroductionLinux Introduction 2017-09-25 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 45: Linux IntroductionLinux Introduction 2017-09-25 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 46: Linux IntroductionLinux Introduction 2017-09-25 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 47: Linux IntroductionLinux Introduction 2017-09-25 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 48: Linux IntroductionLinux Introduction 2017-09-25 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 49: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Page 50: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Page 51: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Page 52: Linux IntroductionLinux Introduction 2017-09-25 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 53: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Wildcards

*Works with most Linux commands

Ex:

rm *.tmp

Page 54: Linux IntroductionLinux Introduction 2017-09-25 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 55: Linux IntroductionLinux Introduction 2017-09-25 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 IntroductionLinux Introduction 2017-09-25 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 IntroductionLinux Introduction 2017-09-25 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 58: Linux IntroductionLinux Introduction 2017-09-25 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 59: Linux IntroductionLinux Introduction 2017-09-25 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 60: Linux IntroductionLinux Introduction 2017-09-25 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 61: Linux IntroductionLinux Introduction 2017-09-25 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 62: Linux IntroductionLinux Introduction 2017-09-25 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 63: Linux IntroductionLinux Introduction 2017-09-25 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]

Terminal in Linux and OS X

MobaXterm in Windows (http://mobaxterm.mobatek.net/)Putty also alternative, but not as good..

Page 64: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Reservations

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

--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 65: Linux IntroductionLinux Introduction 2017-09-25 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@farmbio.uu.se

Laboratory time!