Day to Day Recipe

January 5, 2025

download a file.

# Download file
curl "<url>" -OL


# Download file & rename
curl "url" -o "<new_name>" -L
flagdescription
-o file_namewrite output with name file_name
-Owrite output as the same name
-Lfollow redirect allowed

extract .tar.gz archive

tar -xzvf <your archive .tar.gz / .tgz>
tar -xzvf <your archive .tar.gz / .tgz> -C <output directory>
flagdescription
-xxtract
-zuse gzip compression
-vverbose
-fthe input file ...
-Cthe redirect

migrate files to another server / certbot migration

archive file and unarchive

https://community.letsencrypt.org/t/copy-etc-letsencrypt-or-regenerate-to-move/141684/3

# in old server
tar pzcvf /root/moving_le_old_server.tar.gz /etc/letsencrypt/{archive,live,renewal,renewal-hooks}

# in new server
tar pzxvf /root/moving_le_old_server.tar.gz -C /

send file

https://superuser.com/questions/98089/sending-file-via-netcat

nc -l -p 1234  > something.zip < /dev/null

# on sender server
cat something.zip | netcat server.ip.here 1234 -q 0