Code: Select all
#ls -lght /tmp/mod | awk '{ if ($4 < 100) $4 = " "$4 } {print $8,"\t",$5,$6,$7,"\t",$4}'
ls -lght /tmp/mod | awk '{ if ($4 < 100) $4 = " "$4 } {print $5,$6,$7,$4,$8}'
Code: Select all
#ls -lght /tmp/mod | awk '{ if ($4 < 100) $4 = " "$4 } {print $8,"\t",$5,$6,$7,"\t",$4}'
ls -lght /tmp/mod | awk '{ if ($4 < 100) $4 = " "$4 } {print $5,$6,$7,$4,$8}'
Code: Select all
#!/bin/bash
# if you need to add something to your hosts file you now want to add it to .etc/suphosts
# Uses/Creates a Directory .etc for hosts.txt file and for suphosts
hoisted()
# Restore original hosts: sudo cp /etc/hosts.bak /etc/hosts
{
[[ -e /etc/hosts.bak ]] || cp /etc/hosts /etc/hosts.bak || return 2
[[ -d .etc ]] || mkdir .etc || return 1
wget -O .etc/hosts http://winhelp2002.mvps.org/hosts.txt
sed -i '/^127.0.0.1/a\
# Linux box.\
127.0.0.1 porteus.example.net porteus' .etc/hosts
# [[ -f .etc/suphosts ]] && cat .etc/suphosts >> .etc/hosts
[[ -f .etc/suphosts ]] && sed "s/^/0.0.0.0\t\t/" .etc/suphosts >> .etc/hosts
sudo cp .etc/hosts /etc/hosts
ls -lh /etc/hosts{,.bak}
echo -n "Entries: "; wc -l /etc/hosts
}
hoisted $*
Code: Select all
guest@porteus:~$ . $g/hoisted.sh
--2017-05-12 14:04:55-- http://winhelp2002.mvps.org/hosts.txt
Resolving winhelp2002.mvps.org... 216.155.126.40
Connecting to winhelp2002.mvps.org|216.155.126.40|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 498107 (486K) [text/plain]
Saving to: ‘.etc/hosts’
.etc/hosts 100%[=========================>] 486.43K 243KB/s in 2.0s
2017-05-12 14:04:58 (243 KB/s) - ‘.etc/hosts’ saved [498107/498107]
-rw-r--r-- 1 guest users 487K May 12 14:04 /etc/hosts
-rw-r--r-- 1 guest users 786 May 12 14:04 /etc/hosts.bak
Entries: 15006 /etc/hosts
Code: Select all
guest@porteus:~$ cat >> .etc/suphosts
epiclol.com # FB pop under ad
apis.google.com # Ballistic Script!
^D
Code: Select all
guest@porteus:~$ . $g/hoisted.sh
--2017-05-12 14:27:33-- http://winhelp2002.mvps.org/hosts.txt
Resolving winhelp2002.mvps.org... 216.155.126.40
Connecting to winhelp2002.mvps.org|216.155.126.40|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 498107 (486K) [text/plain]
Saving to: ‘.etc/hosts’
.etc/hosts 100%[=========================>] 486.43K 36.8KB/s in 13s
2017-05-12 14:27:47 (37.3 KB/s) - ‘.etc/hosts’ saved [498107/498107]
-rw-r--r-- 1 guest users 487K May 12 14:27 /etc/hosts
-rw-r--r-- 1 guest users 786 May 12 14:04 /etc/hosts.bak
Entries: 15008 /etc/hosts
Code: Select all
guest@porteus:~$ ping apis.google.com
PING apis.google.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.060 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.049 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.043 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.109 ms
^C
--- apis.google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5110ms
rtt min/avg/max/mdev = 0.037/0.055/0.109/0.026 ms
Code: Select all
#!/bin/sh
if [ "$1" != "" ]; then
echo "127.0.0.1 " $1 " # " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 " " $9 >> .etc/suphosts
cat .etc/suphosts | tail -n 2
fi
hoisted.sh
Code: Select all
guest@porteus:~$ tst() { h=$1; shift; echo $h \# $*;}
guest@porteus:~$ tst To be or not to be?
To # be or not to be?
Code: Select all
guest@porteus:~$ ping apis.google.com
PING apis.google.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.040 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.044 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.045 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.044 ms
64 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 time=0.038 ms
Code: Select all
guest@porteus:~$ tst() { echo $1 "#" $*;}
guest@porteus:~$ tst That is the question.
That # That is the question.
guest@porteus:~$
MVPs is an incomplete block list and Google is a fairly blank page?Bogomips wrote:Giving an idea of the amount of time taken to traverse 15000 entries, something less than 26 microseconds. 8)
Very clever.Bogomips wrote:Code: Select all
guest@porteus:~$ tst() { h=$1; shift; echo $h \# $*;} guest@porteus:~$ tst To be or not to be? To # be or not to be?
Code: Select all
#!/bin/sh
if [ "$1" != "" ]; then
U=$1; shift; echo "127.0.0.1 " $U " #" $* >> .etc/suphosts
cat .etc/suphosts | tail -n 2
fi
hoisted.sh