nohup 的使用是十分方便的,只需在要处理的命令前加上 nohup 即可,标准输出和标准错误缺省会被重定向到 nohup.out 文件中。一般我们可在结尾加上”&”来将命令同时放入后台运行,也可用”>filename 2>&1″来更改缺省的重定向文件名。
nohup 示例
[root@ ~]# nohup ping & [1] 3059 nohup: appending output to `nohup.out’ [root@ ~]# ps -ef |grep 3059 root 3059 984 0 21:06 pts/3 00:00:00 ping root 3067 984 0 21:06 pts/3 00:00:00 grep 3059 [root@ ~]#
在进行文件重定向的时候,,>表示覆盖,>>表示追加。
cat a >> b 追加
天才是百分之一的灵感加上百分之久十久的努力