en:cs:bash:snippets
Table of Contents
Bash Snippets
Download files from Google Drive with Wget
I last used it in 2022. If Google hasn't changed it since then, it should work.
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
In the code above, fix the two FILEID
parts and enter the name you want to save in the FILENAME
part with the extension.
Horizontal line drawing across the entire screen
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
Learn the size of a file
#!/bin/bash FILENAME=/home/heiko/dummy/packages.txt FILESIZE=$(wc -c < "$FILENAME") # non standard way (GNU stat): FILESIZE=$(stat -c%s "$FILENAME") echo "Size of $FILENAME = $FILESIZE bytes."
Taken from UCH Wiki. ===== NOTLAR =====
en/cs/bash/snippets.txt · Last modified: 2025/04/26 12:13 by ulascemh