All posts by admin

Split and join files

How to split a file in chunks and how to put them back together.

 bash | 
 
 copy code |
?

01
### SPLIT LONG:
02
split --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_
03
split --verbose --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_
04
05
06
### SPLIT SHORT:
07
split -b 5m -a 2 -d image.iso image.iso.part_
08
09
10
split --verbose -b 5m -a 2 -d image.iso image.iso.part_
11

HTTP Proxy Checker in bash

Usefull script  to check if a proxy is alive.

echo "Superuser privileges are required to run this script." 
02
echo "e.g. "sudo $0"" 
03
exit 1 fi 
04
05
 bash | 
 
 copy code |
?

01
#!/bin/bash
06
# HTTP Proxy Server's IP Address (or URL)
07
08
proxy_server=$1
09
10
# HTTP Proxy Server's Port Number
11
12
port=$2
13
14
15
# We're trying to reach this url via the given HTTP Proxy Server
16
# (http://www.google.com by default)
17
18
url="http://www.google.com"
19
20
# Timeout time (in seconds)
21
timeout=20
22
23
# We're fetching the return code and assigning it to the $result variable
24
result=`HEAD -d -p http://$proxy_server:$port -t $timeout $url`
25
26