linux使进程不依赖终端,Linux nohup命令应用简介--让Linux的进程不受终端影响

nohup命令应用简介--让Linux的进程不受终端影响

by:授客

QQ:1033553122

#开启ping进程

[root@localhost ~]# ping

localhost &

[2] 4169

[1]

Terminated

nohup ping localhost

[root@localhost ~]# PING

localhost (127.0.0.1) 56(84) bytes of data.

64 bytes from localhost

(127.0.0.1): icmp_seq=1 ttl=64 time=0.105 ms

64 bytes from localhost

(127.0.0.1): icmp_seq=2 ttl=64 time=0.069 ms

...

如图

a4c26d1e5885305701be709a3d33442f.png

#查看后台进程:

[root@localhost ~]# ps -axu

| grep ping

Warning: bad syntax,

perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root

4169

0.0

0.0

4392 792

pts/0

S

04:08 0:00

ping localhost

root

4177

0.0

0.0

4336 728

pts/1

S+

04:10 0:00

grep ping

a4c26d1e5885305701be709a3d33442f.png

#关闭开启ping命令的终端,再次查看进程

[root@localhost ~]# ps -axu

| grep ping

Warning: bad syntax,

perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root

4184

0.0

0.0

4336 728

pts/1

S+

04:13 0:00

grep ping

说明:进程结束

#加上nohup命令,让进程不受终端影响

[root@localhost ~]# nohup

ping localhost &

[1] 4218

[root@localhost ~]# nohup:

ignoring input and appending output to `nohup.out'

a4c26d1e5885305701be709a3d33442f.png

#查看后台进程

[root@localhost ~]# ps -axu

| grep ping

Warning: bad syntax,

perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root

4218

0.1

0.0

4392 792

pts/0

S

04:19 0:00

ping localhost

root

4224

0.0

0.0

4336 732

pts/1

S+

04:20 0:00

grep ping

a4c26d1e5885305701be709a3d33442f.png

#关闭开启ping命令的中断,再次查看进程

[root@localhost ~]# ps -axu

| grep ping

Warning: bad syntax,

perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root

4218

0.0

0.0

4392 792

?

S

04:19 0:00

ping localhost

root

4229

0.0

0.0

4336 728

pts/1

S+

04:21 0:00

grep ping

说明:进程依然还在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值