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

Commands tagged block from sorted by
Terminal - Commands tagged block - 4 results
blacklist usb_storage >> /etc/modprobe.d/blacklist.conf
2013-02-01 09:38:43
User: totti
Tags: block usb
3

Some times you may ban usb to protect thefting of your personal data.

Blacklist the usb_storage module by adding blacklist usb_storage to /etc/modprobe.d/blacklist.conf.

To load the module manually,

sudo modprobe usb_storage.
VBoxManage internalcommands createrawvmdk -filename [path/to/file/name.vmdk] -rawdisk /dev/[block_device]
2011-08-19 14:26:22
User: totti
0

eg:

VBoxManage internalcommands createrawvmdk -filename ~/.VBox_sdc.vmdk -rawdisk /dev/sdc

In order to start virtual box using block devices, ( Or to boot from it) run as ROOT

sudo VirtualBox

Then add & select the vmdk file as a device.

At last Start the virtual box.

- This cmd needs to run once for a device.

- See command 8936 to run with out using ROOT power and easy handling of Virtual m/c

vim -e -s -c 'g/start_pattern/+1,/stop_pattern/-1 p' -cq file.txt
2009-08-26 10:22:27
User: syladmin
Functions: vim
Tags: vim block
0

By using vim, you can also filter content on stdout, using vim's extra power, like search pattern offset!

No more awk of course, sorry.

details :

-e ex mode

-s silent

-c 'ex command' : global + start and end pattern + offset print (p)

-cq : quit

/sbin/dumpe2fs /dev/hda2 | grep 'Block size'
2009-05-15 22:23:21
User: rez0r
Functions: grep
Tags: size output block
0

Useful to know, especially if you are dealing with output configurations in block size.

Tested on 'Red Hat'.