AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial...
Transcript of AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial...
![Page 1: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/1.jpg)
AOS Linux TutorialIntroduction to Linux
Michael HavasDept. of Atmospheric and Oceanic Sciences
McGill University
September 15, 2011
![Page 2: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/2.jpg)
Outline
1 Introduction to LinuxBenefits of LinuxWhat Exactly is Linux?The Free-Software Philosophy
2 The Graphical User InterfaceCross-Platform ApplicationsWindows Applications and Their Linux Counterparts
3 The Command-LineThe FilesystemFile and Directory ManagementGlobbingFinding FilesOwnership and Permissions
4 Fun Tips
5 Next Time
![Page 3: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/3.jpg)
Why Linux?
Free.
Free.
Scientific Software.
Community.
Security.
Stability.
Learn Linux, Learn *nix.
![Page 4: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/4.jpg)
Why Linux?
Free.
Free.
Scientific Software.
Community.
Security.
Stability.
Learn Linux, Learn *nix.
![Page 5: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/5.jpg)
Why Linux?
Free.
Free.
Scientific Software.
Community.
Security.
Stability.
Learn Linux, Learn *nix.
![Page 6: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/6.jpg)
Why Linux?
Free.
Free.
Scientific Software.
Community.
Security.
Stability.
Learn Linux, Learn *nix.
![Page 7: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/7.jpg)
Why Linux?
Free.
Free.
Scientific Software.
Community.
Security.
Stability.
Learn Linux, Learn *nix.
![Page 8: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/8.jpg)
Why Linux?
Free.
Free.
Scientific Software.
Community.
Security.
Stability.
Learn Linux, Learn *nix.
![Page 9: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/9.jpg)
Why Linux?
Free.
Free.
Scientific Software.
Community.
Security.
Stability.
Learn Linux, Learn *nix.
![Page 10: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/10.jpg)
What is Linux?
A Unix-like operating systemcreated by Linus Torvalds in1991.
Uses the GNU set of toolsdeveloped by RichardStallman.
Free and Open source underthe GPL license.
Not just a product but acollection of products.
![Page 11: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/11.jpg)
What is Linux?
A Unix-like operating systemcreated by Linus Torvalds in1991.
Uses the GNU set of toolsdeveloped by RichardStallman.
Free and Open source underthe GPL license.
Not just a product but acollection of products.
![Page 12: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/12.jpg)
What is Linux?
A Unix-like operating systemcreated by Linus Torvalds in1991.
Uses the GNU set of toolsdeveloped by RichardStallman.
Free and Open source underthe GPL license.
Not just a product but acollection of products.
![Page 13: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/13.jpg)
What is Linux?
A Unix-like operating systemcreated by Linus Torvalds in1991.
Uses the GNU set of toolsdeveloped by RichardStallman.
Free and Open source underthe GPL license.
Not just a product but acollection of products.
![Page 14: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/14.jpg)
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!
![Page 15: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/15.jpg)
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!
![Page 16: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/16.jpg)
Outline
1 Introduction to LinuxBenefits of LinuxWhat Exactly is Linux?The Free-Software Philosophy
2 The Graphical User InterfaceCross-Platform ApplicationsWindows Applications and Their Linux Counterparts
3 The Command-LineThe FilesystemFile and Directory ManagementGlobbingFinding FilesOwnership and Permissions
4 Fun Tips
5 Next Time
![Page 17: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/17.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 18: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/18.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 19: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/19.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 20: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/20.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 21: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/21.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 22: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/22.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 23: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/23.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 24: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/24.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 25: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/25.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 26: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/26.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 27: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/27.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 28: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/28.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 29: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/29.jpg)
Cross-Platform Applications
Firefox.
Thunderbird.
VLC.
OpenOffice.
Pidgin.
FileZilla.
Google Earth.
Picasa.
Adobe Reader.
Adobe Flash.
Opera.
Skype.
Google Chrome.
![Page 30: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/30.jpg)
Applications in Windows and Linux
Type Windows LinuxWeb Browser Internet Explorer FirefoxEmail Client Outlook ThunderbirdFile Transfer CuteFTP Filezilla
Instant Messenger MSN Messenger PidginMedia Player Windows Media Player VLCFile Browser Windows Explorer Nautilus
Raster Graphics Editor Photoshop The GIMPVector Graphics Editor Illustrator Inkscape
Office Suite Microsoft Office OpenOfficePDF Viewer Adobe Reader EvinceMusic Player Itunes Rhythmbox
More equivalent applications
http://www.linuxrsp.ru/win-lin-soft/table-eng.html
![Page 31: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/31.jpg)
The Graphical User Interface
![Page 32: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/32.jpg)
Outline
1 Introduction to LinuxBenefits of LinuxWhat Exactly is Linux?The Free-Software Philosophy
2 The Graphical User InterfaceCross-Platform ApplicationsWindows Applications and Their Linux Counterparts
3 The Command-LineThe FilesystemFile and Directory ManagementGlobbingFinding FilesOwnership and Permissions
4 Fun Tips
5 Next Time
![Page 33: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/33.jpg)
Why use the Command-Line?
Fast.
Efficient.
Powerful.
Scripting language.
Remote access.
Almost Anything you can do in the GUI, you can do on thecommand line:
Listen to music.Read email.Browse the web.Watch movies (kinda: towel.blinkenlights.nl).
![Page 34: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/34.jpg)
The FilesystemOne root to rule them all
![Page 35: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/35.jpg)
The FilesystemDifferent devices, same root
![Page 36: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/36.jpg)
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!
![Page 37: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/37.jpg)
Absolute vs Relative PathsAn Example
![Page 38: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/38.jpg)
Getting AroundShortcuts
Shortcuts
${HOME} Your home directory.
∼ Your home directory.
∼mhavas My home directory.
![Page 39: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/39.jpg)
Getting Around
Commands
ls List contents of directory.
cd Change directory.
pwd Print working/current directory.
Tab-completion is your friend
![Page 40: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/40.jpg)
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.
![Page 41: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/41.jpg)
File and Directory ManagementUseful 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 srcdirto dstdir.
ls -l Same as ls but gives more information.
du -hs dir Prints size of directory and all contents inhuman-readable format.
Getting Help
For useful options and detailed help for almost any program, youcan look at the manual for that specific command using:man command.
![Page 42: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/42.jpg)
File and Directory ManagementLinks
Soft Links
Command: ln -s file linkCreates a named link betweenfile and link.
Hard Links
Command: ln file linkCreates a physical link betweenfile and link.
Deletion is handled differently
![Page 43: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/43.jpg)
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.
![Page 44: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/44.jpg)
GlobbingExamples
[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
![Page 45: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/45.jpg)
GlobbingExamples
[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
![Page 46: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/46.jpg)
GlobbingExamples
[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
![Page 47: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/47.jpg)
GlobbingExamples
[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
![Page 48: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/48.jpg)
GlobbingExamples
[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
![Page 49: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/49.jpg)
GlobbingExamples
[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
![Page 50: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/50.jpg)
GlobbingExamples
[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
![Page 51: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/51.jpg)
GlobbingExamples
[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
![Page 52: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/52.jpg)
GlobbingExamples
[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
![Page 53: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/53.jpg)
GlobbingExamples
[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
![Page 54: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/54.jpg)
Finding FilesFinding 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 dayusing updatedb
Find files using find
find path -iname “*word*” Finds files and directories recursivelystarting in path path that have word in theirfilename.
Very useful command and has lots and lots of options.
![Page 55: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/55.jpg)
Finding FilesUseful 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 betweenyesterday 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 thecurrent directory and execute chmod 755 on them.
find . -type f -exec chmod 644 {} \; Find all files under thecurrent directory and execute chmod 755 on them.
![Page 56: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/56.jpg)
Finding FilesFinding 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 programnamed program in your path.
which -a program Will show all programs names program inyour path. Note that only the first will run if youtype program.
whereis program Will search for a program’s binary, sourceand help in their standard locations.
![Page 57: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/57.jpg)
Ownership and PermissionsOwner
[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
![Page 58: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/58.jpg)
Ownership and PermissionsGroup
[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
![Page 59: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/59.jpg)
Ownership and PermissionsChanging Ownership
Commands for changing ownership
chown user file Change the ownership of file to user.
chgrp group file Change the group ownership of file togroup.
chown user:group file Change the ownership of file to useruser and group group.
Both commands can take a -R argument to apply the changerecursively.
![Page 60: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/60.jpg)
Ownership and PermissionsPermissions
[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
![Page 61: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/61.jpg)
Ownership and PermissionsPermissions
user group other
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.
![Page 62: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/62.jpg)
Ownership and PermissionsChanging Permissions
Commands for changing permissions
chmod perms file Changes the permission of file file to perms.
perms? what perms?
user group other
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
![Page 63: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/63.jpg)
Ownership and PermissionsChanging Permissions
Commands for changing permissions
chmod perms file Changes the permission of file file to perms.
perms? what perms?
user group other
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
![Page 64: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/64.jpg)
Ownership and PermissionsChanging Permissions
Commands for changing permissions
chmod perms file Changes the permission of file file to perms.
perms? what perms?
user group other
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
![Page 65: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/65.jpg)
Ownership and PermissionsChanging Permissions
Commands for changing permissions
chmod perms file Changes the permission of file file to perms.
perms? what perms?
user group other
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
![Page 66: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/66.jpg)
Outline
1 Introduction to LinuxBenefits of LinuxWhat Exactly is Linux?The Free-Software Philosophy
2 The Graphical User InterfaceCross-Platform ApplicationsWindows Applications and Their Linux Counterparts
3 The Command-LineThe FilesystemFile and Directory ManagementGlobbingFinding FilesOwnership and Permissions
4 Fun Tips
5 Next Time
![Page 67: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/67.jpg)
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 atonce.
![Page 68: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/68.jpg)
Outline
1 Introduction to LinuxBenefits of LinuxWhat Exactly is Linux?The Free-Software Philosophy
2 The Graphical User InterfaceCross-Platform ApplicationsWindows Applications and Their Linux Counterparts
3 The Command-LineThe FilesystemFile and Directory ManagementGlobbingFinding FilesOwnership and Permissions
4 Fun Tips
5 Next Time
![Page 69: AOS Linux Tutorialmhavas/tutorials/20110915/slides.pdf · 2011-09-14 · AOS Linux Tutorial Introduction to Linux Michael Havas Dept. of Atmospheric and Oceanic Sciences McGill University](https://reader033.fdocuments.us/reader033/viewer/2022042805/5f68b5b322a2260ee31effcc/html5/thumbnails/69.jpg)
Next Time
Next Time
More on the command-line.
Shell scripting in bash.
Gnuplot.
Suggested topics.