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

Reboot machine when everything is hanging

Terminal - Reboot machine when everything is hanging
<alt> + <print screen/sys rq> + <R> - <S> - <E> - <I> - <U> - <B>
2009-02-20 07:28:56
User: dizzgo
99
Reboot machine when everything is hanging

If the machine is hanging and the only help would be the power button, this key-combination will help to reboot your machine (more or less) gracefully.

R - gives back control of the keyboard

S - issues a sync

E - sends all processes but init the term singal

I - sends all processes but init the kill signal

U - mounts all filesystem ro to prevent a fsck at reboot

B - reboots the system

Save your file before trying this out, this will reboot your machine without warning!

http://en.wikipedia.org/wiki/Magic_SysRq_key

Alternatives

There are 3 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

doesn't work on fedora ;=s

Comment by renich 295 weeks and 6 days ago

This works! (but here's hoping you don't have to use it. :-)

Comment by mpb 295 weeks and 6 days ago

I think it depends on they keyboard: I haven't had much luck with USB ones.

Although debatable, it should also be REISUB. A program could write data when sent the term signal (as that's a clean shutdown command), and not be synced (which is done first), causing the data to lounge around in cache and then vanish.

Also, it's worth noting that you should wait a second or two between the U and B, just to make sure that everything has in fact been written to disk.

Comment by clockworkavian 295 weeks and 3 days ago

mnemonic for REISUB key combination is ; it is reverse of BUSIER

Comment by alperyilmaz 291 weeks and 4 days ago

Well.......

This trick will work if and only if you have set some kernel parameter.

Interested guys can find out the parameters and post it here.

Long days before, I was playing with this and not do not remember the parameters but they are most probably in the "kernel hacking" section ( 2.6.21 )

Good Luck....

Comment by Satish 267 weeks and 4 days ago

Your kernel needs CONFIG_MAGIC_SYSRQ=y

Comment by hfs 263 weeks and 4 days ago

I pressed

<alt> + <print screen> + <r>

and my computer went into an infinite loop of opening the print screen dialog. WTF?

Comment by csmeder 251 weeks and 5 days ago

it worked for me after i launched otherwise when doing prntscrn i get screenshot window. it not useful when freezing since unless you are in the tty. ubuntu 10.4

Comment by firstohit 224 weeks and 4 days ago

Lovely! I keep a printed version of the Wikipedia article in my desks drawer.

Comment by jjj0978yug 198 weeks and 4 days ago

Here is how you do it on Fedora

http://fedoraproject.org/wiki/QA/Sysrq

Comment by tevans 52 weeks and 2 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts