比如说要启动redis服务可执行文件为
[root@localhost src]# ls -l redis-server
-rwxr-xr-x. 1 root root 5181440 Nov 14 00:13 redis-server
- 正常启动./src/redis-server。
#正常执行了以后想放到后台ctrl+z
^Z
[1]+ Stopped ./src/redis-server
#然后输入jobs命令
[root@localhost src]# jobs
[1]+ Stopped ./src/redis-server (wd: /usr/local/src/redis-3.2.6)
#bg 1表示把jobs查出来的[1]放到后台执行
[root@localhost src]# bg 1
[1]+ ./src/redis-server & (wd: /usr/local/src/redis-3.2.6)
[root@localhost src]# ps -ef|grep redis-server
root 59712 14303 0 01:00 pts/1 00:00:00 ./src/redis-server *:6379
root 59844 14303 0 01:07 pts/1 00:00:00 grep --color=auto redis-server
#fg 1再放到前台
[root@localhost src]# fg 1
./redis-server
- 后台直接启动:./src/redis-server &