advanced shell scripting and computer environment - lecture 4€¦ · scripting and computer...

Post on 13-Oct-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Advanced Shell

Advanced shell

Scripting and Computer Environment - Lecture 4

Saurabh Barjatiya

International Institute Of Information Technology, Hyderabad

28 July, 2011

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Contents

1 Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

scp

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

scp

rsync

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

scp

rsync

passwd

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

scp

rsync

passwd

Winscp (Windows based)

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

scp

rsync

passwd

Winscp (Windows based)

Putty (Windows based)

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

scp

rsync

passwd

Winscp (Windows based)

Putty (Windows based)

SSH Secure Shell client (Windows based)

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Working remotely

ssh

scp

rsync

passwd

Winscp (Windows based)

Putty (Windows based)

SSH Secure Shell client (Windows based)

XManager (Windows based)

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

< → Take input from file

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

< → Take input from file

2 > → Send error output to file

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

< → Take input from file

2 > → Send error output to file

>> → Append output to file

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

< → Take input from file

2 > → Send error output to file

>> → Append output to file

| → Send output to program as input

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

< → Take input from file

2 > → Send error output to file

>> → Append output to file

| → Send output to program as input

‘ ‘ → Use command output as argument

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

< → Take input from file

2 > → Send error output to file

>> → Append output to file

| → Send output to program as input

‘ ‘ → Use command output as argument

tee → Print as well as send to file

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Redirection

> → Send output to file

< → Take input from file

2 > → Send error output to file

>> → Append output to file

| → Send output to program as input

‘ ‘ → Use command output as argument

tee → Print as well as send to file

tail − f → Print file contents till Ctrl+C

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

bg

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

bg

ps

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

bg

ps

&

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

bg

ps

&

;

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

bg

ps

&

;

Ctrl + C

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

bg

ps

&

;

Ctrl + C

kill

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Processes

Ctrl + Z

fg

jobs

bg

ps

&

;

Ctrl + C

kill

killall

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Command line features

Shell wildcards ‘*’, ‘?’ and ‘[ ]’

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Command line features

Shell wildcards ‘*’, ‘?’ and ‘[ ]’

!<command> → Run last command with same program name

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Command line features

Shell wildcards ‘*’, ‘?’ and ‘[ ]’

!<command> → Run last command with same program name

echo $? → Return value of last command

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Command line features

Shell wildcards ‘*’, ‘?’ and ‘[ ]’

!<command> → Run last command with same program name

echo $? → Return value of last command

Ctrl + R → Reverse incremental search

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Command line features

Shell wildcards ‘*’, ‘?’ and ‘[ ]’

!<command> → Run last command with same program name

echo $? → Return value of last command

Ctrl + R → Reverse incremental search

history

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

echo

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

echo

alias

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

echo

alias

unalias

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

echo

alias

unalias

Important variables

PATH

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

echo

alias

unalias

Important variables

PATH

PWD

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

echo

alias

unalias

Important variables

PATH

PWD

HISTTIMEFORMAT=’%y %m %d %T ’

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

Advanced ShellWorking remotelyRedirection and ProcessesMiscellaneous

Environment variables

set

export

echo

alias

unalias

Important variables

PATH

PWD

HISTTIMEFORMAT=’%y %m %d %T ’

PS1

Saurabh Barjatiya Advanced shell Scripting and Computer Environment - Lecture 4 IIIT Hyderabad

top related