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/
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.
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
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:
I can't put the last ^2 with seq, so I reverse it to delete the last +N. So for doing sum(N^2) you have to do sum((N+1)^2). Must be a better way.
Locate config files of the program. May not be used for interactive programs like vim.
i use this after ripping internet radio streams to number the files as they originally played (even though streamripper can do this with -q).
to number other types of files, or all files, just change the *mp3. to rename directories only you could use
... ls -lt | grep ^d | cut -d ":" -f2 | cut -d " " -f2- | while read ...
Identical output but a different way without having to shoot with the Awk cannon :)
host -i `echo $SSH_CLIENT | cut -f 1 -d \ ` | sed 's/.* domain name pointer \(.*\)\./\1/'
to reverse lookup and get the hostname.
list top committers (and number of their commits) of svn repository.
in this example it counts revisions of current directory.
Gets all videos in your boxee queue with a URL associated with them and attempts to download each using get_flash_videos
I often use it at my work, on an ovh server with root ssh access and often have to change mod after having finished an operation.
This command, replace the user, group and mod by the one required by apache to work.
I had the problem that the Md5 Sum of a file changed after copying it to my external disk.
This unhandy command helped me to fix the problem.
This backup function preserve the file suffix allowing zsh suffix aliases and desktop default actions to work with the backup file too.
Clears the "arp" table, without entering manually addresses (tested in Ubuntu).
This is a safest variation for "sitepass function" that includes a SALT over a long loop for sha512sum hash
usage:
where COMMIT
for instance:
where 1178c5950d321a8c5cd8294cd67535157e296554
where HEAD~5
can be used within a script to configure iptables for example:
iface=$2
inet_ip=`ifconfig "$iface" | grep inet | cut -d: -f2 | cut -d ' ' -f1`
ipt="sudo /sbin/iptables"
.........................
----------------------------------------------------------------------------------------------------------------
$ipt -A INPUT -i $iface ! -f -p tcp -s $UL -d $inet_ip --sport 1023: --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
$ipt -A OUTPUT -o $iface -p tcp -s $inet_ip -d $UL --sport 3306 --dport 1023: -m state --state ESTABLISHED,RELATED -j ACCEPT
-----------------------------------------------------------------------------------------------------------------