when bad day comes...
- recompresses all gz files to bz2 files from this point and below in the directory tree
- output shows the size of the original file, and the size of the new file. Useful.
- conceptually easier to understand than playing tricks with awk and sed.
- don't like output? Use the following line:
for gz in `find . -type f -name '*.gz' -print`; do f=`basename $gz .gz` && d=`dirname $gz` && gunzip -c $gz | bzip2 - -c > $d/$f.bz2 && rm -f $gz ; done
Show Sample Output
Written on OSX after `brew install unrar coreutils`; presumably works on other unices with minimal modifications. Didn't test rars that actually have paths in them, just "flat" files. Won't include files in the rar starting with a dot.
Just pulls a quote for each day and displays it in a notification bubble...
or you can change it a bit and just have it run in the terminal
wget -q -O "quote" https://www.goodreads.com/quotes_of_the_day;echo "Quote of the Day";cat quote | grep '“\|/author/show' | sed -e 's/<[a-zA-Z\/][^>]*>//g' | sed 's/“//g' | sed 's/”//g'; rm -f quote
Show Sample Output
Sometimes I get FLAC files that RhythmBox can't play but VLC can. So I re-encode them using GStreamer at highest compression.
Applies 'docker rm' to all container IDs that appear in 'docker ps -a' but not in 'docker ps' - i.e. the ones that are not running. Show Sample Output
this command can be added to crontab so as to execute a nightly backup of directories and store only the 10 last backup files.
Replace 2014-11-27 by the desired date. Remove -D for making it work.
https://www.magnatune.com depends on unp but does not need to but unp is the easiest way to unpack any archive. it's in Debian repo's. !note: it deletes flac zip when done, if successful. Show Sample Output
Find and delete files over 15 days Show Sample Output
Given a cbr file which is rar compressed, get a cbz file which is zip compressed.
Removes directories which are less than 1028KB total. This works for systems where blank directories are 4KB. If a directory contains 1 MB (1024KB) or less, it will remove the directory using a path relative to the directory where the command was initially executed (safer than some other options I found).
Adjust the 1028 value for your needs.
It would be helpful to test the results before proceeding with the removal. Simply run all but the last two commands to see a list of what will be removed:
du | awk '{if($1<1028)print;}' | cut -d $'\t' -f 2-
If you're unsure what size a blank folder is, test it like this:
mkdir test; du test; rmdir test
Single file archives nested in subdirectories. After extracting them, you'll have the file (e.g. file.ext) and the archive (e.g. file.ext.nco) side by side. Sometimes you'll only have the archive (if you didn't extract them, or if there was an error during extraction). Only delete the archive if the single file is present in the same directory. Show Sample Output
I just used this to lowercase many gigs of old data we had lying around from a bunch of legacy DOS and win95/98 drives. WARNING - The entire directory is removed as the second command to help save working space and save an additional step. BE CAREFUL. In the unzip portion the -LL switch forces all extracted files and dirs to lower case, and the -0 speeds things up significantly by using no compression when making the zip file (but uses more space). Worked perfect and quickly for me after trying many other not so successful commands.
If there are less than 10 folders, this script will not delete them
find '.odt' files that contain USAGE: grepodt
Music Library Convert Usage lc Old_Directory New_DIrectory Old_Format New_Format lc ~/Music ~/Music_ogg mp3 ogg This will convert all audio files in the old directory to the new directory from the old format to the new format. It will leave the original library alone. The converted library will retain folder structure.
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
This command will find the file project.txt and delete it.
commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.
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: