Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Start an X app remotely

Terminal - Start an X app remotely
ssh -f user@remote.ip DISPLAY=:0.0 smplayer movie.avi
2009-09-12 22:16:59
User: Escher
Functions: ssh
7
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.

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

++ :-)

Comment by sitaram 263 weeks and 2 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

Comment by sitaram 263 weeks and 2 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.

Comment by Escher 263 weeks and 2 days ago

What is the reason for not just using ssh -X (or ssh -Y) ?

Comment by peshay 263 weeks and 1 day 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.

Comment by Escher 263 weeks ago

I just use mplayer -display :0 movie.avi to display on the remote machine

Comment by cizu 244 weeks 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!

Comment by whit2333 92 weeks and 1 day ago

Your point of view

You must be signed in to comment.

Related sites and podcasts