Tardus's Linux Hints and Tips

Updated: 2023-11-11

Home... Help... Search... Computers...

Tardus's Linux Hints and Tips

Things I've discovered that helped me. Hope they help you too

remove transparency from an image using imagemagick

mogrify -alpha remove -alpha off image.png

convert syntax is the same

sort a file skipping first line, within a shell script

cat $FILE | (read line; echo "$line"; sort) >> packing.text

VIM / vim copy range of files to a new file

:19,34w newfile

:19,34w! newfile to overwrite an existing file

find what DNS servers Linux Mint is using

( nmcli dev list || nmcli dev show ) 2>/dev/null | grep DNS

(from http://unix.stackexchange.com/questions/28941/ddg#77633)


Merging PDF files

pdfunite 1.pdf 2.pdf 1-2.pdf

Setting tab stops to 4

for bash, put this line in ~/.bashrc file

tabs 4

for vim put this line in ~/.vimrc

set tabstop=4

+++ Very slow file manager Mint Mate 20.3

April 2023 - symptoms are lots of disk activity when pasting a large video into a folder (caja, nemo, etc.). The file manager becomes unusable during this time, eg, right clicking a file does nothing.

fix was to remove execute rights from xplayer-video-thumbnails. Small cost is that videos no longer have thumbnails, just a default video icon.

Very sluggish Caja file manager

  • Linux Mint 20.3 on a Lenovo M93Z AIO PC. Copying/moving big video file (say 400MB) - takes 10 seconds before you can even a right click menu on a file. Ditto when the file has been copied.

  • no lag when copying from the command line.

  • tried Nemo and Thunar, same sluggish behaviour.

  • noticed that the Mint menu was sluggish too after such file operations. I'm guessing it uses some of the same libraries.

  • found that SpaceFM file manager is much much quicker, even with thumbnailing turned on (< 8192KB). However, I found this file manager unreliable.

Mint Mate loses open app icons in panel

"Confession time: It turns out it was "user error" on my part. I had been playing around with the launcher icons on the left, trying to get them the way I wanted. And I didn't have any apps open at the time. So I didn't realize that the tiny vertical bar with 3 grey dots (pictured below on the righ) was actually the Window List panel." from https://forums.linuxmint.com/viewtopic.php?t=306206

to restore:-

Right click on the panel > add to panel > select Windows List > click Add.

Shrink/reduce size of PDFs

ps2pdf big.pdf small.pdf

(works if pdf is not largely images - if it is then it can't be reduced).

Merging videos of same format using ffmpeg

1. create a file videos.txt with contents like:

file 'what_is_God_like_1.mp4'

file 'what_is_God_like_2.mp4'

file 'what_is_God_like_3.mp4'

2. run ffmpeg -f concat -i videos.txt -c copy what_is_God_like-123.mp4

Using Mint Mate desktop in vnc server

in .vnc.xstartup comment out any window manager and replace with

mate-session &



# Uncomment the following two lines for normal desktop:



# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

mate-session &

-----------------------------------------------------+++ Mint 20.x - what DNS server am I using?

resolvectl status

Arduino IDE rights to /dev/ttyUSB0

need to add RW privilege

sudo chmod a+rw /dev/ttyUSB0

Linux Mint won't print multiple copies

Bug in the driver:

Here is the fix:

sudo systemctl stop cups

cd /etc/cups/ppd

sudo vio <your printer name>.ppd

Change *cupsManualCopies: true or *cupsManualCopies: False

to: *cupsManualCopies: True

sudo systemctl start cups

ffmpeg replacing a range of frames in a video

ffmpeg -i 10_July_2022,_An_Ancient_Atheism,_James_Stone.mp4 -i an_ancient_atheism.jpg -filter_complex "[1][0]scale2ref[img][vid];[vid][img]overlay=enable='between(t,0,138)'" -c:a copy out.mp4

replaces frames from the beginning to 138 seconds with the image.

Lost minimised windows in Linux Mint Mate

How do I get my minimized window back in Linux?

That's it, you will be able to view the minimized windows :) Right click on panel - select add to panel - scroll down and chose windows list all file minimize - will show on panel.

scp/rsync "version mismatch" error

The remote host has a non-empty .bashrc file which runs a bash script.

Solution was to remove all echo commands from both the .bashrc and bash script it called. The echo commands cause "junk" characters to interfere with the arguments given to scp or rsync.


# using ffmpeg to speed up a video including its audio

# also shrinks the video, which is always good!

if [ "$1" = "" ] || [ "$2" = "" ]; then

echo Usage: speedup-video.sh videofile speedup
echo where speedup is, eg, 110 for 10% faster


SPEEDUP=`echo "scale=2; $2 / 100" | bc`
VIDEOSPEEDUP=`echo "scale=4; 1 / $SPEEDUP" | bc`
NAME=`echo $VID | awk -F. '{print $1}'`
ffmpeg -i $VID -filter_complex "[0:v]setpts=0.85*PTS[v];[0:a]atempo=1.1765[a]" -map "[v]" -map "[a]" $NEWVID


using FOR in a BASH 1-liner


for colour in black white yellow red brown; do cp 2faces.jpg 2faces-$colour.jpg; done

results in






Linux Mint 19.3 sluggish performance

Sat 27 Nov 18:08:19 AEDT 2021

Apple iMac 24 inch 2008, 6GB ram, 1TB disk

Was quite adequate is not quite snappy.

Lately quite sluggush.

Tracked it down to using snap apps. I removed 2 snap apps I had plus the snapd support stuff and it is now fine again.

weex gets segmentation fault, core dumped, on Mint 20.1

Fix is to remove Ubuntu WEEX:

sudo apt-get --purge remove weex

And Install from Debian:

wget http://ftp.br.debian.org/debian/pool/main/w/weex/weex_2.8.3_amd64.deb

sudo dpkg -i weex_2.8.3_amd64.deb

Source: https://askubuntu.com/questions/1338535/weex-segmentation-fault-core-dumped/1375991#1375991

Find Mint version from command line

cat /etc/issue

Linux Mint 20.1 Ulyssa \n \l

ffmpeg - Creating a video with a single slide and some audio

ffmpeg -loop 1 -i who-is-best-1280x720.png -i who-is-2-audio-a.mp3 -c:v h264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4

ffmpeg - Merging 2 videos even with different codec and format settings

ffmpeg -i who-is-best-1.mp4 -i out.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" merged-video.mp4

Printing a large plan or poster when you only have a home printer (eg, A4 paper)

I wanted to print a free model plane plan, sized at 20x30 inches. Here is how I did it.

Install pdfposter

sudo apt-get install pdfposter

then at the command line:-

pdfposter -m A4 -p 30x20inch the_fish_v2.pdf fish-fuse-30x20inch.pdf


-m A4 means use A4 size paper in the printer
(man pdfposter shows other sizes)
-p 30x20inch means a 30x20 inch size plan/poster
the_fish_v2.pdf is the input file
fish-fuse-30x20inch.pdf is the 8-A4 page output file. When printed the 8 pages can be taped edge to edge (no overlap or trimming needed) to make the full-size plan/poster.

I found this superior to posterazor which required trimming of the pages and lacked alignmenbt cues.

a friend sent me a video made on an iPad. Sound had noise and the voice was too quiet. Here's what I did to make it acceptable.

# extracted the audio using ffmpeg

ffmpeg -i Spot\'s_sad_and_happy_day.mp4 Spot\'s_sad_and_happy_day.mp3

# made a copy, in case I need to check the original audio later.

cp Spot\'s_sad_and_happy_day.mp3 spot.mp3

# used Audacity to reduce the noise, which was constant background "white noise"

# and saved to spot-lownoise.mp3

# used normalize-mp3 to make the sound loud enough

normalize-mp3 spot-lownoise.mp3

# renamed it

mv spot-lownoise.mp3 spot-lownoise-normalised.mp3

# extract just the video

ffmpeg -i Spot\'s_sad_and_happy_day.mp4 -codec copy -an spot-video-only.mp4

# and merge video and audio streams, transcoding the audio to "aac" format.

# Apple devices won't play the audio if it is not in aac format.

ffmpeg -i spot-video-only.mp4 -i spot-lownoise-normalised.mp3 -shortest -c:v copy -c:a libvo_aacenc -b:a 256k Spot\'s_sad_and_happy_day_aac.mp4

format a text file with 4 fields on separate line into a 4 column table

e.g. cat suncalc-17July2021.lis |paste - - - -

( first remove blank lines from the file using

grep -v '^$' inputfile > outputfile )

Static IP address for Mint 20.1

Mint 20.x uses netplan, so the old method of editing /etc/network/interfaces

does not work.

Here are the steps for netplan:-

1. edit /etc/netplan/1-network-manager-all.yaml as follows-


version: 2

renderer: networkd



addresses: [10.x.y.z/8]



search: mydomain,


2. sudo netplan try

to test

3. sudo netplan apply

to apply - worked fine 10 Nov. 2022

Adding subtitles to a video

Use Aegisub to create a sub-titles file.

Open the mp4 video in Avidemux

For the video stream select a different format (ie, not "Copy"). I used MPEG4 AVC (x264)

Save as an mkv file.

to mount external usb hard disk at boot when booting to commandlinr mode only, Mint 20.1

Put @reboot mount /dev/sdb1 /media/steve/ehd

in root's crontab.


boot to prompt, not gui, Mint 20.1

sudo systemctl set-default multi-user.target


Mapping colour percentages of an image

eg, to work out percentage of foamboard sheet used for a model.

For black and white (posterize 2)

convert image.jpg -format %c histogram:info:- | sort -nr

More generally

convert image.jpg -colorspace RGB -format %c histogram:info:- | sort -nr

GIMP round corner filter not available

This filter only works is there is no alpha channel

Split image into equal parts using imagemagick

convert image.png -crop 32x32 parts-%02d.png

Video editing tips using ffmpeg

extract audio

ffmpeg -i myvideo.mp4 audio.mp3

cutting can also be done quickly using ffmpeg

cut out first minute for testing (and respects leading keyframe)

ffmpeg -i input.mp4 ss 00:01:00 -to 00:02:00 -c copy output.mp4

if video needs brightening, use ffmpeg

ffmpeg -i test2.mp4 -vf lutyuv=y=val*1.5 out2-1-5.mp4

brighten, crop and rotate together, showing how to use multiple video filters.

"transpose=2" is rotate 90 degrees anti-clockwise:

lutyuv=y=val*1.5 increase brightness by 50%:

ffmpeg -i VID_20200508_164812993.mp4 -vf "crop=iw*8/10:ih*8/10, lutyuv=y=val*1.5, transpose=2" neveralone.mp4

Video trimming with Avidemux

1. Load the file

2. find the selection to cut out.

3. Use the A and B markers to span the selection to cut out. Use the keyframe buttons to nudge the A and B into place, otherwise you get an error.

4. Press Delete

5. Save the video with a new file name, as MP4


Making an image background transparent using GIMP

This works for images with a solid background.

1. save the image in PNG format with an alpha channel (Layers, Transparency, Add Alpha Channel)

2. from the Toolbox, use the select by colour tool (Tools, Selection, By Colour Select)

3. click on the background.

4. press "Delete" key.

5. export as PNG

setting static IP on iMac running Mint

Mint 20.3 May 2022

Found sudo nmtui (text user interface; probably a "curses" app) worked very well.

Set to manual IP assignment

Set gateway to your router's address

Set some DNS servers, is a good one.

Save ((OK)

Back, the deactivate and the activate the network (Ethernet in my case).

Mint 18.3 - earlier method:

sudo ip flush enp0s25 && sudo systemctl restart networking.

Better than fiddling with the Network-Manager GUI!

OBSOLETE:- Editing the interfaces file per below did not work. I used the GUI to edit from DHCP to Manual, and set the address, netmask and gateway, and also OpenDNS's DNS servers, then saved.

one glitch: the gui does not tab properly to enter the address, mask and gateway. Visusally messy. Just ignore the look, and type ADDR Tab MASK Tab GATEWAY and click Save.

Setting static IP on Linux Mint 18, Lenovo Thinkpad T400

# Generic

Step1: Open the below configuriaton file

vi /etc/network/interfaces

Step2: Enter the ip address as below in the same file.

auto lo eth0 enp0s25

iface lo inet loopback

iface enp0s25 inet static




Step3: Restart the network service

sudo ip flush enp0s25 && sudo systemctl restart networking

Static IP address for Linux Mint 18.3 on a Thinkpad T400

# Mine

Edited /etc/network/interfaces file to be:-

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo enp0s25
iface lo inet loopback
iface enp0s25 inet static

# DNS configurations



Print statement "bug" in GAWK

I have an AWK script that adds numbers from each input line. The input numbers are intergers or decimals of 1 or 2 places (dollars and cents in fact).

It has been working well for many months, but today I noticed an anomaly.

One of the numbers reached 5 places plus a decimal fraction, eg 10000.25, but the print statement output it as only 10000.2

It turns out that the awk print statement uses sprintf to format numbers, controlled by OFMT = "%.6g" (ie, as floating point or in scientific notation, which ever uses fewer characters). OFMT is the Output Format specification variable.


$ echo "null" |awk '{print 9000.25}' correctly outputs



$ echo "null" |awk '{print 10000.25}' incorrectly outputs


I checked and OFMT is indeed %.6g on my Linux Mint 18.3 system

so, adding in an overt OFMT definition to override the default gives:-

$ echo "null" |awk '{OFMT = "%.6g"; print 90000.25}'


$ echo "null" |awk '{OFMT = "%.5g"; print 90000.25}'


$ echo "null" |awk '{OFMT = "%.7g"; print 90000.25}'


So, OFMT = "%.7g" is what I need.

I added it to the BEGIN section of the script.

finding length of an MP3 file

mp3info -p "%f: %S\n" audio.mp3

gives the file name and length in seconds

converting svg to png

inkscape -z -e test.png -w 1024 -h 1024 test.svg

using multiple field delimiters in awk

awk -F'[/=]' '{print $3 "\t" $5 "\t" $8}' file

replacing a newline with vi

use "\r" not "\n" which will insert a null


pad left with zeroes using awk

eg, where the second field is an integer, this will pad it to 3 decimal places:

ls *.png | awk -F[-.] ' {printf ("%s-%03d.%s\n", $1,$2,$3)}'

sort inside vim


sorts lines 1 to 24

run two B-Folders databases on Linux

exe is in ~/B-Folder_5

config.ini is ~/B-Folder_5/configuration

database in ~.B-Folders5/workspace

To get a second database instance:-

copy B-Folder_5 to B-Folder_52

create a workspace2 folder in ~/.B-Folders5

alter ~/B-Folder_52/configuration/config.ini by changing "workspace" to "workspace2"

create a Desktop launcher to run ~/B-Folder_52/b-folders

convert A4 PDF to 2xA4 to make an A3

sudo apt install pdfposter

pdfposter -s1 a3-input.pdf a4-output.pdf


pdfposter -p a3 original-file.pdf multipage-poster.pdf


Printing images across multiple pages

use PosteRazor

(Easy Poster Printer and Poster Printer might also be worth a look)

mount MacOS disk as external USB

need to install hfsprogs

need to mount the disk read-writer

e.g. sudo mount -t hfsplus -o remount,force,rw /dev/sb2 /media/steve/Macintosh\ HD/

depending on permission, may need to do file copying, etc. using root account

convert won't read a PDF

eg, convert marble-mic.pdf marble-mic.png gives

convert: not authorized `marble-mic.pdf'

Used to work, but not in latest Linux Mint 18.3

Fix is to edit the line in /etc/ImageMagick-6/policy.xml

<policy domain="coder" rights="none" pattern="PDF" />


<policy domain="coder" rights="read" pattern="PDF" />

2 June 2022, IM6 on Mint 20.3: following worked correctly

Add the line below before </policymap> in the /etc/ImageMagick-7/policy.xml

<policy domain="coder" rights="read | write" pattern="PDF" />

Deleting single quotes in OpenOffice/LibreOffice

Re: Delete apostrophe (single quotes) before numbers in all cells?

Postby FJCC » Fri Mar 16, 2012 4:54 am https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=49046

The apostrophe isn't really part of the cell content, it just signifies that the cell is formatted as text. To reenter all the data as number:

1. Highlight all of the cells and use Format -> Cells to change the cell format to an appropriate number format.

2. With all of the cells still selected, go to the menu Edit -> Find & Replace

3. In the Search For box enter .* (period asterisk)

4. In the Replace with box enter &

5. Select More Options and check Current Selection Only and Regular Expressions

6. Click Replace All

The .* "means zero or more of any character" and & means "whatever was found". These are regular expressions which are explained in the help section

Getting Avidemux to work. January 2019.

run as an appimage. Add a link into the main menu. v2.7 is working fine

Handbrake works well for transcoding video.

DNS resolving not working for about 5 minutes after boot

13 Dec 2018

This has been occuring for sometime on my old 2008 iMac 24" Unibody box, running Linux Mint 18.3,

Linux lion 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I've had the box for about 8 months, and the problem only occured in the last several weeks, so maybe due to some Mint uppgrade.

This page gave me some idea, but no resolution.


This was more help


I found that adding "nameserver" above the default "nameserver" in /etc/resolv.conf gave a temporary fix, but lost at the next reboot when the resolvconf startup process overwrites it.

( is my router, which is also the DNS server, presumably a caching server, and the DHCP server for my home network.)

Here is what I eventually did to resolve the issue.

I created a second resolv.conf file in /etc/resolvconf/ containing just the line "nameserver". This line is linked to by /etc/resolvconf/resolv.con.d/original.

After reboot I checked and name resolving was working fine. Here is what nslookup showed

steve@lion ~ $ nslookup tardus.net



Non-authoritative answer:

Name: tardus.net


Here are the contents of the 2 resolv.conf files

steve@lion ~ $ cat /etc/resolvconf/resolv.conf


steve@lion ~ $ cat /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)



From what I have gleaned it looks likes this is the way it wants to work:-

1. resolvconf re-writes /etc/resolv.conf to point to as the DNS server for all lookups on this box.

2. it also creates a caching DNS process on

1240 ? S 0:00 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/NetworkManager/dnsmasq.pid --listen-address= --cache-size=0 --conf-file=/dev/null --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dns

3. this caching DNS server process should in turn use the DHCP supplied DNS address to do initial lookups, but fails to do so for a period of several minutes.

4. my fix forces the caching server to use my router as its source of lookups.

drawing a true circle using ImageMagick

for a circle of diameter 952px, black on white,

convert -size 952x952 xc:white -fill white -stroke black -draw "circle 476,476,952,476" black-open-circle-2.png

(circle is specified by x,y of centre and a single point of the edge)

to add a dot for the centre,

mogrify -size 952x952 -fill black -stroke black -draw "circle 476,476,478,476" black-open-circle-2.png

(note: 3rd circle parameter is 2 more than the centre, so we get a dot of 4px.

also note that the mogrify command will give an error if the xc:white is left in. The convert command will give an error is it is left out!)

capitalising all words in a text file

sed -e "s/\b\(.\)/\u\1/g"

global colour change in GIMP

make image RGB

use Colors > Map > Color Exchange

shrinking an image and extending its canvas to 1024x1024


# mkSermonPics.sh

# take an image less than 1024x1024 size, resize it, and extend its canvas

# to 1024x1024


NAME=`echo $INFILE | awk -F. ' {print $1}'`

TYPE=`echo $INFILE | awk -F. ' {print $2}'`

echo $NAME $TYPE

for PERCENT in 10 20 30 40 50 60 70 80 90


convert $INFILE -resize "$PERCENT%" -gravity center \
-extent 1024x1024 $NAME-$PERCENT-1024.$TYPE


splitting an image using imagemagick


$ convert -crop 800x1000 image.png cropped_%d.png

good diff tool. dwdiff gives a composite file with terminal only markings for different words.

Blocking sites the easy way

Just edit the domains that you want to block into /etc/hosts, using the localhost address As Linux consults the hosts file before doing a DNS lookup (at least it does for Mint 18) the blocked domains can never be reached.


# block youtube youtube.com www.youtube.com m.youtube.com

Here is a shell script for bypassing the "blocked" entries. I made 2 copies of the hosts file and this script swaps between them. The hosts.unblock file has the blocked domains commented out.


# block sites by manipulating the hosts file

# by setting the domain in question to

ARG=$1 # 0 = noblock 1 = block

if [ $ARG = 1 ]; then

sudo cp /etc/hosts.block /etc/hosts


sudo cp /etc/hosts.unblock /etc/hosts


OpenDNS setup. Checked 22 May 2018 and ZTE router is using it in its DHCP assignments

converting expanded Gmail conversation to text

This is for Gmail via web browser on Linux.

Click the "expand all" icon at the top right of the conversation

Click "print" icon

A new tab opens in Firefox.

On the Firefox menu, File > Save Page As, and select as "text". save the file with ".txt" suffix

You now have an editable text file.

You can clean it up quickly using the following sed command in a terminal

$ sed -f strip-gmail.sed MYTEXTFILE

# here is my strip-gmail.sed file; alter to taste


/Reply via web post /d

/Start a New Topic/d

/Have you tried the highest rated email app?/d

/With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email/d

/app on the market. What are you waiting for? Now you can access all/d

/your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete/d

/an email again with 1000GB of free cloud storage./d

/Visit Your Group/d

/Yahoo! Groups/d







/Quoted text/d




huge font in LibreOffice

Just type the size in manually!

GIMP - enlarging the image canvas and giving a colour to the extra space

Image > Canvas Size > enter the size > click on "all layers" under Resize Layers.

making a scanned image's background transparent

Using GIMP

1. make image mode RGB

2. Layers > Transparency > Add Alpha Channel

3. Colors > Levels and the eye-dropper to select "black" somewhere in the image line-work ( if needed, slide the rightmost (white) slider in "input" to the left until the contrast looks good)

4. Then use Layers > Color to Alpha to set transparency

This will make everything but the black line-work transparent.


Alt. Select by colour, then delete

all done!

separating camel-Case words

sed 's/\([A-Z]\)/ \1/g'

Captures each capital letter and substitutes a leading space with the capture for the whole stream.


$ echo "aCertainCamelCasedWord" | sed 's/\([A-Z]\)/ \1/g'

a Certain Camel Cased Word

(from https://stackoverflow.com/questions/614930/how-can-i-cut1-camel-case-words)

Fixing missing application icons in Mint 17.x panels

The running app. icons in the Mint Mate panel disappeared.

Right-clicking on the blank part of the panel and de-selecting "Expand" brought the icons back. Note: the shortcut icons for Firefox, terminal, etc. had never disappeared, on those for running apps.

Now the panel shrinks to fit (horizontally) and shows scraps of desktop at the ends. If I right click on the triple bar at either end, and then re-select Expand, I'm back where I started. Still something wrong here, but it is workable.

With Expand on, I used the right-click menu to Add to Panel, then selected "Window List". That fixed it.

Linux Mint 17 Caja (file manager) case insensitive sort

Sun Jan 15 16:16:50 AEDT 2017

If Caja is using a case sensitive sort eg, A B C a b c, create a file .gnomerc in your home directory, containing


This will force case-insensitive sorting, ie, a B c D e F

Inserting a timestamp using vi / vim

:r !date

preventing Wifi drop-outs in Linux Mint 17 when using the Intel PRO 3945ABG wireless adaptor, on a Lenovo x60s laptop.

UPDATE: Sun Jan 15 16:26:44 AEDT 2017

WiCD still behaving flawlessly - I'll keep using WiCD.

UPDATE: Wed Jan 11 17:24:33 AEDT 2017

WiCD has performed without fault since installed 5 days ago.

UPDATE: Fri Jan 6 15:02:51 AEDT 2017

turning off power management within networkmanager did not work.

Next step: remove network manager and install WiCD instead


From google search, turning power management off for the adaptor seems to be the key.

sudo iwconfig wlan0 power off

Time will tell if this a) is a fix b) survives a reboot.

I added this to /etc/rc.local

No longer needed!
# chkNetwork.sh
# check if the network interface is up, and if not, start it.
# on the x60s Thinkpad sometimes it does not start properly.

echo ==== `date` ====
echo $0     "-------------------"
STATUS=`netstat -rn`
# now ping and get the % packet loss
ONLINE=`ping -q -c 3 | awk ' /loss/ {print $6}'`
echo "netstat -rn :" $STATUS
echo "ping -q -c 3 :" $ONLINE
if [ "$ONLINE" = "100%" ]; then
        echo "Network is off-line:"
	echo "Now restarting the network and running dhclient"
	service network-manager restart
	dhclient wlan0
	echo "Network is on-line:"

# and set power management to off, to avoid sporadic Wifi shutdowns
PMSTAT=`iwconfig wlan0| grep "Power Management" | awk -F: '{print $2}'`
echo "Power management was "$PMSTAT #display current power management status
iwconfig wlan0 power off	# set it to off
PMSTAT=`iwconfig wlan0| grep "Power Management" | awk -F: '{print $2}'`
echo "Power management is "$PMSTAT #display current power management status

( from http://askubuntu.com/questions/73607/wireless-connection-keeps-dropping-with-an-intel-3945abg-card )

Removing CTRL-M (^M) from text files

use tr

eg, cat file | tr -d '\r' > newfile

Round Corners using GIMP

The Filters > Decor > Round Corners option does this, with a dropped shadow too.

If it is greyed out, try turning off the image's alpha channel; Layers > Transparency > Remove Alpha Channel

HP Envy 4005. Ink usage

Original HP 61 (not XL) gave 177 pages and both cartridges ran out together.

Replacement 3rd party cartridges (61XL) off eBay installed OK 30 May 2016. Printer reported them as original HP that had been refilled.

command-line adding tags to MP3 files

eyeD3 is very good

getting TWM working with vncserver on Linux Mint 17.1 20 April 2016

Leaner than using Mate desktop.

sudo apt-get install xterm

edit ~/.vnc/xstartup to contain:


# Uncomment the following two lines for normal desktop:



# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

/usr/bin/xterm -geometry 80x24+10+10 -ls -title "xterm" &

/usr/bin/xterm -geometry 80x24+200+200 -ls -T "xterm" &

twm &

If you use the default x-terminal-emulator you get no active prompt, hence cannot enter any commands. Ditto mate-terminal

xterm is fine. To copy and paste, select the text with the mouse, then press middle button (or left and right together) to paste.

See http://unix.stackexchange.com/questions/177364/vnc-unable-to-get-a-shell-prompt-with-the-default-opened-terminal-application/277720#277720

Printing images full size, and to a set size: 18 April 2016

To print an image that is say exactly 35x56mm, for model making etc, use GIMP.

Use the resize function, and with dimensions in mm. Then print from within GIMP using 100% scaling.

getting eth0 to work after swapping hard disk to another motherboard/laptop 18 April 2016


Problem is that with a static IP for server puffer, while udev finds the new Ethernet hardware, and writes it in to /etc/udev/rules.d/70-persistent-net.rules, it does so as "eth1", which is not in the /etc/network/interfaces file.

The fix was to edit the 70...rules file, commenting out the old eth0 entry, and altering the "eth1" entry to "eth0". Then either restart using

> service network-manager restart



Sketch to Image, March 2016

1. Sketch with black fibre pen, complete, but no colours

2. scan into an image

3. convert -posterize 2 the image to make the black into uniform black

4. use GIMP to add the colour fills and any correction; brush or eraser

Using avconv (replacement for ffmpeg) to edit video from Android camera (Motorola Moto G 2nd Gen), Feb 2016

avconv -i VID_20160203_103749861.mp4 -s 480x270 -strict experimental Kylie.mp4

avconv -i Kylie.mp4 -vf "transpose=1" -strict -2 Kylie-demo-3Feb2016.mp4

avconv -i Kylie-demo-3Feb2016.mp4 -vcodec copy -af volume=volume=12dB Kylie2.mp4

run command at login: 2015

put in ~/.profile

run command at terminal startup: 2015

put these in ~/.bashrc

Date: epoch to seconds, later GNU date, 2015

date -d @Epoch

SNMP page count for HP6520 all-in-1, 2015

>$ snmpwalk -c public -v 1|grep 33[0-9][0-9]

iso. = Counter32: 3318

confirmed against Print Status Report

html to pdf conversion, 2015

use: wkhtmltopdf qanda.html qanda.pdf

very good results

Broken home wifi on plover, Oct 28 2015

Installed WiCD via eth0, configured wlan0 for home wifi and all fine, therefore

concluded that network-manager config was mangled.

Found wlan0 defined for tardus, and wifi0 defined for home wifi in

/etc/network/interfaces. Network-manager ignore interfaces defined here. Removed and ran sudo service network-manager restart

This fixed it. No idea how it got messed up. Did connect via phone on Canberra trip last week, so maybe this messed with it.

Removed WiCD after, as it autostarts and could interfere.

Making big text and banners, Oct. 2015

mkBanners.sh works.

Here is the actual convert command:-

convert -background white -fill black -font $FONT \

-size 640x480 \
-gravity Center caption:"$TEXT" $IMAGE

mogrify -trim +repage $IMAGE

So far the best way to print is to insert the images into an Impress file, resizing manually as needed.

join images, 2015, 2019

imagemagick convert command

For simple concatenation in a single row or column, the append option of the convert tool is sufficient. Note that -append concatenates all images vertically, creating one column with n rows and +append concatenates horizontally, creating one row with n columns.

montage can also be used, eg,

montage orig-GodAndWarlords-[2-5].png -geometry +4+4 -tile 4x1 God-and-Warlords.png

The command above will string 4 images (GodAndWarlords-2.png to GodAnmdWarlords-5.png) resizing smaller ones to the size of the largest, with 4 pixel borders and in one row of 4 tiles.

Posterise an image, 2015

convert -posterize 2 day4RepairWork-12-complete.jpg junk-2b.jpg

does a fair job.

Add PDF output to CUPS

sudo apt-get install cups-pdf

Complex awk one-liner syntax examples:-

awk ' NR==1 {print $1, $2, NR;t=$1} NR>1 {if (($1-t)<590) print $1,$2, $1 - t,NR; t=$1} ' subFloorAH.hist

# above checks for the timestamp

awk ' { print strftime("%a %b %e %T %Z %Y",$1),$2,$3,$4,$5 }' subFloorAH24h.plot

joining text files into one with columns

paste file1 file2 | column -s $'\t' -t

Linux Mint boot to console (for server)

edit /etc/default/grub to add "text" to the default line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text"

then run, as root, update-grub

mounting thumbdrives as a user, 2015

use pmount and pumount

MP3 removing silence , 2015

sox, using trim or silence options

LibreOffice button icons

default is "Human", mostly mono; I prefer "tango" with its colours. Use Synaptic to install libre-office-tango, then restart Office.

making PDFs from HTML

pandoc works very well

Does a lot of other conversions too.

if CAJA file names in the icon view are close to invisible,

reset the background to another colour, then back to white. Seems to reset it.

AWK random numbers

awk ' BEGIN {srand(systime() + PROCINFO["pid"])};{item[NR]=$0}; END {x=int(rand()*(NR)+0.9999); printf("%-50s|%2d|%20s\n",item[x],x,FILENAME)} ' $LIST

BASH is not the same as "sh" in Mint 17.1

Fix by redirecting the sh link in /bin

Rescaling a fussy pdf to fit A4 for printing

cpdf -scale-to-fit a4portrait -scale-to-fit-scale 0.8 ChurchContactListApril2015.pdf -o ChurchContactListApril2015-80.pdf

alt: convert -density 300 -trim test.pdf -quality 100 test.jpg

and put the images in a doc.

restarting vsftpd after change to its config file

sudo service vsftpd restart

restarting Mint 17.1 networking

sudo service network-manager restart

plotting time series data, eg, download speed

cat dsl_down.conf | gnuplot

for example see the "PCs" folder

adding two images vertically


Rotating an mp4 video

ffmpeg -i 20150312_171144.mp4 -vf "transpose=1" -strict -2 feedingChooks.mp4

For the transpose parameter you can pass:

0 = 90CounterCLockwise and Vertical Flip (default)

1 = 90Clockwise

2 = 90CounterClockwise

3 = 90Clockwise and Vertical Flip

Cleaning a noisy scanned page

./textcleaner -g -e stretch -g -e stretch -f 25 -o 10 -u -s 1 -T -p 10 Christmas-Angel-1.jpg Christmas-Angel-1-cleaned.jpg

where textcleaner is from Fred's (Imagemagick) Scripts

Ripping CDs - use RipperX

shrinking many mp3s to fit on a CD

use the script shrinkMP3toFreq.sh

eg, shrinkMP3toFreq.sh 44.1 "LOTR*.mp3"

HP6520 "HP protected cartridge installed" error when changing cartridges.

I turned of cartridge chip info in settings. Also had to get the chip of an old 3rd party cartridge and install to one of the older chipless ones. so far so good.

Bulk rename of files

rename 's/This_or_\(that\)/The-other/' *.mp3

Printing a text file, eg, script source

a2ps does not work (Dec. 2014); gives tiny print.

Instead use:-

enscript -2 -jr --header='$n %W Page $% of $=' index.txt

This gives crude borders, title, 2 pages per page in landscape, and is as good as a2ps used to be, though not quite as pretty.

Editing MP4

Avidemux 2.5.4 has bug with GS24G MP4, cant find codec for audio, with Mint 17.1

Here is fix from Linux Mint Forums

Postby Statik on Fri Sep 19, 2014 7:04 pm

Alright, so I exported the package list on the old computer and diff'd it to the new computer and I discovered that avidemux-plugins-common and avidemux-plugins-gtk were both missing. I installed those and it works great!



Also need to set audio as pulse-audio, not the default. Edit > Prefs > Audio

Used PITIVI instead.

Start new project

add file to it

render it, using MP4 (720 x 576 reduced a 130MB 1m18s file to 20MB) and MP3.

MediaInfoGUI is good for information

normalising mp3 files

As mp3gain is not readily available in Linux Mint now, and I cannot get normalize-audio to work, I've settled upon using sox. Needs sox MP3 library as well.

sudo apt-get install sox libsox-fmt-all
sox --norm infile outfile

Slow but it does work

splitting an image into 2 horizontally:-

convert rockwallPizza.jpg -crop 50x100% cliff.jpg

joining images seamlessly:-

eg, convert stone-93466_640reversed.jpg stone-93466_640.jpg +append rockwall.jpg

joining mp3 files:

mp3wrap 20140418-WhatIsDeathWhatItsCure_30m_00s__35m_15s_65h.mp3 temp1.mp3 temp2.mp3

posterising one of my 4 colour pen sketches:

1) enhance using Shotwell (may help)

2) mogrify daniel3-*.jpg -scale 50% +dither -posterize 2

Printing "oversize" PDF forms, etc (where bits get cropped in printing)

1. use Adobe Reader and in Print, use a page size of A4-marginless.

2. use jpdftweak, and page size legal (gives more white space, but cannot

open password locked PDFs).

to use a script to "cd", you need to . or source the file, not run it.

ncdu, great for seeing diskusage tree - lean and light,

can cleanup in separate shell

LibreOffice spell not working

  • sudo apt-get install myspell-en-au

  • restart LibreOffice

cleaning up a text file that file reports as DATA

tr -cd '\11\12\15\40-\176' < dirtyfile > cleanfile

pdftk, very useful for reordering pages and even rotating them, as for folded booklets

eg, pdftk JohnsGospel4.pdf cat 1S 4S 2 3 output JohnsGospel4booklet.pdf makes a 4 page A6 folded booklet from a four page original.

Linux mint 14 - getting scanner to work

simple scan reports "no scanners detected"

  • same thing happened earlier with ubuntu 12. Fix then was to install another version of hplip, apparently 3.12.11.

    at terminal, ran hplip-3.12.11.run

    accepted the defaults (though it said was using mint 13 settings, not knowing about mint 14)

    I asked it to remove 3.12.6 first, and after re-plugging the USB cable when prompted, and setting up a new USB instance of the printer when the hp-setup gui launched, the scanner (simple scan) works fine, without even a reboot.

    Note: even though I had done a mint system update immediately before this, it did not update beyond 3.12.6

#clearing the FireFox cache


cd ~/.mozilla/firefox

# find the mozilla profile folder

FOLDER=`awk -F= ' /Path/ {print $2}' profiles.ini`

echo $FOLDER

# clear the cache


rm -rf Cache/*

rm -rf minidumps/*

rm -rf startupCache/*

rm -rf thumbnails/*

deleting Trash, Ubuntu 12.10

rm -rf ~/.local/share/Trash/*

Setting up SSH for auto login

[SOLVED] Ubuntu : Agent admitted failure to sign using the key." problem.

This are the steps to access other server with keys

At client

ssh-keygen -t rsa

scp .ssh/id_rsa.pub server:

(ftp is fine too)

At users home on server

mkdir .ssh

chmod 0700 .ssh

cp id_rsa.pub .ssh/authorized_keys

chmod 0600 .ssh/authorized_keys

or if the authorized_keys file already exists, just
cat id_rsa.pub >> authorized_keys

At client, now login to the server with password then logout and run :

ssh-add (though may not be necessay)

Impress - edit (rh click) master page to change default fonts

Can also F11, right click on eg "title" and change default

#convert MOV to MP4



mencoder ${fl} -o ${fl/mov/avi} -oac mp3lame -ovc lavc

mplayer -ao pcm -vo null -vc dummy -dumpaudio -dumpfile ${fl/mov/mp3} ${fl/mov/avi}

#rm ${fl/mov/avi}


then use avidemux to expand 2:1 if nec, and convert to MP4, etc

# printing photos

20150828 - nogo use gwenview, landscape, 4x6 photo paper, auto scale and enlarge smaller


Shotwell viewer is good too - 20150828 - works fine, but needed to select Photo tray as source for each job. Landscape, source photo tray, image set to fill page, media size set to plain 4"x6" photo, quality to high res. photo.


# copying DVD Nov 2010

used DVD Movie Backup to create iso file

used K3B to burn to single sided DVD-R

Dec 2015 - DeVeDe app works well, to make iso and burn same

# mov to avi

mencoder -of avi -oac pcm -srate 48000 -af resample=48000:0:2 -ovc lavc -lavcopts vcodec=mjpeg inputfile.mov -o outputfile.avi

# avi to mpeg

mencoder input.avi -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 -o output.mpg -oac lavc -ovc lavc -lavcopts acodec=mp2:abitrate=224:vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3

# resample MP3 using LAME (shrunk 48MB to 9 and still OK for voice)

lame --resample 16 input.mp3 output.mp3

# convert images to a max size (and leave smaller ones alone)

convert deltamodel2.jpg -resize '640x480>' junk2.jpg

mogrify -resize '640x480>' duckchaser1-*.jpg

# add mp3 to K3B

apt-get install libk3b6-extracodecs

# convert mp3 to ogg (K3B sometimes won't handle MP3)

sox qaz.mp3 qaz.ogg

# split ogg or mp3

mp3splt -t 5.00 qaz.ogg

# "host error" opening Audacity

# killall esd first

# Impress looping slideshow - set time in auto to 00:00:00

DVD tools

Complete Example

This example explains how to use dir2slideshow, dvd-slideshow, and dvd-menu together to create a complete DVD.

* Using dir2slideshow

* Creating slideshow with dvd-slideshow

* Creating menu with dvd-menu

This example is designed to show how to make a simple dvd slideshow from start to finish. I'm assuming you have installed all the required packages first.

Let's assume we have a directory with a bunch of pictures that we want to use in a slideshow. The directory is called "my_pictures".

Use the dir2slideshow script to quickly generate an appropriate listing of the pictures in "my_pictures". We want each picture to be displayed for 5 seconds before going on to the next picture. The name of the slideshow will be "Complete example":

> dir2slideshow -n 'Complete example' -t 5 my_pictures

This will generate an output file "Complete_example.txt" that looks like this:

title:5:Complete example









This will be the input file to dvd-slideshow. If you want to do anything fancy, you could edit this text file by hand at this point. We won't bother since this is a simple example. We want to name the slideshow "test complete", and add some simple audio during the slideshow:

> dvd-slideshow -n 'test complete' -f Complete_example.txt -a 'strojovna_07-TEXEMPO-30s.ogg'

You'll see the program display the progress, and assuming there are no errors, it will finish by producing the following files in the current directory:



The mpeg file is the actual video file that you can check to make sure it looks ok. Use mplayer or your favorite video player:

> mplayer test_complete.vob

Make sure everything looks ok. At this point, you could repeat this process on a different directory to generate a new slideshow, where we'd get a new set of .xml and .vob files corresponding to that slideshow, but let's keep it simple for now with just one.

The .xml file is fairly simple. It contains the chapter information and the name of the mpeg file that you just created. It is used when making a dvd button menu with dvd-menu.

To create a dvd navigation menu, call dvd-menu with the dvd title "Complete Example DVD", creating two buttons labelled "My example" and "Slideshow 2" which both point to the same video, test_complete.vob:

> dvd-menu -t 'My example' -t 'Slideshow 2' -f test_complete.xml -f test_complete.xml -n 'Complete Example DVD'

This command will write the output (real dvd filesystem) in the directory "dvd_fs". After the dvd-menu script finishes, you can check out your final dvd with xine using the command:

> xine -g -u 0 dvd:"`pwd`/dvd_fs/"

or for those using Totem:

> totem dvd:"`pwd`/dvd_fs/"

Now you may want to have a backup copy of all the original pictures that went into your slideshow on the dvd. Before making the dvd-compatible UDF filesystem, you can copy other stuff into the top-level of your dvd:

> cp -a my_pictures dvd_fs

The -a option copies recursively and keeps the date the same. Note that you can use the "-c" option in dvd-slideshow to perform this same function! Now, in the dvd_fs directory, it looks like this:

> ls -F

AUDIO_TS/ my_pictures/ VIDEO_TS/

The AUDIO_TS/ and VIDEO_TS/ directories are required by the dvd video standard, and contain all of the menus and video that will be used when you put this dvd into your home dvd player. If you mount it on your computer, you'll see the filesystem above.

Now let's create a dvd-compatible UDF filesystem that we can burn to a real dvd:

> mkisofs -dvd-video -udf -o dvd.iso dvd_fs

This will create the iso image dvd.iso that you can burn to a real dvd with dvdrecord. You could have also used the "-iso" option in dvd-menu to automatically create the iso image at the end of the dvd-menu script. I'm assuming that you've already found out which device your dvd recorder is on with "dvdrecord –scanbus" or equivalent. Mine is device number 1, hence the dev=0,1,0.

> dvdrecord -v -eject -dao speed=4 dev=0,1,0 dvd.iso

When finished, try it out in your computer or home dvd player!

Recording with Audacity - Ubuntu 10.4

1. click on the volume control in the toolbar of Ubuntu

2. Sound Preferences

3. select line-in

4. un-mute


Open Audacity

1. set input and output to ALSA:pulse

2. file new

3. record

using a ball mouse as a water level gauge:

host puffin with xset m 0 gives 55mm horizontal movement of optical mouse for full width traverse, = to 65:1 for 1800mm water depth in tank (at half screen for full height of tank).

Home... Help... Search... Computers...

This page tardus.net/bits.html Last refreshed: 22 Nov 2023

About Tardus

Contact me, "Tardus" Copyright powered by txt2tags

Search tardus.net