I am a new Linux command line user. How do I start or run command in the background so that I can access command prompt immediately?
A command that has been scheduled nonsequentially is called background process. You can not see the background processes on screen. For example, Apache httpd server runs in background to serve web pages. You can put your shell script or any command in background.
You can put a task (such as command or script) in a background by appending a & at the end of the command line. The & operator puts command in the background and free up your terminal. The command which runs in background is called a job. You can type other command while background command is running. The syntax is:
To send back this job in the background hit CTRL-Z i.e. while holding the CTRL key, press z key. This will suspend the current foreground job. Type the following command to send back the job in the background: %2 & OR use bg command: bg The grep command job is now running in the background.
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.