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 rpavlick from sorted by
Terminal - Commands by rpavlick - 15 results
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
sudo iptables -L -nv
lsof -n | grep /media/cdrom
find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;
sed 's/^[ \t]*//' input.txt
chmod --reference file1 file2
2010-03-31 12:05:48
User: rpavlick
Functions: chmod
Tags: chmod chown chgrp
39

Also works with:

chgrp --reference file1 file2 chown --reference file1 file2
sudo date -s "$(ssh user@server.com "date -u")"
2010-03-31 11:59:27
User: rpavlick
Functions: date sudo
Tags: sudo
5

(Useful when firewalls prevent you from using NTP.)

echo 'ServerAliveInterval 60' >> /etc/ssh/ssh_config
2010-03-31 09:22:54
User: rpavlick
Functions: echo
Tags: ssh timeout
6

ssh_config is the system-wide configuration file for ssh.

For per-user configuration, which allows for different settings for each host:

echo 'ServerAliveInterval 60' >> ~/.ssh/ssh_config

On OSX:

echo 'ServerAliveInterval 60' >> ~/.ssh/config

or

echo 'ServerAliveInterval 60' >> ~/etc/ssh_config
defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture "/System/Library/CoreServices/Finder.app/Contents/Resources/vortex.png"
2010-03-30 22:52:19
User: rpavlick
Functions: write
Tags: terminal osx
0

Change the file location in the second half of the string to the exact file location of your chosen picture.

defaults write com.apple.dashboard devmode YES
2010-03-30 22:50:27
User: rpavlick
Functions: write
Tags: osx dashboard
0

Enables widgets to be placed onto the desktop. Click and hold the widget and press F12 to drag it onto the desktop. Repeat the process again to drag a widget back onto the dashboard. You may need to log off or restart for it to take effect.

dd bs=1k if=image.nrg of=image.iso skip=300
2010-03-30 22:07:58
User: rpavlick
Functions: dd
Tags: dd iso nero
14

This line removes the 300k header from a Nero image file converting it to ISO format

hdiutil convert /path/imagefile.iso -format UDRW -o /path/convertedimage.dmg
hdiutil convert /path/imagefile.dmg -format UDTO -o /path/convertedimage.iso
sudo ifconfig en1 ether 00:e2:e3:e4:e5:e6
2010-03-30 21:48:55
User: rpavlick
Functions: ifconfig sudo
0

If you want to check that the spoof worked, type the same command as earlier:

ifconfig en1 | grep ether

Now you will see:

ether 00:e2:e3:e4:e5:e6

For the wired ethernet port:

sudo ifconfig en0 ether 00:e2:e3:e4:e5:e6