Welcome to bashoneliners.com, a curated collection of practical and well-explained Bash one-liners, snippets, tips and tricks. We aim to make each published one-liner to be of high quality: useful, easy to read, follows best practices, with clear, detailed, accurate explanation. These one-liners should help you automate tasks, troubleshoot problems, whether it be in system administration, file management, networking or programming.
L=5; while true; do; readarray -t paths < <(find . -type f -print | shuf -n 1); for i in "${!paths[@]}"; do; path=${paths[i]}; if ffprobe -i "$path" -show_entries format=duration -v quiet -of csv="p=0" > /dev/null; then; N=$(ffprobe -i "$path" -show_entries format=duration -v quiet -of csv="p=0"); D=${N%.*}; P=$((D / 100 * 25)); R=$((1 + RANDOM % D - P * 2)); S=$((P + RANDOM % R)); W=$((R / 4)); LEN=$((1 + RANDOM % L)); mpv "$path" --start="$S" --length="$LEN" --fs &> /dev/null; W=$(bc <<< "$LEN - 0.5"); sleep "$W"; unset 'paths[i]'; fi; done; done
cpus=($({ echo scale=2; awk '/cpu MHz/ {print $4 " / 1000"}' /proc/cpuinfo; } | bc))
fac() { { echo 1; seq $1; } | paste -s -d\* | bc; }
__=`sensors | grep Core` && echo \(`echo $__ | sed 's/.*+\(.*\).C\(\s\)\+(.*/\1/g' | tr "\n" "+" | head -c-1`\)\/`echo $__ | wc -l` | bc && unset __
bc <<< 'obase=2;1234'
echo 'obase=2;1234' | bc