AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of - - PowerPoint PPT Presentation

aos linux tutorial
SMART_READER_LITE
LIVE PREVIEW

AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of - - PowerPoint PPT Presentation

AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University September 15, 2011 Outline 1 Introduction to Linux Benefits of Linux What Exactly is Linux? The Free-Software Philosophy 2


slide-1
SLIDE 1

AOS Linux Tutorial

Introduction to Linux Michael Havas

  • Dept. of Atmospheric and Oceanic Sciences

McGill University September 15, 2011

slide-2
SLIDE 2

Outline

1 Introduction to Linux

Benefits of Linux What Exactly is Linux? The Free-Software Philosophy

2 The Graphical User Interface

Cross-Platform Applications Windows Applications and Their Linux Counterparts

3 The Command-Line

The Filesystem File and Directory Management Globbing Finding Files Ownership and Permissions

4 Fun Tips 5 Next Time

slide-3
SLIDE 3

Why Linux?

Free. Free. Scientific Software. Community. Security. Stability. Learn Linux, Learn *nix.

slide-4
SLIDE 4

Why Linux?

Free. Free. Scientific Software. Community. Security. Stability. Learn Linux, Learn *nix.

slide-5
SLIDE 5

Why Linux?

Free. Free. Scientific Software. Community. Security. Stability. Learn Linux, Learn *nix.

slide-6
SLIDE 6

Why Linux?

Free. Free. Scientific Software. Community. Security. Stability. Learn Linux, Learn *nix.

slide-7
SLIDE 7

Why Linux?

Free. Free. Scientific Software. Community. Security. Stability. Learn Linux, Learn *nix.

slide-8
SLIDE 8

Why Linux?

Free. Free. Scientific Software. Community. Security. Stability. Learn Linux, Learn *nix.

slide-9
SLIDE 9

Why Linux?

Free. Free. Scientific Software. Community. Security. Stability. Learn Linux, Learn *nix.

slide-10
SLIDE 10

What is Linux?

A Unix-like operating system created by Linus Torvalds in 1991. Uses the GNU set of tools developed by Richard Stallman. Free and Open source under the GPL license. Not just a product but a collection of products.

slide-11
SLIDE 11

What is Linux?

A Unix-like operating system created by Linus Torvalds in 1991. Uses the GNU set of tools developed by Richard Stallman. Free and Open source under the GPL license. Not just a product but a collection of products.

slide-12
SLIDE 12

What is Linux?

A Unix-like operating system created by Linus Torvalds in 1991. Uses the GNU set of tools developed by Richard Stallman. Free and Open source under the GPL license. Not just a product but a collection of products.

slide-13
SLIDE 13

What is Linux?

A Unix-like operating system created by Linus Torvalds in 1991. Uses the GNU set of tools developed by Richard Stallman. Free and Open source under the GPL license. Not just a product but a collection of products.

slide-14
SLIDE 14

Why Free Software?

When you use free software, you also get the freedom to study, copy, change and redistribute the source code. If you don’t like something, change it!

slide-15
SLIDE 15

Why Free Software?

When you use free software, you also get the freedom to study, copy, change and redistribute the source code. If you don’t like something, change it!

slide-16
SLIDE 16

Outline

1 Introduction to Linux

Benefits of Linux What Exactly is Linux? The Free-Software Philosophy

2 The Graphical User Interface

Cross-Platform Applications Windows Applications and Their Linux Counterparts

3 The Command-Line

The Filesystem File and Directory Management Globbing Finding Files Ownership and Permissions

4 Fun Tips 5 Next Time

slide-17
SLIDE 17

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-18
SLIDE 18

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-19
SLIDE 19

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-20
SLIDE 20

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-21
SLIDE 21

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-22
SLIDE 22

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-23
SLIDE 23

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-24
SLIDE 24

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-25
SLIDE 25

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-26
SLIDE 26

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-27
SLIDE 27

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-28
SLIDE 28

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-29
SLIDE 29

Cross-Platform Applications

Firefox. Thunderbird. VLC. OpenOffice. Pidgin. FileZilla. Google Earth. Picasa. Adobe Reader. Adobe Flash. Opera. Skype. Google Chrome.

slide-30
SLIDE 30

Applications in Windows and Linux

Type Windows Linux Web Browser Internet Explorer Firefox Email Client Outlook Thunderbird File Transfer CuteFTP Filezilla Instant Messenger MSN Messenger Pidgin Media Player Windows Media Player VLC File Browser Windows Explorer Nautilus Raster Graphics Editor Photoshop The GIMP Vector Graphics Editor Illustrator Inkscape Office Suite Microsoft Office OpenOffice PDF Viewer Adobe Reader Evince Music Player Itunes Rhythmbox More equivalent applications http://www.linuxrsp.ru/win-lin-soft/table-eng.html

slide-31
SLIDE 31

The Graphical User Interface

slide-32
SLIDE 32

Outline

1 Introduction to Linux

Benefits of Linux What Exactly is Linux? The Free-Software Philosophy

