Snippets/ Terminal/ Shell

Sun, 9 Feb. 2020     Thomas Bendler     ~ 1 min to read
 

In this chapter, I will share with you some snippets/ one-liners I used with several command-line tools more or less frequently during my administrator career. Maybe you find some of them useful and I hope, in the end, they will ease your work.

Network

What is my public IPv4 address:

> curl -4 ifconfig.co

What is my public IPv6 address:

> curl -6 ifconfig.co

In which country is my public IP address registered:

> curl ifconfig.co/country

In which city is my public IP address registered:

> curl ifconfig.co/city

File Management

Recursively move all files except partially downloaded files to a different storage location:

> find . -type f -print0 | \
    while read -d $'\0' file; do if [[ ! ("$file" =~ "\.part$") ]]; then \
    mv "$file" /media/storage/videos; fi; done

 

Share on: