Posts

Showing posts with the label command line

Project Wild Penguin 22.4.2017: To delete directories inside current directory whose contents are less than a given size

With GNU find and GNU coreutils, and assuming your directories don't have newlines in their names: find . -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2- This will list directories with total contents smaller than 50K. If you're happy with the results and you want to delete them, add | xargs -d \\n rm -rf to the end of the command line. Command: find . -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2- | xargs -d \\n rm -rf Source:  https://unix.stackexchange.com/questions/214089/command-to-delete-directories-whose-contents-are-less-than-a-given-size

Project Wild Penguin 23.4.2017: To list the size of sub-directories inside a directory using terminal

Simple command to list the size of sub-directories inside a directory using terminal : du -sh * | sort -h will get you a human-readable ascending list of the sizes of files and subdirectories in your current directory, du -sh will summarize the current directory size. Source:  https://askubuntu.com/questions/426809/how-to-list-the-size-of-a-directoy-and-subdirectories-and-files-inside-it-by-ter

Project Dumbledore - How to download YouTube Playlist on your system

Image
As, I was going through some great lectures available on YouTube, I thought of saving them all in a playlist and then downloading them all for offline viewing on my system. After googling for few minutes, I found this great command line program youtube-dl  to achieve this. It ticks all the right boxes - simple, open source, platform independent and python based. To install this on Ubuntu based systems, run the following command on your terminal: sudo apt-get install youtube-dl To download YouTube playlist, run the following command: youtube-dl -ctik   https://www.youtube.com/playlist?list=XXXXXX It has many other great features, be sure to explore them all. Though, I have found a problem that it downloads video and audio files separately and then combines them together in a single file leaving two extra files after each download which needs to be removed after the download is complete. I haven't looked into it to find the issue. If I find the solution, I will ...