2 The Graphical User Interface

Cross-Platform Applications Windows Applications and Their Linux Counterparts

3 The Command-Line

The Filesystem File and Directory Management Globbing Finding Files Ownership and Permissions

4 Fun Tips 5 Next Time

slide-33
SLIDE 33

Why use the Command-Line?

Fast. Efficient. Powerful. Scripting language. Remote access. Almost Anything you can do in the GUI, you can do on the command line:

Listen to music. Read email. Browse the web. Watch movies (kinda: towel.blinkenlights.nl).

slide-34
SLIDE 34

The Filesystem

One root to rule them all

slide-35
SLIDE 35

The Filesystem

Different devices, same root

slide-36
SLIDE 36

Absolute vs Relative Paths

Absolute vs Relative Absolute Starting from the root (/). Relative Starting from your working directory. Special Paths . The current directory. .. The parent of the current directory. On Linux, everything is case sensitive!

slide-37
SLIDE 37

Absolute vs Relative Paths

An Example

slide-38
SLIDE 38

Getting Around

Shortcuts

Shortcuts ${HOME} Your home directory. ∼ Your home directory. ∼mhavas My home directory.

slide-39
SLIDE 39

Getting Around

Commands ls List contents of directory. cd Change directory. pwd Print working/current directory. Tab-completion is your friend

slide-40
SLIDE 40

File and Directory Management

Commans touch file Creates a file called file. mkdir dir Creates a directory dir. rm file Remove a file. rmdir dir Remove an empty directory dir. cp src dst Copies file from src to dst. mv src dst Moves file/dir from src to dst. du file Prints size of file in bytes. file file Prints what type of file file is. ln file link Creates a hard or soft link between file and link.

slide-41
SLIDE 41

File and Directory Management

Useful Options

Commands mkdir -p path Creates all directories if they do not exist in path. rm -r dir Removes all files and directories in dir including dir cp -a srcdir dstdir Copies directory and contents from srcdir to dstdir. ls -l Same as ls but gives more information. du -hs dir Prints size of directory and all contents in human-readable format. Getting Help For useful options and detailed help for almost any program, you can look at the manual for that specific command using: man command.

slide-42
SLIDE 42

File and Directory Management

Links

Soft Links Command: ln -s file link Creates a named link between file and link. Hard Links Command: ln file link Creates a physical link between file and link. Deletion is handled differently

slide-43
SLIDE 43

Globbing

Allows you to select many items at once. * Match anything at any length. ? Match one character. [ab] Match characters a or b. {blah,foo} Match words blah or foo. ˆglob Match anything but glob.

slide-44
SLIDE 44

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh

slide-45
SLIDE 45

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh

slide-46
SLIDE 46

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]*

slide-47
SLIDE 47

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]* a.1 b.1

slide-48
SLIDE 48

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]* a.1 b.1 [mhavas@lappy tmp]$ ls [a-c]*

slide-49
SLIDE 49

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]* a.1 b.1 [mhavas@lappy tmp]$ ls [a-c]* a.1 b.1 c.1

slide-50
SLIDE 50

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]* a.1 b.1 [mhavas@lappy tmp]$ ls [a-c]* a.1 b.1 c.1 [mhavas@lappy tmp]$ ls [^ab]*

slide-51
SLIDE 51

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]* a.1 b.1 [mhavas@lappy tmp]$ ls [a-c]* a.1 b.1 c.1 [mhavas@lappy tmp]$ ls [^ab]* c.1 t2.sh test1.txt

slide-52
SLIDE 52

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]* a.1 b.1 [mhavas@lappy tmp]$ ls [a-c]* a.1 b.1 c.1 [mhavas@lappy tmp]$ ls [^ab]* c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls {b*,c*,*est*}

slide-53
SLIDE 53

Globbing

Examples

[mhavas@lappy tmp]$ ls a.1 b.1 c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls t?.sh t2.sh [mhavas@lappy tmp]$ ls [ab]* a.1 b.1 [mhavas@lappy tmp]$ ls [a-c]* a.1 b.1 c.1 [mhavas@lappy tmp]$ ls [^ab]* c.1 t2.sh test1.txt [mhavas@lappy tmp]$ ls {b*,c*,*est*} b.1 c.1 test1.txt

slide-54
SLIDE 54

Finding Files

Finding Files

Find files using locate locate word Find file or directory that has word in it. Fast but only search a database. Database is refreshed once a day using updatedb Find files using find find path -iname “*word*” Finds files and directories recursively starting in path path that have word in their filename. Very useful command and has lots and lots of options.

slide-55
SLIDE 55

Finding Files

Useful arguments to find

More on the find command find . -type d Find all directories under the current directory. find . -type f Find all files under the current directory. find . -mtime 1 Find that were created in the past 24 hours. find . -daystart -mtime +0 -mtime -3 Find files created between yesterday and the day before. find . -size -5k Find files less than 5 kilobytes. Operating on found files find . -type d -exec chmod 755 {} \; Find all directories under the current directory and execute chmod 755 on them. find . -type f -exec chmod 644 {} \; Find all files under the current directory and execute chmod 755 on them.

