_ _ ___ | |__ __ _ _______ | |_ / _ \| '_ \ / _` |_ / _ \| __| | (_) | | | | (_| |/ / (_) | |_ \___/|_| |_|\__,_/___\___/ \__|
| ohazot | docs | links | dev | conf | txt |
| es | en |
| mdoc file |
| search |
command_line —
tools and tips.
NETWORK
Local ip
# ifconfig -a # ip add
Public IP
| https://icanhazip.com/ |
| https://ipecho.io/plain |
| https://ifconfig.co/ip |
| https://ifconfig.me/ip |
$ curl https://icanhazip.com/ $ curl https://ipecho.io/plain; echo $ wget -qO - ifconfig.co/ip $ lynx -dump ifconfig.me/ip; echo
CURL
Options
| -s | | silent. |
| -4 | | use ipv4. |
| -6 | | use ipv6. |
| -L | | if URL has been moved, request the new location. |
| -o | | output file. |
| --proxy | | set proxy --proxy PROTOCOL://IP[:PORT] |
| --socks5 | | set socks5 proxy --socks5 IP[:PORT] |
COMPARISON
$ diff * $ sdiff -s * $ cmp -b *
Example
$ cat t1 hello bye line3 $ cat t2 hello bye linel $ diff * 3c3 < line3 --- > linel $ sdiff -s * line3 | linel $ cmp -b * t1 t2 differ: byte 15, line 3 is 63 3 154 l
SPACE
df -h [PATH]du
| -h | | human readable size output. |
| -a | | display all files and directories. |
| -d [N] | | max recursion depth. |
| -s | | summarize, display only the total. |
$ du -had1 [PATH]$ du -hs [PATH]SORT
| -u | | unique, suppress duplicate lines. |
| -h | | human numeric sort. |
| -r | | reverse order. |
| -R | | random sort. |
| -k [N] | | sort by field N. |
| -t [C] | | use C as field separator, the default separator is space. |
Examples
$ cat test a 1,12 b 3,100 d 2,1 c 10,14 b 3,100 $ cat test | sort -u a 1,12 b 3,100 c 10,14 d 2,1 $ cat test | sort -u -k2 a 1,12 c 10,14 d 2,1 b 3,100 $ cat test | sort -u -k2 -h a 1,12 d 2,1 b 3,100 c 10,14 $ cat test | sort -u -k2 -h -t "," d 2,1 a 1,12 c 10,14 b 3,100
$ cat t | sort -k2 -h -t ,
d 2,1
a 1,12
c 10,14
b 3,100
b 3,100
SEE ALSO
- Archlinux manpages: curl(1) , ifconfig(8) , ip(8) , diff(1) , sdiff(1) , cmp(1)