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:
Neither of the others worked for me. This does.
The difference between the original version provided and this one is that this one works rather than outputting a wget error
Find all books on my systems and move them into folder. The -0 switches are to handle spaces etc. in the filenames.
Why would you need this? Locate uses an index, so it's super quick, and xargs is more elegant than a for loop.
Google Cloud SDK comes with a package manager `gcloud components` but it needs a bit of `sed` to work. Modify the "^| Not" bit to change the package selection. (The gcloud --format option is currently broken)
Caution: distructive overwrite of filenames
Useful for concatenating pdfs in date order using pdftk
bash brace expansion, sequence expression
Use GNU Parallel: short, easy to read, and will run one job per core.
Convert some SVG files into PNG using ImageMagick's convert command.
Run the conversions in parallel to save time.
This is safer than robinro's forkbomb approach :-)
xargs runs four processes at a time -P4
Getting current wallpaper on nautilus file-managers
This lists the number of ogg/mp3/wav/flac files in each subdirectory of the current directory. The output can be sorted by piping it into "sort -n".
Sorts by latest modified files by looking to current directory and all subdirectories
This script can be used to download enclosed files from a RSS feed. For example, it can be used to download mp3 files from a podcasts RSS feed.
On Linux substitute pbpaste with `xsel --clipboard --output` or `xclip -selection clipboard -o` (untested)
first grep all href images then sed the url part then wget
The directories are created in the local host with the same structure below of a remote base directory, including the 'basedir' in case that it does not exists.
You must replace user and remotehost (or IP address) with your proper values
ssh will ask for the password of the user in remotehost, unless you had included properly your hostname in the remote .ssh/known_hosts file.
It starts in the current working directory.
It removes the empty directory and its ancestors (unless the ancestor contains other elements than the empty directory itself).
It will print a failure message for every directory that isn't empty.
This command handles correctly directory names containing single or double quotes, spaces or newlines.
If you do not want only to remove all the ancestors, just use:
find . -empty -type d -print0 | xargs -0 rmdir
Watches for file modifications in the current directory and tails the file.
xargs is a more elegant approach to executing a command on find results then -exec as -exec is meant as a filtering flag.
`pwd` returns the current path
`grep -o` prints each slash on new line
perl generates the paths sequence: './.', './../.', ...
`readlink` canonicalizes paths (it makes the things more transparent)
`xargs -tn1` applies chmod for each of them. Each command applied is getting printed to STDERR.