slide-56
SLIDE 56

Finding Files

Finding Programs

The path environment variable path tells the shell where to look for files. You can execute a program in your path by typing ’program’. Programs not in your path must include the program’s path. For example, /aos/shared/bin/matlab You can see your path by issuing env $PATH Searching through your path which program Will show the location of the first program named program in your path. which -a program Will show all programs names program in your path. Note that only the first will run if you type program. whereis program Will search for a program’s binary, source and help in their standard locations.

slide-57
SLIDE 57

Ownership and Permissions

Owner

[mhavas@lappy tmp]$ ls -l

  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 a.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 b.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 c.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 t2.sh
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 test1.txt
slide-58
SLIDE 58

Ownership and Permissions

Group

[mhavas@lappy tmp]$ ls -l

  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 a.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 b.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 c.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 t2.sh
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 test1.txt
slide-59
SLIDE 59

Ownership and Permissions

Changing Ownership

Commands for changing ownership chown user file Change the ownership of file to user. chgrp group file Change the group ownership of file to group. chown user:group file Change the ownership of file to user user and group group. Both commands can take a -R argument to apply the change recursively.

slide-60
SLIDE 60

Ownership and Permissions

Permissions

[mhavas@lappy tmp]$ ls -l

  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 a.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 b.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 c.1
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 t2.sh
  • rw-rw-r--. 1 mhavas mhavas 0 2009-09-23 15:18 test1.txt
slide-61
SLIDE 61

Ownership and Permissions

Permissions

user group

  • ther

r w x r w x r w x File Permissions r Read file. w Write file. x Execute file. Group Permissions r List contents. w Write into. x Enter.

slide-62
SLIDE 62

Ownership and Permissions

Changing Permissions

Commands for changing permissions chmod perms file Changes the permission of file file to perms. perms? what perms? user group

  • ther

r w x r w x r w x [mhavas@lappy tmp]$ ls -l a.1

  • rw-r--r--. a.1

[mhavas@lappy tmp]$ chmod g+x,o+x a.1 [mhavas@lappy tmp]$ ls -l a.1

slide-63
SLIDE 63

Ownership and Permissions

Changing Permissions

Commands for changing permissions chmod perms file Changes the permission of file file to perms. perms? what perms? user group

  • ther

r w x r w x r w x [mhavas@lappy tmp]$ ls -l a.1

  • rw-r--r--. a.1

[mhavas@lappy tmp]$ chmod g+x,o+x a.1 [mhavas@lappy tmp]$ ls -l a.1

  • rw-r-xr-x. a.1
slide-64
SLIDE 64

Ownership and Permissions

Changing Permissions

Commands for changing permissions chmod perms file Changes the permission of file file to perms. perms? what perms? user group

  • ther

r w x r w x r w x [mhavas@lappy tmp]$ ls -l a.1

  • rw-r--r--. a.1

[mhavas@lappy tmp]$ chmod g+x,o+x a.1 [mhavas@lappy tmp]$ ls -l a.1

  • rw-r-xr-x. a.1

[mhavas@lappy tmp]$ chmod a+w a.1 [mhavas@lappy tmp]$ ls -l a.1

slide-65
SLIDE 65

Ownership and Permissions

Changing Permissions

Commands for changing permissions chmod perms file Changes the permission of file file to perms. perms? what perms? user group

  • ther

r w x r w x r w x [mhavas@lappy tmp]$ ls -l a.1

  • rw-r--r--. a.1

[mhavas@lappy tmp]$ chmod g+x,o+x a.1 [mhavas@lappy tmp]$ ls -l a.1

  • rw-r-xr-x. a.1

[mhavas@lappy tmp]$ chmod a+w a.1 [mhavas@lappy tmp]$ ls -l a.1

  • rw-rwxrwx. a.1
slide-66
SLIDE 66

Outline

1 Introduction to Linux

Benefits of Linux What Exactly is Linux? The Free-Software Philosophy

2 The Graphical User Interface

Cross-Platform Applications Windows Applications and Their Linux Counterparts

3 The Command-Line

The Filesystem File and Directory Management Globbing Finding Files Ownership and Permissions

4 Fun Tips 5 Next Time

slide-67
SLIDE 67

Fun Tips cd - Go back to the last directory you visited. cd Go to your home directory. mkdir -p dir/{dir1,dir2,dir3} Create multiple nested directories at

  • nce.
slide-68
SLIDE 68

Outline

1 Introduction to Linux

Benefits of Linux What Exactly is Linux? The Free-Software Philosophy

2 The Graphical User Interface

Cross-Platform Applications Windows Applications and Their Linux Counterparts

3 The Command-Line

The Filesystem File and Directory Management Globbing Finding Files Ownership and Permissions

4 Fun Tips 5 Next Time

slide-69
SLIDE 69

Next Time

Next Time More on the command-line. Shell scripting in bash. Gnuplot. Suggested topics.