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.
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:
You can tell GCC to automatically select optimization commands and produce optimized code for the local machine (the one compiling the code), but you can't normally see what switches have been selected and used unless you append a "-v" and pause compilation.
Character: "?" is the Byte Order Mark (BOM) of the Unicode Standard.
Specifically it is the hex bytes EF BB BF, which form the UTF-8 representation of the BOM,
misinterpreted as ISO 8859/1 text instead of UTF-8.
Do this with caution.
Can be used to help perform some SEO optimizations.
get files without extensions, get ASCII and utf-8 as "text/plain"
Check which files are opened by Firefox then sort by largest size (in MB). You can see all files opened by just replacing grep to "/". Useful if you'd like to debug and check which extensions or files are taking too much memory resources in Firefox.
Best to put it in a file somewhere in your path. (I call the file spath)
IFS=:; find $PATH | grep $1
Usage: $ spath php
-exec works better and faster then using a pipe
As an alternative to using an additional grep -v grep you can use a simple regular expression in the search pattern (first letter is something out of the single letter list ;-)) to drop the grep command itself.
doesn't do case-insensitive filenames like iname but otherwise likely to be faster
This does the following:
1 - Search recursively for files whose names match REGEX_A
2 - From this list exclude files whose names match REGEX_B
3 - Open this as a group in textmate (in the sidebar)
And now you can use Command+Shift+F to use textmate own find and replace on this particular group of files.
For advanced regex in the first expression you can use -regextype posix-egrep like this:
mate - `find * -type f -regextype posix-egrep -regex 'REGEX_A' | grep -v -E 'REGEX_B'`
Warning: this is not ment to open files or folders with space os special characters in the filename. If anyone knows a solution to that, tell me so I can fix the line.
Returns nothing if the domain exists and 'No match for domain.com' otherwise.
Renames all the jpg files as their timestamps with ".jpg" extension.
Remove newlines from output.
One character shorter than awk /./ filename and doesn't use a superfluous cat.
To be fair though, I'm pretty sure fraktil was thinking being able to nuke newlines from any command is much more useful than just from one file.
Pipe any output to "grep ." and blank lines will not be printed.
Gets the internal and external IP addresses of all your interfaces, or the ones given as arguments
Will return your internal IP address.
The same as the other user, but smarter, using -d and -f