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:
Dependencies on phone: adb access, screencap command, base64 command.
Dependencies on computer: adb, sed, base64, display (from imagemagick, but can substitute other image viewer which reads from stdin).
This should work around adb stupidies (i.e. that it replaces \n with \r\n) with base64.
Nginx (and other webservers like Apache) can be awkward to trace. They run as root, then switch to another user once they're ready to serve web pages. They also have a "master" process and multiple worker processes.
The given command finds the process IDs of all Nginx processes, joins them together with a comma, then traces all of them at once with "sudo strace." System trace output can be overwhelming, so we only capture "networking" output.
TIP: to kill this complex strace, do "sudo killall strace".
Compare with a similar command: http://www.commandlinefu.com/commands/view/11918/easily-strace-all-your-apache-processes
use get_iplay to download all listed content from http://www.bbc.co.uk/radio4extra run every night to make sure no episodes are missed
Print a git log (in reverse order) giving a reference relative to HEAD.
HEAD (the current revision) can also be referred to as HEAD~0
The previous revision is HEAD~1 then HEAD~2 etc.
Add line numbers to the git output, starting at zero:
... | nl -v0 | ...
Insert the string 'HEAD~' before the number using sed:
... | sed 's/^ \+/&HEAD~/'
Thanks to bartonski for the idea :-)
This command validates if exist any character different in 0-255 and dot.
If any characters different is typed the error menssage is showing.
Use -q as first argument (as described in `man curl`) to ignore curlrc to ensure the output is always the same regardless of user's configuration.
This says if the LHC has destroyed the world. Run it in a loop to monitor the state of Earth. Might not work reliable, if the world has actually been destroyed.
Add -n to last command to restrict to last num logins, otherwise it will pull all available history.
The difference between the original version provided and this one is that this one works rather than outputting a wget error
Take the header line from a comma-delimited CSV file and enumerate the fields.
First sed replaces all commas with newlines
Then sed quits (q) after the first line.
Finally, nl numbers all the lines
Replace all instances of "A" with "B" in file "source" saved as file "destination".
!! IF A/B is multi-byte, then separate bytes with spaces like so: "s/20\ 0A/00/g".
Find and replace specific characters in a single line in multiple files with sed.
I used this fragment with Imagemagick convert so that I can place long text strings in pictures. The "\n" gets converted to a true newline in the image.
So this fragment uses fold command to wrap the line and then sed to convert newlines (and any trailing spaces on the line) to the text "\n"
After you run this script, you can check status for broken symlink with this command:
find -L . -type l