Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
![Reply](https://www.linuxquestions.org/questions/images/buttons/reply.gif) |
02-10-2009, 01:54 PM
|
#1
|
Member
Registered: Mar 2008
Distribution: Ubuntu Lucid
Posts: 131
Rep:
|
Running two commands symultaneously from CLI
hi. a simple problem with probably a simple answer
what i want to do is run two commands (nautilus and gedit) from the command line/shell script at the same time. i can obviously do && between them, but this requires the first app to close before moving on to the second one. i want to run both apps at the same time so i can run gedit with some project files open on it, and nautilus to browse those files/other files.
regards
james waples, 14
|
|
|
02-10-2009, 02:11 PM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
just do a single & then, or am i missing something?
|
|
|
02-10-2009, 02:20 PM
|
#3
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852
|
To run a program in the background when you launch it, or from within a script, place a single & after it. "gedit &". This will free the console up for the next command.
To send an already-running process to the background, first suspend it with crtl+z, then use the bg command to start it running again as a background process. Use fg to return a background process to the foreground.
By the way, what's wrong with simply opening up two separate consoles?
Last edited by David the H.; 02-10-2009 at 02:21 PM.
|
|
|
02-10-2009, 11:12 PM
|
#4
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Quote:
Originally Posted by David the H.
By the way, what's wrong with simply opening up two separate consoles?
|
You waste double amount of ram. Not only two xterm's [1] or whatever, but also 2 bash sessions instead of just one. So, if the only purpose of that session is to use it as a launcher, it makes sense to just send the processes to the background so you can reuse the same shell again.
However, the output of all the programs will be multiplexed in that terminal, which might turn it completely unreadable.
[1] You could mitigate this partially by using urxvtd/urxvtc, which has a server/client architecture. It's a pity that there isn't a similar thing for bash, because I have dozens of shell sessions open at any given time. :P
|
|
|
02-10-2009, 11:47 PM
|
#5
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852
|
Fair enough, although I'd say the extra burden is negligible unless your system is seriously old or underpowered. I regularly keep four or five console windows open myself and I never notice any trouble. Of course, I use konsole, which has a tabbed interface, so only one instance is needed to run all the sessions.
Have you checked out the screen program? It provides multiplexing within a single terminal.
|
|
|
02-11-2009, 12:19 AM
|
#6
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Quote:
Originally Posted by David the H.
Fair enough, although I'd say the extra burden is negligible unless your system is seriously old or underpowered. I regularly keep four or five console windows open myself and I never notice any trouble.
|
Well, that's the way to think that push people to upgrade every year, even when they don't need :P That your machine can doesn't mean that you need to waste all the power. It's just silly to use 5 shells when a single one suffices. Surely your machine could also run 400 without any problem, but why do it if it's not needed?
Besides that, the weight really depends on many things. It depends on the application, in the way you compiled it, whether you use compositing or not, where you use unicode or not (very noticeable), the number of characters that will fit into the window (size of the window), the length of your scrollback buffer (also very noticeable, in fact this can be the biggest impact if you set your buffer to something insane like 100k lines), and so on.
I could easily design a config for urxvt that would blow up some hundred MBs with a few instances. Bash shouldn't be a problem though.
Quote:
Of course, I use konsole, which has a tabbed interface, so only one instance is needed to run all the sessions.
|
Konsole is relatively good at this. It's been long since the last time I tried, so I really can't compare the actual situation of konsole vs. urxvtd/c. Still, it can't help about the bash thing. Every new tab will spawn a new bash session (or whatever shell you use).
Quote:
Have you checked out the screen program? It provides multiplexing within a single terminal.
|
I use it every hour and recommend it as well. That and urxvtc are my main memory savers, since 90% of the software I run is command line based.
Last edited by i92guboj; 02-11-2009 at 12:21 AM.
|
|
|
02-11-2009, 12:45 AM
|
#7
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852
|
Quote:
Originally Posted by i92guboj
but why do it if it's not needed?
|
Convenience mostly. I find it easier to work this way, both from a practical and a conceptual point of view. Having each command running in a separate instance means I don't have to concentrate to keep track of what's running where, and all I have to do is switch between windows/tabs to see what's going on. I can also tear off a tab and watch two things running side-by-side if I need to. Nothing gets buried, lost, or forgotten, and no output gets scrambled.
For me, this convenience more than makes up for the added "burden" on the machine, which as I said isn't really much of one. If I have a system that can handle it, and handle it easily, why not take advantage of it (and this isn't the most powerful of machines either, being about 5 years old now)? And for the record, I am one of those people who uses an "insanely" sized scrollback buffer (I just can't stand it when the important stuff I want to see has disappeared from the history).
But hey, if you're happier working from a single terminal, who am I to argue? ![Smilie](https://www.linuxquestions.org/questions/images/smilies/smile.gif)
|
|
|
02-11-2009, 12:52 AM
|
#8
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Fair enough as well. At the end of the day, it all comes down to how you work. There's no single better method for everyone. Those who think otherwise are probably running some other OS where having options is an utopia
Cheers ![Smilie](https://www.linuxquestions.org/questions/images/smilies/smile.gif)
|
|
|
02-11-2009, 11:35 AM
|
#9
|
Member
Registered: Mar 2008
Distribution: Ubuntu Lucid
Posts: 131
Original Poster
Rep:
|
wow. im amazed at the feedback, and solutions and potential problems have both been taken into account. for the solutions i thank all concerned, and the shortcommings have been taken into account, but if i run
gedit & nautilus
it shouldnt take up too much ram should it?
thanks all
james
|
|
|
02-11-2009, 12:20 PM
|
#10
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852
|
Actually, what happened was that your thread got hijacked into a conversation about personal preference, but at least it was about the thread topic, so I guess it helped.
Your command will take up as much ram as one terminal emulator, one bash session, one gedit session, and one nautilus session need. Additional ram will be needed for the textfile you open, but unless you're working with a mammoth file, that probably won't be much. None of them are particularly "heavy" apps, so there should be plenty of overhead to run them all, unless your system is extremely ancient or underpowered. But don't ask me, just try it and see. ![Smilie](https://www.linuxquestions.org/questions/images/smilies/smile.gif)
|
|
|
02-12-2009, 11:05 AM
|
#11
|
Member
Registered: Mar 2008
Distribution: Ubuntu Lucid
Posts: 131
Original Poster
Rep:
|
Quote:
Originally Posted by David the H.
Actually, what happened was that your thread got hijacked into a conversation about personal preference, but at least it was about the thread topic, so I guess it helped.
Your command will take up as much ram as one terminal emulator, one bash session, one gedit session, and one nautilus session need. Additional ram will be needed for the textfile you open, but unless you're working with a mammoth file, that probably won't be much. None of them are particularly "heavy" apps, so there should be plenty of overhead to run them all, unless your system is extremely ancient or underpowered. But don't ask me, just try it and see. ![Smilie](https://www.linuxquestions.org/questions/images/smilies/smile.gif)
|
i agree. gedit and nautilus dont use much RAM, and neither does a bash session and seeing as i have a gig of ram and a 2.8ghz pentium 4, i dont think it will be too much of a burden on the system as a whole. also, you've hit the nail on the head with the hijacking bit lol. ah well... thanks for all the responses everyone, even if it is not associated with my original question, it has given me a bit more knowlege. thankyou all
|
|
|
All times are GMT -5. The time now is 01:50 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|