introduction to linux intro.pdfslower moving stable with long support period. new release every...

28
Introduction To Linux Rob Thomas - ACRC

Upload: others

Post on 04-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

Introduction To Linux

Rob Thomas - ACRC

Page 2: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

A free Operating System based on UNIX(TM)

An operating system originating at Bell Labs. circa 1969 in the USA

More of this later…...

What Is Linux

Page 3: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Free● One OS from Desktop -> Supercomputer● Flexible● Stable

Why Linux?

Page 4: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● AKA Distros● Linux == (Kernel + Utilities + GUI)● Many versions of each.● Moving target

Distributions

Page 5: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Fast Moving Latest & Greatest Features ○ Ubuntu○ Fedora○ Mint○ Debian Testing○ ….

User Distributions

Page 6: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Slower Moving○ Stable with long support period.○ New release every >= 2 years○ RHEL/CentOS○ Ubuntu LTS○ Debian Stable○ ...

Enterprise Distributions

Page 7: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Kit of parts● One small thing does one thing well● Small utilities can be joined together to

perform more complicated tasks.

Linux Philosophy

Page 8: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

Bits & Pieces

Page 9: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

At First...

$ ls | wc -l

Page 10: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

But Later..

$ tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn | sed ${1}q

Page 11: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Originally command line based● GUIs came along later● Modern linux attempts simplicity of

Mac/Windows (Ubuntu Unity)Command line is extremely powerful but:With great power comes great responsibility.

User Interface

Page 12: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

We will be concentrating on command line use of Linux.

Unix/Linux has always encouraged reuse of existing utilities etc.. With this in mind, this workshop’s origins are a guide produced by the University of Surrey.

http://www.ee.surrey.ac.uk/Teaching/Unix/

Onward

Page 13: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

We’ll be working on the HPC (Blue Crystal)● Start Putty● Log in to bluecrystalp3.acrc.bris.ac.uk● And off we go….

Logging On

Page 14: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Changing to a different Directory (cd)● The directories . and ..● Pathnames & /● Home directories● Listing files and directories (ls)● Making Directories (mkdir)

Files & Directories

Page 15: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Copying Files (cp)● Moving Files (mv)● Removing Files and directories (rm)● Displaying the contents of a file on the

screen (cat, less)● Searching the contents of a file (grep)

File manipulation

Page 16: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Wildcards○ ? - Any Character○ * - More Than One Character

● Filename Conventions (e.g. .c)● Getting Help (man, apropos)

Filenames

Page 17: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Redirecting the Output (>, >>)● Redirecting the Input (<)● Pipes (|)

Redirection

Page 18: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

tr -cs A-Za-z '\n'|tr A-Z a-z|sort |uniq -c |sort -rn

Doug McIlroy’s Word Frequency PipelineIf you are not a UNIX adept, you may need a little explanation, but not much, to understand this pipeline of processes. The plan is easy:

Make one-word lines by transliterating the complement (-c) of the alphabet into new lines (note the quoted newline), and squeezing out (-s) multiple newlines.

Transliterate uppercase to lowercase.

Sort to bring identical words together.

Replace each run of duplicate words with a single representativeand include a count (-c).

Sort in reverse (-r) numeric (-n) order.

Page 19: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Displaying Permissions (ls -l)● Understanding Permissions

○ User, Group, Other● Changing Permissions (chmod)

File Permissions Permissions

Page 20: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● What is a Process?● Listing Processes (ps)● Background Process● Killing a process (kill)

Processes and Jobs

Page 21: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

All our commands have been run by the Shell (bash).Handles● Redirection● Wildcards● Backgrounding

The Shell

Page 22: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

The Shell is a full programming language● Conditionals, Loops, Functions

○ Above covered in a forthcoming course● Variables

○ Built in and user○ Normal - This shell○ Environment - All processes started from

this shell.

Variables

Page 23: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Disk Space (quota, du, df)● Comparison (diff, cmp)● Compression (gzip, zcat)● Searching (find)

Miscellany

Page 24: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

Normally installed by an administrator using a package manager● yum for Redhat and Derivatives

e.g. CentOS● apt for Debian and Derivatives

e.g. Ubuntu

Installing Software Packages

Page 25: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

Sometimes a package needs to be built from source● Not in any repos● Latest and greatest required● No root (admin) access.

Building Software Packages

Page 26: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Downloading (wget)● Extracting (tar)● Configuring (configure)● Building (make)

Build process

Page 27: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

● Run using path name● PATH Environment Variable● Startup files

Running the Newly Built Package

Page 28: Introduction To Linux Intro.pdfSlower Moving Stable with long support period. New release every >= 2 years RHEL/CentOS Ubuntu LTS Debian Stable Enterprise Distributions Kit of parts

Can we go home now?

Any Questions?