LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-13-2009, 07:11 PM   #1
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Rep: Reputation: 15
Opening VLC with the terminal line so the terminal will go back to normal


I've been pottering around the command line for some time, so I have some knowledge of it but I'm still a newbie.

The 'problem' is that I want to experiment with opening a movie in VLC using the command line. I typed in vlc and there it was, so I selected my movie like this:
Code:
vlc movies/legally \obtained \movie/movie.avi
and that works just fine; VLC pops up and starts playing movie.avi, and I also found out that you could start VLC without an interface if you type in cvlc so that's cool. But the problem is that when it starts playing the terminal doesn't go back the normal command prompt baldur@baldur-main:~$ (yes I don't care that you know my computer's name) but instead the VLC keeps on running in the terminal while the movie plays.

I've seem this with many other programs and this guy says that it's possible to make the prompt return by annexing it with &. But when I do that nothing changes!

I was once programming in MatLab on my Linux computer, and it had to be opened through with the terminal and if I closed the terminal MatLab would close as well! I can't believe that you have to have two open terminals if you want to use MatLab and VLC (from the command line) at the same time!

Last edited by baldurpet; 01-13-2009 at 07:45 PM.
 
Old 01-13-2009, 07:51 PM   #2
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Rep: Reputation: 35
So you used the command $vlc movies/legally \obtained \movie/movie.avi & ? Try hitting enter in the terminal after VLC starts, if the first line of output after you run that is something like "[1] 29803" then the process has been backgrounded and hitting enter should produce a fresh prompt. Any output VLC produces will go into that terminal though, possibly obscuring the prompt again.

Most desktop's have a Run dialog you can popup, it's usually Alt+F2 but could be something else. That way you don't need a terminal open at all, but tab completion may or may not function.

Another option would be to use screen, if you close your GUI terminal window, screen will detach your CLI session, itself running in the background, and any gui apps you've started from the CLI will keep runing. In the completely unscientific test I just ran, you can background a process from inside screen, exit the terminal(inside screen) which you started the process from (not just detach the screen), and the process will keep running. Doing the same from a regular terminal without screen kills the backgrounded process. I don't understand what the difference is though so hopefully someone can enlighten us.
 
Old 01-13-2009, 08:48 PM   #3
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by lurko View Post
So you used the command $vlc movies/legally \obtained \movie/movie.avi & ? Try hitting enter in the terminal after VLC starts, if the first line of output after you run that is something like "[1] 29803" then the process has been backgrounded and hitting enter should produce a fresh prompt.
God damn.. pushing enter twice did the trick. So & does make programs run in the background.

How ever I didn't get any process ID. Ok, it's late and I'm a little daft. I looked for a PID when I was terminating the program. Yeah, I did get the PID [1] 7742.

Quote:
Originally Posted by lurko View Post
Most desktop's have a Run dialog you can popup, it's usually Alt+F2 but could be something else. That way you don't need a terminal open at all, but tab completion may or may not function.
Ah yes, I know about Alt+F2, but I just wanted to learn how to do it this way it's never bad to have a few ways of doing the same thing (also, now I better understand the & thing, that is going to be very helpful).

I couldn't really understand that last part you said it's not nice to talk about such complicated things to a noob

Last edited by baldurpet; 01-13-2009 at 08:50 PM.
 
Old 01-14-2009, 09:57 AM   #4
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Rep: Reputation: 35
You're correct, it is always nice to have options.

screen is like a window manager, but for terminals.
Quote:
Originally Posted by http://en.wikipedia.org/wiki/GNU_Screen
GNU Screen can be thought of as a text version of graphical window managers, or as a way of putting virtual terminals into any login session. It is a wrapper that allows multiple text programs to run at the same time, and provides features that allow the user to use the programs within a single interface productively.

Persistence
Similar to VNC, GNU Screen allows the user to start applications from one computer, and then reconnect from a different computer and continue using the same application without having to restart it. This makes migration between locations like work and home simple. Screen provides terminal-agnostic functionality so that users can disconnect and reconnect using different terminal types, allowing applications to continue running without being aware of the change in terminals.
Multiple windows
Multiple terminal sessions can be created, each of which usually runs a single application. The windows are numbered, and the user can use the keyboard to switch between them. Some GUI terminal emulators provide tabs or otherwise similar functionality to this. Each window has its own scroll-back buffer, so that output is captured even when the window isn't actively displayed, and that history can be saved even when migrating to another computer. Windows can be split-screened. While some text applications have this functionality built in, Screen allows any application to be horizontally split-screened alongside any number of other applications.
Session Sharing
Screen allows multiple computers to connect to the same session at once, allowing collaboration between multiple users. The same computer can also be used to make multiple simultaneous connections, providing alternative functionality to screen-splitting, particularly for computers with multiple monitors.
So basically, screen provides a way to background (detach in screen parlance) the entire terminal, and the program(s) running in it, and to reattch it later. And your screen session can include any number(? probably there's some limit, but I'm not aware of it) of terminal interfaces. It rocks. Say you've got some time-consuming process running in a terminal. If you run it inside screen, and say, your Xserver/desktop crashes majorly and dumps you onto the console, your time consuming process will still be running inside a detached screen session. You can reattach it right there on the console, or you can restart X and run an Xterm or something and reattach screen from there.

some Screen howtos:
http://jmcpherson.org/screen.html
http://khaoohs.wordpress.com/2006/08...nd-quickstart/
http://www.linuxdynasty.org/screen-howto-part-1.html
http://www.linuxdynasty.org/screen-howto-part-2.html

edit: what I confused you with before, I was saying that if you use an ampersand to background a process, from inside screen, even after you exit screen (this would be just like quiting your Xterm) the backgrounded process keeps running, unlike exiting a non-screen'd terminal you've backgrounded a process from (which causes the backgrounded process to also quit for some reason I cannot fathom). here's hoping this didn't just exacerbate the confusion. The howtos should help make screen's function clearer, then if you like you can try backgrounding a program from inside screen and then exiting screen to see the result.

Last edited by lurko; 01-14-2009 at 10:10 AM.
 
  


Reply

Tags
matlab, terminal, vlc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I resize the terminal window from the command line in the gnome terminal QuIcKSpArK Linux - Newbie 5 04-21-2012 02:04 PM
Switching back to the Mandrake 9.1 desktop from terminal rdesktop terminal session marc218 Linux - General 6 02-08-2007 02:45 PM
opening another terminal JRink Linux - Newbie 3 01-19-2007 03:52 PM
gnome-terminal not opening right GL1800 Fedora 2 01-08-2006 02:02 PM
Opening a new terminal from Fluxbox menu (or another terminal) hallamigo Linux - Software 1 05-02-2004 03:32 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration