LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   "&" after a command in commandline (https://www.linuxquestions.org/questions/fedora-35/and-after-a-command-in-commandline-320777/)

faezeh 05-06-2005 12:08 PM

"&" after a command in commandline
 
hello,

I read that by typing "&" after a command in the commandline,this process runs in the background so it doesnot make the bash busy running it and you still have your commandline to type more commands,but when I typed "vim a.cpp & " and then enter,I was given [1] and 3909 ,what do
these numbers mean,and how is "a.cpp" running on my system?

Thanks

rstewart 05-06-2005 12:19 PM

Hello,

LOL What you basically did was to tell the shell to run the vim editor on the file "a.cpp" and to run the session in the background. Since running something in background detaches the screen and keyboard from the running process, you basically had an editing session running with no I/O on the file. (BTW: This is a useful thing to do if you want to momentarily postpone your editing of a source file to check something else out and want a full blown shell to do it in.)

The [1] indicated that it was the first process running in background for your shell, and the 3909 was the process ID assigned to the process.

To get the edit session "reattached" to the screen and keyboard you can type "fg". This instructs the shell to bring the currently running background process back into the foreground.

faezeh 05-07-2005 10:05 PM

hi again,
can you instruct me on the meaning of running a process in the background and foreground.

Thanks

kencaz 05-07-2005 10:28 PM

This may help a little>>>

http://faculty-staff.ou.edu/R/Thomas...ix/process.htm

KC


All times are GMT -5. The time now is 06:31 AM.