Check These Out
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Joins two pdf documents coming from a simplex document feed scanner. Needs pdftk >1.44 w/ shuffle.
Mirror a remote directory using some tricks to maximize network speed.
lftp:: coolest file transfer tool ever
-u: username and password (pwd is merely a placeholder if you have ~/.ssh/id_rsa)
-e: execute internal lftp commands
set sftp:connect-program: use some specific command instead of plain ssh
ssh::
-a -x -T: disable useless things
-c arcfour: use the most efficient cipher specification
-o Compression=no: disable compression to save CPU
mirror: copy remote dir subtree to local dir
-v: be verbose (cool progress bar and speed meter, one for each file in parallel)
-c: continue interrupted file transfers if possible
--loop: repeat mirror until no differences found
--use-pget-n=3: transfer each file with 3 independent parallel TCP connections
-P 2: transfer 2 files in parallel (totalling 6 TCP connections)
sftp://remotehost:22: use sftp protocol on port 22 (you can give any other port if appropriate)
You can play with values for --use-pget-n and/or -P to achieve maximum speed depending on the particular network.
If the files are compressible removing "-o Compression=n" can be beneficial.
Better create an alias for the command.
This will save your open windows to a file (~/.windows).
To start those applications:
$ cat ~/.windows | while read line; do $line &; done
Should work on any EWMH/NetWM compatible X Window Manager.
If you use DWM or another Window Manager not using EWMH or NetWM try this:
$ xwininfo -root -children | grep '^ ' | grep -v children | grep -v '' | sed -n 's/^ *\(0x[0-9a-f]*\) .*/\1/p' | uniq | while read line; do xprop -id $line _NET_WM_PID | sed -n 's/.* = \([0-9]*\)$/\1/p'; done | uniq -u | grep -v '^$' | while read line; do ps -o cmd= $line; done > ~/.windows
I improved a bit on the original by only using sed and extracting the quote with a matching group.
Use -nE for sed on Mac OSX
Use -nr for sed on Linux.
Warning! The quotes from Borat are definitely offensive.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22)
(all files & folders on destination server/folder will be deleted)