commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
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.
To ignore aspect ratio, run:
for file in *; do convert $file -resize 800x600! resized-$file; done
and all images will be exactly 800x600.
Use your shell of choice.. This was done in BASH.
here's a version which works on OS X.