Category Archives: quickies

TermRecord self-contained HTML Video!

Terminal session recorder that outputs self-contained HTML!

You can then email it to anyone to show them how to do something via command line.

They open it in a browser and it plays like movie.

Download it here

or if you have pip installed use ” pip install TermRecord ”

usage: TermRecord [-h] [-b {script,ttyrec}] [-c COMMAND] [-d h w] [–json]

Stores terminal sessions into HTML.

optional arguments:
-h, –help            show this help message and exit
-b {script,ttyrec}, –backend {script,ttyrec}
use either script or ttyrec
-c COMMAND, –command COMMAND
run a command and quit
-d h w, –dimensions h w
dimensions of terminal
–json                output only JSON
–js                  output only JavaScript
file to use as HTML template
-o OUTPUT_FILE, –output-file OUTPUT_FILE
file to output HTML to
-s SCRIPT_FILE, –script-file SCRIPT_FILE
script file to parse
-t TIMING_FILE, –timing-file TIMING_FILE
timing file to parse


grep for an IPv4 address

grep for an ip address and sort it with a count

lastb | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort | uniq -c | sort -k 1 -g


to show login attempts

grep -E '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' /var/log/secure | grep -i authentication

find excluding whole or partial paths (like grep -v)

” | wc -l ” to show the number of files found

[root@titan ~]# find / -iname ‘*.tgz’ | wc -l

[root@titan ~]# find / -iname ‘.tgz’ -a ! -path “backups*” | wc -l

[root@titan ~]# find / -iname ‘.tgz’ -a ! -path “b*” | wc -l

[root@titan ~]# find / -iname ‘.tgz’ -a ! -path “x*” | wc -l

OR with -prune ( ignore a directory and the files under it )

find / -name “backup” -prune -o -name ‘.pdf’ -print

find / -path /backups -prune -o -iname *?.rpm?* find all your rpmnew and rpmsave files but ignore your backup directory

find / -name “.tgz” -print -o -path ‘/home’ -prune -print -o -path ‘/www’ -prune

find . -iname “.pdf” -print -o -path “Accounts” -prune

this works as well

find / -name “.tgz” -o -path ‘/home’ -prune -o -path ‘/www’ -prune -o -path ‘/backups’ -prune

‘/home’ excludes home and anything under it.

‘*/www’ excludes any path with www in it.

Find and Copy with xargs

find . -name *.log -print0 | xargs -I{} -0 cp -v {} /tmp/log-files

Find and Move with xargs

find /mnt/cloud_drive/tarballs/./* -size -14M -print0 | xargs -0 -I {} mv -iv {} /path/to/new/dir

ffmpeg: error while loading shared libraries:

On CentOS 7 I got this error trying to run ffmpeg

ffmpeg: error while loading shared libraries: cannot open shared object file: No such file or directory

doing ldd $(which ffmpeg) gave me this

[root@titan ~]# ldd $(which ffmpeg) =>  (0x00007fffa2dfe000) => not found => not found => not found => not found => not found => not found => not found => not found => /lib64/ (0x00007fb7084e5000) => /lib64/ (0x00007fb7082c9000) => /lib64/ (0x00007fb707f07000)
/lib64/ (0x00007fb708805000)

find gave me this

[root@titan ~]# find / -name “*”
[root@titan ~]#

I added


to the /etc/

so it now reads

[root@titan ~]# cat /etc/

update with

[root@titan ~]# ldconfig

Now it works fine!

Math with bash

must be in double quotes * / % – +

echo “$(( 81712196 / 1024 ))”


echo “$(( 81712196 * 1024 ))”


echo “$(( 81712196 % 1024 ))”


OR pipe it through bc

echo ‘scale=6; 12*613-894/3.5’ | bc and the answer is 7100.571429


echo “scale=6; (3*3-6+4*5-2)/7*2” | bc -i
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty’.
scale=6; (3*3-6+4*5-2)/7*2


Simply use tcalc…

who’s been ftp’ing

if you run the following from the command line you’ll get a nice colourful screen output of ftp access

awk '{print $2,$3,$4, "direction="$12," user="$14," complete="$18," fromIP="$7," size="$8, " FileName="$9}' /var/log/xferlog | grep --color 'direction=\|user=\|complete=\|fromIP=\|size=\|FileName='