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:
Shows which applications are making connections, and the addresses they're connecting to. Refreshes every 2 seconds (watch's default). Test on OSX, should work anywhere watch and lsof work.
is preserving creation time, modification time, permission, the directory structure, etc.
Go to "https://twitter.com/search/realtime?q=%23TeamFollowBack&src=hash" and then copy al the text on the page. If you scroll down the page will be bigger. Then put al the text in a text file called twit.txt
If you follow the user there is a high probability the users give you follow back.
To follow all the users you can use an iMacros script.
Uses find, plutil and xpath.
Note: Some applications don't have proper information. system_profiler might be better to use.
It's a bit slow query.
Due to command length limit, I removed -name "*.app" and CFBundleName.
Replace "Master" with desired control name (e.g. Front, Earphone, PCM, etc.).
This command produces no output, but its exit status is 0 ("true") if $file is text, non-0 ("false") if $file is binary (or is not accessible).
Explanation:
-q suppresses all the output of grep
-I is the trick: if a binary file is found, it is considered a non-match
-m 1: limit "output" to first match (speed up for big files)
.: the match string, "." stands for any character
Usage: e.g. run editor only on text files
grep -qIm 1 . $file && vi $file
xargs is a more elegant approach to executing a command on find results then -exec as -exec is meant as a filtering flag.
calculate how many different lines between two files
outputs a history of logins on the server (top 10, when piped to 'head'); optional flags: '-a' put the hostname at the end of the line (good for long hostnames), '-i' post the IP instead of the hostname, '-F' put the full login and logout times, rather than short times.
Throttle download speed
aria2c --max-download-limit=100K file.metalink
Throttle upload speed
aria2c --max-upload-limit=100K file.torrent
Axel
--max-speed=x, -s x
You can specify a speed (bytes per second) here and Axel will
try to keep the average speed around this speed. Useful if you
don?t want the program to suck up all of your bandwidth.
This line unbuffers the interactive output of rsync's --progress flag
creating a new line for every update.
This output can now be used within a script to make actions (or possibly piped into a GUI generator for a progress bar)
Sometime you need to monitor file or direcory change in dimension or other attributes. This command output file (called myfile in the example) attributes in the top of the screen, updating each 1 second.
You should change update time, command ( e.g., ls -all ) or target ( myfile, mydir, etc...).
Creates a PDF from multiple images. One page per image.
If you want a specific arbitrary order you can use {1,3,5,10,12}
* you may use jpg, tif etc
** if you do use jpg images you might want to add "-compress Zip" as suggested below to prevent from having the images from being re-compressed.