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:
say, someone has aliased ls to 'ls --color=always' and you want to temporarily override the alias (it does not override functions)
This only makes sense if you are using command line editing.
Create the function in your current zsh session, then type
eve PATH
go 'UP' in your history and notice the current (editable) definition of PATH shows up as the previous
command.
Same as doing:
PATH="'$PATH'"
but takes fewer characters and you don't have to remember the escaping.
short command to find a string in all text files in all subdirectories, excluding all files grep does not deem text files.
Say you want to execute 'file' on the command 'top' (to determine what type of file it is); but you don't know where 'top' resides: preface the argument with = and zsh will implicitly prepend the path.
say you want to edit your PATH variable using bash/zsh commandline editing, this will put something like this in history so you can edit it:
PATH=/bin:/usr/bin:/usr/sbin
to make this a shell function such that:
eev HOME
will put /home/dave in the last history event:
eev()
{
print -s "$1='$(eval echo \$$1)'"
}
say you've just found all the config files with this command
find . -name '*.config'
and you need to edit them all
vi `!!`
will re-execute the command and present them to vi in the argument list
don't use if the list is really long as it may overflow the command buffer