ssh -f user@remote.ip DISPLAY=:0.0 smplayer movie.avi

Start an X app remotely

Launch a gui app remotely. In this example smplayer is installed on the remote machine, and movie.avi is in the remote user's home dir. Note that stdout/stderr is still local, so you'll have feedback locally, add '&>/dev/null' to suppress. This is surprisingly not well known (compared to running an X app locally via ssh -X). (NB. if your distro requires ~/.Xauthority file present, then try -fX if you have problems) Resubmitted (and trimmed, thanks sitaram) due to ridiculous voting on previous submission. Fingers crossed, it gets a better rating this time.

7
By: Escher
2009-09-12 22:16:59
ssh

These Might Interest You

What Others Think

++ :-)
sitaram · 453 weeks and 4 days ago
Good point about the Xauthority thing -- I used to have to set it along with the DISPLAY earlier but now it seems to just work; didn't investigate why... For those who are thinking "why would I want to do that", here're a couple of examples: - when my kids were younger, it was fun to send them popup messages. Maybe a joke or a riddle. They have no clue how it popped up. I once got my nephew to start on his homework by saying "[his name], this is [teacher's name]; please start on your homework right NOW". Hilarious! And effective too. - my dad lives a 12-hour train journey away, so on the rare occasion he calls and says "this isn't working" or "how do I...", it's useful to log in, grab a screenshot of his screen using xwd and bring that file across, then take a look at it and tell him what he's doing wrong. This is easy enough/fast enough for occasional use, though I agree a true remote desktop/vnc type thing would be better for more sustained use
sitaram · 453 weeks and 4 days ago
I think the modern distros use a database for Xauthority (eg gdm login uses /var/run/gdm/auth-for-user-abc123/database, so even if you rm ~./Xauthority your xapps still work. But I can't work out the consistent behaviour across distros.
Escher · 453 weeks and 3 days ago
What is the reason for not just using ssh -X (or ssh -Y) ?
peshay · 453 weeks and 2 days ago
ssh -X enables Xforwarding to the local display (by setting DISPLAY=localhost:10.0) not the remote display. It also creates the ~./Xauthority cookie, whichIi originally thought was needed, but doesn't seem necessary in modern distros.
Escher · 453 weeks and 1 day ago
I just use mplayer -display :0 movie.avi to display on the remote machine
cizu · 434 weeks and 1 day ago
Soooo many times I have been laying in bed wanting play another video and not have to get up. Now I can just use my little netbook using this command (and cizu's as well). Thanks!
whit2333 · 282 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: