Opening browser via terminal

RobinHook

New Member
Credits
31
Hi guys, I'm completely new when it comes to Linux or command line or programing / coding in general so I have a weird question.

What happens when I open a browser (Firefox in my case) via terminal? The thing is that after the browser is open, terminal stops responding to commands. I can write in it, but the text comes out without a user.
I add a ss for you to understand my newbie lingo. I would appreciate an explanation of what is happening rather then a solution.

Thank you for your time.
 

Attachments



KGIII

Well-Known Member
Credits
5,238
When you open a process from the terminal, the terminal is then going to stay open until you close the application. Unless, of course, it's a self-terminating process. In that case, it will run it, close it, and return the terminal to a state where it accepts additional inputs.

Also, if you open a browser with the terminal and then close the terminal, the browser will close. You've ended the process that was running in the terminal.

Edit: @captain-sensible mentions things I probably should have mentioned in my post. We seemingly posted at about the same time.
 

RobinHook

New Member
Credits
31
When you open a process from the terminal, the terminal is then going to stay open until you close the application. Unless, of course, it's a self-terminating process. In that case, it will run it, close it, and return the terminal to a state where it accepts additional inputs.

Also, if you open a browser with the terminal and then close the terminal, the browser will close. You've ended the process that was running in the terminal.
Thank you
 

captain-sensible

Well-Known Member
Credits
7,974
i remember using ubuntu and looking at menu options and whats behind the listing , or creating a launcher. Using a terminal is a direct command, main useful thing to remember is that if you have an issue with something lets say audacity , then trying to launch gives you clues of whats wrong.

I'm on Slackware -current basically testing version between stable releases; things are in flux programs evolve and so do supporting dependencies. When i try to launch audacity from menu nothing happens. this is what I get from a terminal:

Code:
bash-5.0$ audacity
audacity: error while loading shared libraries: libwebp.so.6: cannot open shared object file: No such file or directory
bash-5.0$
So i know libwebp is giving me a problem.I don't really need audacity for anything i can think of at the moment so not bothered to fix it.

anyway all the "&" is a sort of flag, process in background etc.
 

captain-sensible

Well-Known Member
Credits
7,974
I gave up trying to understand things unless i need to- I do remember "In Linux everything is a file", .
. if you want to know Linux inside out probably you start at beginning of Linuxfromscratch.org but for any questions you have no problem , post them and if anyone knows usually they reply :^)
 

JasKinasis

Well-Known Member
Credits
5,067
@RobinHook - Generally - if you start a graphical application like firefox from the terminal, it basically blocks the terminal until the application (in this case firefox) is closed.

As @captain-sensible has pointed out - in order to start firefox and still be able to use the terminal you will need use & at the end of the command, which will run the application in the background.

Additionally - when running a graphical process in the background - it may also end up displaying lots of warnings, or error messages in the terminals stdout and stderr streams too. Some applications send a lot of messages, which can be disruptive if you plan to do other things in the terminal.

To avoid this eventuality - alongside running in the background, another thing you can do is - redirect all terminal-based textual output from the process to /dev/null, like this:
Bash:
firefox &> /dev/null &
The &> redirects the stdout and stderr streams from firefox to /dev/null and the & at the end of the line tells the shell to run firefox as a job in the background.

And firefox will continue to run in the background until you either shut it down (via one of firefox's usual methods e.g. - ctrl+q in firefox, or ctrl+w on the last open tab, or clicking on the close button etc), or until you use the kill command in the terminal to kill firefox.

NOTE:
/dev/null is a special device known as "The black hole", or "The bit bucket", or "The void". Anything sent to, or written to /dev/null is effectively lost.
And whenever /dev/null is read from, the result is always zero.

Once you have a job running in the background there are various job control commands like jobs, fg, bg, kill and killall - that can be used to control running jobs. But that goes a bit beyond the scope of what I'm explaining here.
 

Members online


Top