Linux Cheat sheet

Find directory with most inode usage

find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n

or another method

du --inodes -xS |  sort -k 1 -n

Download Large from Google Drive using command line in Linux

Save the below script in a file named gdrivedownloader.sh

#!/bin/bash
if [ $# != 2 ]; then
echo "Usage: gdrivedownloader.sh ID file_name.ext"
exit 0
fi
confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id='$1 -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
echo $confirm
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$confirm&id=$1" -O $2 && rm -rf /tmp/cookies.txt

We will need the file’s ID to download it, e.g if the shared link is https://drive.google.com/file/d/13fgfzfX7sujkwlUu3HCjJNZY0NztwbOK/view?usp=sharing then the ID is 13fgfzfX7sujkwlUu3HCjJNZY0NztwbOK, to download the file simply run the command

./gdrivedownloader.sh 13fgfzfX7sujkwlUu3HCjJNZY0NztwbOK filename.zip

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a comment

Your email address will not be published. Required fields are marked *