Uncategories

Finding external IP using external services

curl icanhazip.com or curl ipecho.net or $ dig +short myip.opendns.com @resolver1.opendns.com How do I store my IP address in a shell variable? The syntax is: myip="$(dig +short myip.opendns.com @resolver1.opendns.com)" echo "My WAN/Public IP address: ${myip}" Sample outputs: My WAN/Public IP address: 74.86.144.194 Refer: https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux/

Advertisements
Uncategories

Linux – How to Compress and Extract Files Using the tar Command

To compress: tar -czvf name-of-archive.tar.gz /path/to/directory-or-file c: Create an archive. z: Compress the archive with gzip. v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful. f: Allows you to specify the filename of the archive. To compress directory:… Continue reading Linux – How to Compress and Extract Files Using the tar Command