introduction to linux - university of bristol to linux.pdf · 2019-05-22 · introduction to linux...
TRANSCRIPT
Operating SystemsProgram running all the timeInterfaces between other programs andhardwareProvides abstractions (common interfaces,e.g. filesystems)
You may know
WindowsMacOSiOSAndroid
2 / 37
Kernels and ShellsThe kernel is the core of the operatingsystemThe shell is the interface between the useraand the operating system
5 / 37
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
Linux PhilosophyKit of partsOne small thing does one thing wellSmall utilities can be joined together toperfom more complicated tasks
7 / 37
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
DirectoriesPathnames and /Finding where you are (pwd)Changing to a different Directory (cd)The Directories . and ..Home directories (~)
13 / 37
Tasks 1find out where you arewhat is pathname one level above (gothere)go back to your home directory (prove it)
14 / 37
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
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
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
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
Tasks 5list all the two letter commands in /usr/binlist all the commands with "to" in theirname
22 / 37
Tasks 6Read the man page for headPick a random command from in /usr/binand read it's manpage
24 / 37
Tasks 7sort the file authors into alphabetical orderfind the list of unique authorsfind how many time each appears in theoriginal list
27 / 37
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
Tasks 8without using intermediate files...
sort the authors filefind the count of unique authorsput that list in to numerical order
30 / 37
Text Editorsnot Wordvim is mentioned a lot but don't use just yet
we recommend nano
^O to save^X to exit
31 / 37
Task 9add some more authors to the authors filererun the previous analysisput the analysis command pipleine in to afile called author_count
32 / 37
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
[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