Bash Knowledge

Spawn a TTY using Python

Spawn a “real” TTY. Useful for sudo, su, ssh…

python -c ‘import pty; pty.spawn(“/bin/sh”)’

Get total duration of video files

Get the total duration of video files in a directory.

exiftool -n -q -p '${Duration;our $sum;$_=ConvertDuration($sum+=$_)}' */*.mp4 | tail -n1

Found here

Iterate over lines in a file

Execute any command on every single line of a given file.

while read p; do
    echo $p;
done < file