Docsity

Linux Command Line Introduction: Interacting with a Linux System using the Command Line, Slides of History

Partial preview of the text

Download Linux Command Line Introduction: Interacting with a Linux System using the Command Line and more Slides History in PDF only on Docsity!

Introduction

to

the

Linux

Command

Line

Ken

Weiss

HITS

Computational

Research

Consulting

Division

A

word

from

our

sponsor…

This

class

is^

brought

to

you

courtesy

of:

Advanced

Research

Computing

- Technical

Services

ARC

‐TS

For

more

information

please

click

on:

http://arc

‐ts.umich.edu

kgw 2016

2

Course

Text

William

E^

Shotts,

Jr.,

“The

Linux

Command

Line:

A

Complete

Introduction,”

No

Starch

Press,

January

Download

Creative

Commons

Licensed

version

at

http://downloads.sourceforge.net/project/linuxcommand/TLCL/13.07/TLCL

‐13.07.pdf.

cja 2014

4

The

command

shell

cja 2014

5

What

you

will

be

using

kgw 2016

7

The

command

shell

The

command

shell

is

an

application

that

reads

command

lines

from

the

keyboard

and

passes

them

to

the

Linux

operating

system

to

be

executed.

When

you

login

to

a^

remote

Linux

system,

using

a^

tool

like

ssh

,^ you

will

automatically

be

connected

to

a^

shell.

Your

computing

session

is

kept

separate

from

other

user’s

computing

sessions,

because

they

are

“enclosed”

in

a

“shell”. On

your

desktop,

laptop,

or

tablet,

you

may

have

to

find

and

execute

a^

terminal

emulator

application

to

bring

up

a^

shell

in

a^ window. cja 2014

8

The

command

line

A^

basic

way

of

interacting

with

a^

Linux

system

Execute

commands

Create

files

and

directories

Edit

file

content

Access

the

web

Copy

files

to

and

from

other

hosts

Run

HPC

jobs

…

do

things

you

can’t

do

from

the

conventional

point

‐

and

‐click

Graphical

User

Interface

(GUI)

cja 2014

10

Why

command

line?

1.^

Linux

was

designed

for

the

command

line

2.^

You

can

create

new

Linux

commands

using

the

command

line,

without

programming

3.^

Many

systems

provide

only

the

command

line,

or

poorly

support

a^

GUI

interface

-^

Such

as

most

HPC

systems

4.^

Many

things

can

be

accomplished

only

through

the

command

line

-^

Much

systems

administration

&^

troubleshooting

5.^

You

want

to

be

cool

cja 2014

11

Logging

in

to

a

host

We

will

be

using

the

host:

linux

‐training.arc

‐ts.umich.edu

for

our

class.^ For

Mac

or

other

Linux

workstation,

from

a^

terminal

window

type:

ssh

uniqname

@linux

‐training.arc

‐ts.umich.edu

On

a^

PC,

start

PuTTY.

In the

“Host

Name

(or

IP

address)”

box

type: linux

‐training.arc

‐ts.umich.edu

Click

on

the

“Open”

button.

Once

connected,

you

will

see:

“login

as:”.

Type

in

your

uniqname and

press:

enter

kgw 2016

13

Logging

in

to

a

host

You

will

be

prompted:

“uniqname@linux

‐training.arc

‐ts.umich.edu's password:”

Enter

your

Level

1 password

and

press

enter.

You

are

now

logged

into

a^

shell

on

the

linux

‐training

host

Your

shell

prompt

looks

like

this:

uniqname

@training:~$

cja 2014

14

Typing

into

the

shell

Basic

input

line

editing

commands

Backspace erases

previous

character

Left

and

right

arrow move

insertion

point

on

the

line

Control

‐c interrupts

whatever

command

you

started

and

returns

you

to

the

shell

prompt

(usually)

Control

‐u erases

the

line

from

the

beginning

to

the

cursor

Control

‐k erases

the

line

from

the

cursor

to

the

end

Enter

executes

the

line

you

typed

Up

and

down

arrow will

access

your

command

history

Type

“exit

”^ and

press

Enter without

the

quotes

to

exit

the

shell

Click

the

red

"close"

icon

at

the

top

of

the

Terminal

window

to

close

it^ (on

a^ Mac)

cja 2014

16

Lab

Task:

Enter

some

basic

commands

date ~$

id ~$

ps ~$

df

kh

who ~$

top

#^

type

Control

‐c

or q to

exit

history

cja 2014

17

Linux Filesystem Concepts

Files are stored in a

directory

(think: folder)

Directories may contain other directories aswell as files A hierarchy of directories is called a

directory

tree A directory tree (a connected graph with nocycles) has a single, topmost

root

directory

A directory tree, rooted at the

system root

directory

/”, is called a

filesystem

cja 2014

19

kgw 2015

20

http://www.openbookproject.net/tutorials/getdown/unix/lesson2.html

A Linux Filesystem