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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
I'm the author of PM2 and wrote this tool, and I'm please to share it here.
Github project link: https://github.com/Unitech/pm2
Handy use of bc in the command line. No need to get 'into' the bc to perform calculations
List packages and their disk usage in decreasing order. This uses the "Installed-Size" from the package metadata. It may differ from the actual used space, because e.g. data files (think of databases) or log files may take additional space.
Just an other solution :)
My first command :) I made this command to log public addresses of a virtual interface who connects random VPN servers around the world.
for f in input/*; do BN=$(basename "$f"); ffmpeg -i "$f" -vn "temp/$BN.flac"; sox "temp/$BN.flac" "temp/$BN-cleaned.flac" noisered profile 0.3; ffmpeg -i "$f" -vcodec copy -an "temp/$BN-na.mp4"; ffmpeg -i "temp/$BN-na.mp4" -i "temp/$BN-cleaned.flac" "output/$BN"; done
This was over the 255 character limit and I didn't feel like deliberately obfuscating it.
1. Create 'input', 'output' and 'temp' directories.
2. Place the files that you want to remove the hiss/static/general noise from in the input directory.
3. Generate a noise reduction profile with sox using 'sox an_input_file.mp4 -n trim x y noiseprof profile', where x and y indicates a range in seconds that only the sound you want to eliminate is present in.
4. Run the command.
calls grep on all non-binary files returned by find on its current working directory
This example code is intended to be used as a root permissions check in a script. It makes use of the $EUID (effective user ID) environment variable which is fully su- and sudo-safe.
set CDIR for it to work right..
Tar - Compress by excluding folders
get-ipsw device-name generation-string firmware-version
get-ipsw iPod 2,1 4.0
Different generation strings:
iPhone 3G: iPhone 1,2
iPhone 3GS: iPhone 2,1
iPod touch 2G: iPod 2,1
iPod touch 3G: iPod 3,1
This can be used with idevicerestore (I haven't tried it though).
Some shell newbies don't know this very handy file management related command so I decided to include it here.
You need to have the "file" package installed.
Saves opening another console terminal (eg. CTRL+ALT+F[n]) or opening another remote terminal.
Ctrl+Z pauses the current task and pushed it to the background, leaving you with a command prompt for those "Oh crap I forgot to change xyz before I ran that and it'll take forever if I Ctrl+C and start again..." situations. Typing 'fg' (shorthand for foreground, that's how I remember it) will resume the paused task.