convert mp3 to low quality

to convert one single mp3 file with bitrate of 96k

ffmpeg -i input.mp3 -b:a 96k output.mp3

convert mp3 changing title of file with bitrate of 56k

ffmpeg -i input.mp3 -b:a 56k -metadata title="abc" output.mp3

to view information about mp3 file

ffmpeg -i file.mp3

one-liner to convert multiple files

for i in $( ls *.mp3 );do ffmpeg -i $i -b:a 56k output_$i; done

filter last occurrence on file

filter last occurrence containing the DHCP string

tac /var/log/syslog | grep -m 1 'DHCP'

filter 3 lines between the last occurrence containing the err or warn string

tac /var/log/syslog | egrep -m 1 -C 3 'err|warn'

prescribe commands kyocera printer

set printer to use PCL 6 emulation mode

echo '!R! FRPO P1, 6; FRPO P3, 1; EXIT;' | lp -d PrinterName -o raw

print barcode with kyocera prescribe command using PCL 6 emulation on linux

echo '!R! UNIT D; BARC 19, Y, "ABC30", 30, 30; EXIT;' | lp -d PrinterName -o raw
echo '!R! UNIT D; BARC 19, N, "ABC90", 90, 90; EXIT;' | lp -d PrinterName -o raw

set resolution to 300dpi

echo '!R! FRPO N8, 0; EXIT;' | lp -d PrinterName -o raw

link to official manual of prescribe…rence_(ENG).pdf


filter 5 lines between the last occurrence

filter 5 lines between the last occurrence

tac /var/log/syslog | egrep -m 1 -C 5 'err|warn'

filter 5 lines between the last 2 occurrences

tac /var/log/syslog | egrep -m 2 -C 5 'err|warn'

print using command line linux

To list avaiable printers

lpstat -p

To print a plain text in one printer

echo 'oi' | lp -d printerNameHere

To print a pdf file in one printer

lp -d printerNameHere file.pdf

To print to parallel printer

echo 'oi' > /dev/lp0

To view printer log

tail -f /var/log/cups/page_log

if you print to a pdf printer the files will be saved in: /var/spool/cups-pdf


print real value of a symbolic link in linux

readlink -f /etc/localtime

manually set/change linux date

Set/change/update date to 31/10/2017 10:15

Option 1 – date command syntax

date -s '2017-10-31 10:15'

Option 2 – date command syntax

date -s '31 OCT 2017 10:15'