Check These Out
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Report information about a bitmap file.
Requires software found at: http://lpccomp.bc.ca/remserial/
Remote [A] (with physical serial port connected to device)
$./remserial -d -p 23000 -s "115200 raw" /dev/ttyS0 &
Local [B] (running the program that needs to connect to serial device)
Create a SSH tunnel to the remote server:
$ssh -N -L 23000:localhost:23000 user@hostwithphysicalserialport
Use the locally tunnelled port to connect the local virtual serial port to the remote real physical port:
$./remserial -d -r localhost -p 23000 -l /dev/remser1 /dev/ptmx &
Example: Running minicom on machine B using serial /dev/remser1 will actually connect you to whatever device is plugged into machine A's serial port /dev/ttyS0.
A common mistake in Bash is to write command-line where there's command a reading a file and whose result is redirected to that file.
It can be easily avoided because of :
1) warnings "-bash: file.txt: cannot overwrite existing file"
2) options (often "-i") that let the command directly modify the file
but I like to have that small function that does the trick by waiting for the first command to end before trying to write into the file.
Lots of things could probably done in a better way, if you know one...
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"
}
This type of join is clearly documented in the bash manual. Only the first character of IFS is used for the delimiter.
A similar command that lists only the currently running VMs is thus:
$ VBoxManage list runningvms
...the above showing a list of VMs by name and UUID in the same format as the "$ VBoxManage list vms" command
Find if $b is in $a in bash