/
Introduction to the Linux Command Line Interface Introduction to the Linux Command Line Interface

Introduction to the Linux Command Line Interface - PowerPoint Presentation

trish-goza
trish-goza . @trish-goza
Follow
430 views
Uploaded On 2017-11-29

Introduction to the Linux Command Line Interface - PPT Presentation

Research Computing Systems Bob Torgerson July 19 2016 Overview Connecting to Remote Systems Working with Files File and Directory Permissions Working with Active Processes Customizing the User Environment ID: 611239

permissions file processes amp file permissions amp processes files working linux job view bash kill shell string ssh chmod

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Introduction to the Linux Command Line I..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Introduction to the Linux Command Line Interface

Research Computing Systems

Bob

Torgerson

July 19, 2016Slide2

Overview

Connecting to Remote Systems

Working with Files

File and Directory Permissions

Working with Active Processes

Customizing the User Environment

Submitting a JobSlide3

Linux Overview

Unix

-like OS developed by Linus Torvalds in 1991

Open

Source Software

Runs on more computer hardware platforms than any other OS”

(

wikipedia.org

)

Runs

on

supercomputers, high performance clusters, servers, workstations, & embedded

systems

The

shell is a command line interface to the OS 

Open a “terminal” window

Edit files

Launch processes or jobs

Check the status of running processes

Send

signals to processes

Common shells: bash,

ksh

,

tcsh

,

cshSlide4

Connecting to Remote Systems

RCS supports

ssh

,

sftp

and

scp

clients

Linux and

MacOS

come

with

versions

of

ssh

,

sftp

and

scp

.

Windows

requires downloading

a terminal and file transfer program (and optionally an X11 server)

. RCS has

the most experience supporting

PuTTY

,

FileZilla

, and

Xming

.

Login with:

ssh

–X –Y

username@

systemname.alaska.edu

Example:

ssh

–X –

Y

torgerso

@

pacman3.arsc.edu

Copy files with:

scp

myfiles.tar.gz

username@systemname.arsc.edu:~/

phys608/

Example:

scp

myfiles.tar.gz

torgerso

@

pacman4.arsc.edu:~/

phys608

Set up

ssh

keys, see “

news

pubkeys

”Slide5

Navigating the File System

Linux is a collection

of files

and directories (think of folders)

The

top directory is called the “root”.

Some

directories contain actual files, others provide access to hardware devices

Common Commands:

pwd

cd

ls

ls

–al

ls

$HOME

mkdir

rm

filename

rmdir

rm

rf

directoryNameSlide6

Working with Files

Common

Linux Text

Editors

VIM including

gvim

Emacs

n

edit

or gedit

(X11 enabled only)

Quickly view the contents of a file with:

cat

less (exit

with “q

”)

Documentation for shell commands:

Man pages – man

cmd

Info documents – info

cmd

View images with the “

display

” commandSlide7

File and Directory Permissions

Permissions control access to files and directories

Three categories of access:

user

(that’s your account)

group (type

`

groups

`

to determine which you belong to)

other

(everybody else on the system)

Three categories of permissions:

read

write

execute

Use

`

chmod

`

to modify access permissions

chmod

u+r

myDir

(add read permissions for myself)

chmod

g+rx

myFile

(add group read & execute permissions)

chmod

go-

rwx

myFile

(remove group and other permissions)Slide8

File and Directory Permissions

Security

Awareness:

World write permissions are discouraged

.

Never share your login credentials (username & password) with others.

What else?Slide9

Working with Active Processes

`

ps

`

allows you to view process statuses

Useful variations

`

ps

elf`

and

`

ps

aux`

`

top

`

to view what’s eating up all the CPU resources!

exit

with “q”

Send a signal:

CTRL+c

(kill)

CTRL+z

(suspend

)

Search with

`

grep

`

,

then

`sort

`Slide10

Working with Active Processes

Try it!

$ sleep 1000

$ ctrl-z

$

ps

$

fg

$ ctrl-c

$ sleep 1000 &

$

ps

$

fgSlide11

Working with Active Processes

Try it!

# create a new file called

sleepyTime.sh

containing:

#!/bin/bash

echo “hello there. I’m tired...”

sleep 1005

exit

$

chmod

u+x

sleepyTime.sh

$ ./

sleepyTime.shSlide12

Working with Active Processes

The `kill

`

command is used to terminate processes.

`

man kill`

Send particular signals, e.g.

`

kill –KILL 3039`

Try it!

$ sleep 2000 &

$

ps

$ kill <

pid

>

$

psSlide13

Customizing the User Environment

Environment Variables store short strings of information

Important variables: $PATH, $HOME, $CENTER

The

shell auto-expands variables

Set with

bash: export CHUBBY_BUNNIES=funny

bash: export PATH=${PATH}:/u1/

uaf

/

torgerso

/

bin

csh

/

tcsh

:

setenv

CHUBBY_BUNNIES funny

csh

/

tcsh

:

setenv

PATH ${PATH}:/u1/

uaf

/

torgerso

/

bin

View with echo $CHUBBY_BUNNIESSlide14

Customizing the User Environment

Customize

your login by modifying your $HOME “.” files

Example

for bash

users:

Add

the following to your ~/.profile file:

export

PS1=“Good Morning!% ”

Then

source the file with “. ~/.profile” Slide15

File

Input/Output

& Redirection

Three forms of input/output:

stdin

” from keyboard or a file

stdout

” to screen or a file

stderr

” to screen or a file

Redirect I/O with

Greater/Less Than Symbols, “>” or “>>” or “<“

Pipes, “|”

Tie

stdout

and

stderr

together with “2>&1”

In

bash:

mpirun

$CENTER/

wrf.exe

>

wrf.mix.out

2>&1 &!Slide16

Special Shell Characters

“?” matches a single character

*” matches anything

&” backgrounds a running

process

View

the process status with

`

ps

`

or `jobs`

Bring process back to foreground with

`

fg

`

“\” is the shell escape to not interpret white space or special characters

Treating a string of characters literally requires using single forward quotes before and after the string.

Treating a string of characters as a string after interpreting any embedded variables requires using double forward quotes before and after the string.Slide17

Submitting a Job

This assumes using torque/

moab

(on pacman or fish).

1

st

create a job submission script named “

myjob.pbs

”,

for example –

http

://www.arsc.edu/arsc/knowledge-base/job-submission-on-pacman/

index.xml

Submit a batch job: `

qsub

myjob.pbs

`

Submit a job to a specific queue with a reservation:

`

qsub

–q standard_16 –W

ADVRES

:<

ReservationID

>

myjob.pbs

`

Submit an interactive job:

`

qsub

–I –l nodes=1:ppn=16 –q standard_16`Slide18

Additional Resources

https://training.linuxfoundation.org/free-linux-

training/

http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/

http

://

linuxsurvival.com/

http://linuxreviews.org/beginner

/Slide19

Questions, Comments?

u

af-rcs@alaska.edu

508/511

Elvey

Building

907-450-8602