Monday, June 9, 2014

Run Linux command asking input or password in background



When we run a Linux command in background such as
scp test.sql jiansen@example.com:/home/jiansen &
or  ignore the hangup signal
nohup scp test.sql jiansen@example.com:/home/jiansen &
We can not input  password.
To make an input for  background job, First we use
scp test.sql jiansen@example.com:/home/jiansen
input password, then type Ctrl +Z to suspend the job
then type
bg
to put it in background.
To list all process
ps aux
To list process containing scp and find process id
ps aux |grep scp
To kill a process
kill processid
To force to kill, this is strong:
kill -9 processid

No comments:

Post a Comment