![Page 1: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/1.jpg)
Introduction to Linux
University of Bristol - Advance ComputingResearch Centre
1 / 37
![Page 2: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/2.jpg)
Operating SystemsProgram running all the timeInterfaces between other programs andhardwareProvides abstractions (common interfaces,e.g. filesystems)
You may know
WindowsMacOSiOSAndroid
2 / 37
![Page 3: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/3.jpg)
UNIXAn operating system originating at BellLabs. circa 1969 in the USA
3 / 37
![Page 4: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/4.jpg)
User InterfacesCommand LineGUI - Graphical User Interface
4 / 37
![Page 5: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/5.jpg)
Kernels and ShellsThe kernel is the core of the operatingsystemThe shell is the interface between the useraand the operating system
5 / 37
![Page 6: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/6.jpg)
LinuxA version of UNIXWritten by Linux Torvalds when he was anundergrad in FinlandFree (libre, gratis)One OS from Desktop -> SupercomputerTechnically just the kernelDistributions bundle kernel, GNU tools andextra softwareBlueCrystal Phase 3 runs CentOS 6
6 / 37
![Page 7: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/7.jpg)
Linux PhilosophyKit of partsOne small thing does one thing wellSmall utilities can be joined together toperfom more complicated tasks
7 / 37
![Page 8: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/8.jpg)
Bits and Pieces
8 / 37
![Page 9: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/9.jpg)
At First...
$ ls | wc -l
9 / 37
![Page 10: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/10.jpg)
But Later...
tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn |
10 / 37
![Page 11: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/11.jpg)
Logging OnWe'll be working on the HPC (Blue Crystal)
Start PuttyLog in to bluecrystal phase 3:
train##@bluecrystalp3.bris.ac.uk
Where ## is your account number, ietrain01
First commands, get the example data:
cp -r ../intro_to_linux .cd intro_to_linux
And off we go...11 / 37
![Page 12: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/12.jpg)
Filesystem Hierarchy
12 / 37
![Page 13: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/13.jpg)
DirectoriesPathnames and /Finding where you are (pwd)Changing to a different Directory (cd)The Directories . and ..Home directories (~)
13 / 37
![Page 14: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/14.jpg)
Tasks 1find out where you arewhat is pathname one level above (gothere)go back to your home directory (prove it)
14 / 37
![Page 15: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/15.jpg)
New Files and DirectoriesListing files and directories (ls)Making Directories (mkdir)
15 / 37
![Page 16: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/16.jpg)
Tasks 2What is in your home directory?What is on one level above?Make a new directory in your homedirectory ( give it a one word name)
16 / 37
![Page 17: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/17.jpg)
File ManipulationCopying Files (cp)Moving Files (mv)Removing Files and directories (rm)
17 / 37
![Page 18: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/18.jpg)
Tasks 3copy example.txt to another filenamerename your new file to something elsemove you new file in to the directory youcreated earliermake another copy of example.txtdelete your second copy
18 / 37
![Page 19: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/19.jpg)
Examining File ContentsDisplaying the contents of a file on thescreen (cat, less)The first lines in a file (head)The last lines in a file (tail)Searching the contents of a file (grep)Counting with grep (-c)UNIX is case sensitivegrep -i
19 / 37
![Page 20: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/20.jpg)
Tasks 4What is in example.txtWhat are the first 10 lines of example.txtWhat are the first 15 lines of example.txtWhat are the last 2 lines of example.txtRead through the whole of example.txt apage at a timeFind all the lines that mention "GNU"Count the number of lines that have theword "Linux" (in any capitalisation)
20 / 37
![Page 21: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/21.jpg)
FilenamesWildcards
? Any character* More Than One Character
Filename Conventions (e.g. .c)
21 / 37
![Page 22: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/22.jpg)
Tasks 5list all the two letter commands in /usr/binlist all the commands with "to" in theirname
22 / 37
![Page 23: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/23.jpg)
Getting Helpmanman -kGoogle (other search engines are available)
23 / 37
![Page 24: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/24.jpg)
Tasks 6Read the man page for headPick a random command from in /usr/binand read it's manpage
24 / 37
![Page 25: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/25.jpg)
Maniputaing Filessortuniq
25 / 37
![Page 26: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/26.jpg)
RedirectionRedirecting the Output
> (overwrites)>> (appends)
Redirecting the Input<
26 / 37
![Page 27: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/27.jpg)
Tasks 7sort the file authors into alphabetical orderfind the list of unique authorsfind how many time each appears in theoriginal list
27 / 37
![Page 28: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/28.jpg)
Pipes and PipelinesTake the standard output of one commandand feed it in to the standard input of thenextUses the pipe (vertical bar) symbol |No intermediate files!
Efficient
28 / 37
![Page 29: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/29.jpg)
29 / 37
![Page 30: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/30.jpg)
Tasks 8without using intermediate files...
sort the authors filefind the count of unique authorsput that list in to numerical order
30 / 37
![Page 31: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/31.jpg)
Text Editorsnot Wordvim is mentioned a lot but don't use just yet
we recommend nano
^O to save^X to exit
31 / 37
![Page 32: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/32.jpg)
Task 9add some more authors to the authors filererun the previous analysisput the analysis command pipleine in to afile called author_count
32 / 37
![Page 33: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/33.jpg)
Any Questions?
33 / 37
![Page 34: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/34.jpg)
34 / 37
![Page 35: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/35.jpg)
Resources - Where to practisemacOS users can use the terminalWindows10 has Windows Subsystem forLinuxDepartmental resourcesEligible users can apply for an account onthe ACRC clustersCloud vendors provide trial subscriptions
35 / 37
![Page 36: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/36.jpg)
[email protected] Website -https://www.bristol.ac.uk/acrc/http://swcarpentry.github.io/shell-novice/http://www.ee.surrey.ac.uk/Teaching/Unix/
36 / 37
![Page 37: Introduction to Linux - acrc.bris.ac.uk to Linux.pdf · Introduction to Linux University of Bristol - Advance Computing Research Centre 1 / 37. O pe rati ng Sy ste ms Program running](https://reader033.vdocuments.us/reader033/viewer/2022052519/60380d85a8ea04693a422d9e/html5/thumbnails/37.jpg)
CreditsLicence
This work is licensed under a CreativeCommons Attribution-ShareAlike 4.0International License.
Based on previous versions by
Rob Thomas - ACRCUniversity of Surrey
Image Credits
Redirects and Pipes (c) SoftwareCarpentry CC-BY-4.0 37 / 37