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 by miccaman from sorted by
Terminal - Commands by miccaman - 20 results
find . -type f -name "*\?*" | while read f;do mv "$f" "${f//[^0-9A-Za-z.\/\(\)\ ]/_}";done
2014-11-28 14:55:27
User: miccaman
Functions: find mv read
Tags: bash find mv
1

replace all "?" characters in filename to underscore

find . -type d -name "*\?*" | while read f;do mv "$f" "${f//[^0-9A-Za-z.\/\(\)\ ]/_}";done
2014-11-28 14:52:46
User: miccaman
Functions: find mv read
Tags: bash find mv
0

rename all dirs with "?" char in name, leave spaces and () in place

cd "~/Music/iTunes/iTunes Media/Mobile Applications";ls > filepath
:%s!^!foo!
perl -e "tr/[A-Z]/[a-z]/;" -pi.save $(find . -type f)
rm -rf `find . -type f -name *.htm`
%s/?/\ï/ge | %s/?/\é/ge | %s/?/"/ge | %s/?/"/ge | %s/?/'/ge | %s/?/'/ge | %s/?/\ê/ge | %s/?/\…/ge | %s/?/\è/ge | %s/?/\ó/ge | %s/?/\ö/ge | %s/?/\é/ge | %s/?/\–/ge | %s/?/\—/ge
2010-07-15 07:40:45
User: miccaman
Tags: vim
-1

a brief list of very common special characters in Dutch. Usefull for formatting Word source to html.

for y in 2009 2010 2011; do cal $y; done
sudo ipfw pipe 1 config bw 50KByte/s;sudo ipfw add 1 pipe 1 src-port 80
2009-07-02 23:17:49
User: miccaman
Functions: sudo
Tags: Os X pipe
1

sudo ipfw pipe 1 config bw 50KByte/s

Set the bandwidth (bw) limit to any number you want. For example you could have a 15kb pipe for X application and then a 100kb pipe for another application and attach things to those pipes. If a port isn’t attached to a pipe, it runs at full speed. Change the number (in this case 1) to a different number for a different pipe.

The next step is to attach your port.

sudo ipfw add 1 pipe 1 src-port 80

In this case anything on port 80 (http) will be set to a limit of 50Kbyte/s. If you want to attach a second port to this pipe, repeat the command but change the port number at the end.

src : http://www.mactricksandtips.com/2008/12/throttling-bandwidth-on-a-mac.html

echo "-------------" >> nicinfo.txt; echo "computer name x" >> nicinfo.txt; ifconfig | grep status >> nicinfo.txt; ifconfig | grep inet >> nicinfo.txt; ifconfig | grep ether >> nicinfo.txt; hostinfo | grep type >> nicinfo.txt;
sudo /Applications/Utilities/Adobe\ Utilities.localized/Adobe\ Updater5/Adobe\ Updater.app/Contents/MacOS/Adobe\ Updater
2009-06-25 08:07:47
User: miccaman
Functions: sudo
Tags: Os X
-9

adobe updater keeps popping up. (normal update fails, probably due to insufficient rights)

(src: http://aricsblog.blogspot.com/2007/12/adobe-updater-crashes-on-mac-os-x-and.html)

ga
:!start c:\progra~1\Opera\opera.exe http://www.commandlinefu.com
:r! echo %
2009-06-19 12:17:28
User: miccaman
Functions: echo
Tags: vim
1

insert filename

Normal mode: "%p

Insert mode: %

:source ~/.vimrc
:set nomore :argdo %s/foo/bar/g | update
find directory -size +nnn
ls -s | sort -nr | more
more /var/adm/messages
2009-05-29 12:10:18
User: miccaman
Functions: more
Tags: solaris
-10

read system logs of sun solaris 9

init 6
2009-05-29 07:44:05
User: miccaman
Functions: init
Tags: solaris Reboot
-11

init states on solaris are numbered

init 0 boot with prompt

init 5 shutdown

init 6 reboot