176k views
0 votes
Write a command that will start and run the gedit command in the background.

User Anjayluh
by
5.7k points

1 Answer

1 vote

Answer:

The command is gedit &

Step-by-step explanation:

The command gedit tells the shell (the program that takes keyboard commands and carries them to the operating system) to run gedit (a text editor) and the ampersand symbol (&) suspends (or makes the program run in the background).

This can be understood from a historical perspective. In the 1980s, most users have only a terminal and can run only a program at once. They could suspend the current program using Ctrl-Z (or run the program in the background), and do some other tasks in the while.

Later, to check which job (or process) was suspended, they wrote the command jobs, which tells the user that the suspended ones (or running in the background) were those jobs inside square brackets ( [number-of-the-job] ), that is, the jobnumber, assigned to that command (in this case, the command would be gedit, although it was not available at that time since its initial release was in 1999).

Then, to run again that suspended process, they wrote the command fg (foreground) followed by (%) and the jobnumber, so they were able to continue with the suspended job (or running-in-the-background job).

This a legacy of Unix-like systems and it is still in use nowadays.

So, to run gedit in the foreground, or run it again, it suffices to write the command fg followed by % and the jobnumber that corresponds to the aforementioned program, that is, gedit.

By the way, you can suspend gedit using Ctrl-Z in the terminal and run it again following all the instructions aforementioned.

User Thomas Hsieh
by
5.9k points