Page 1 of 1

Linux Mint Tips

Posted: Fri Jul 27, 2018 7:54 am
by Caltrop
My Adventures In Linux Land
A former Windows user.

Code: Select all

grub problems after installing Linux to external drive
Linux now thinks your external drive is the primary booter.

Unmount & unplug the external drive.

Open a terminal and...
sudo grub-install sda6
   (or whatever partition you use)
sudo grub-mkconfig
sudo update-grub2

Now everything is back to normal, hopefully.

You can also plug the drive back in and run the grub commands.
The external drive becomes part of the boot system but not the primary.

I still have not figured out how to get just the external drive to boot.
You know, on another computer, all by itself.

This all came about trying to make a rescue system.
Best just to use the Live CD you originally installed from.

Sometimes after doing a LOT of file maintenance things get a little buggered.
Then your system will not boot right.
Best to put that Live CD in and run:
   fsck /dev/sda6
   (or whatever partition you use)
   this fixes all the messed up links & files
   the autofix option usually will not work, fsck will tell you
   just answer all the fsck questions to fix things

Code: Select all

make booting more interesting
be verrwy careful...
mess up grub and you will have to install Linux again
or use that Live CD to edit things right

edit as superuser
      make sure it is your screen size or the same ratio
         it will not fit like the desktop does
      no spaces in the name just to be safe
      a PNG or JPG work fine
sudo update-grub2
   now when you boot you will have glorius color instead of b&w

Code: Select all

caja crashing when opening a directory?
this is for those migrating from Windows


It is the thumbnail view of a WMF that crashes the caja file browser.

Move all those pesky WMF's to their own directory.
Turn off image preview in caja.
Use an image viewer to find the BAD WMF & isolate it in its' own directory.

WMF's do not work well in Linux anyway.
I also find that my old CDR (Corel Draw) files do not import well to inkscape.

Code: Select all

make auto-fortunes format correctly
Desktop Settings: mintdesktop -> terminal -> Show fortune cookies

add the -n option
that way auto-fortunes format correctly

you will have to edit this file with root privlages

    /usr/games/fortune | $command -f $cow -n

Code: Select all

remove all empty directories
'rmdir', unless forced to, will not delete non-empty directories

WARNING! this might make some things fail
but I live dangerously

Where did my directory in the home dirctory go...?
Duh, I just deleted it...

the script: ~/bin/rm-empty -or- ~/.local/bin/rm-empty

find ~ -type d ! -path '~.*' -empty -exec rmdir -v {} \;

Code: Select all

another tip for those who used to be Windows

I also use rsync for backups to an external drive
BAH! on all those backup utilities
   rsync makes a clone of your directories
   you can access them just like your home directory

note: there are two ways of getting rsync imitate DOS XCOPY
rsync -avmn --delete --progress --include='*/' --include=$file_nam --exclude='*' $file_pth $2
rsync -avmn --delete --progress --include=$file_nam --filter='hide,! */' $file_pth $2

the script: ~/bin/xcopy -or- ~/.local/bin/xcopy

if [ "$#" = 2 ]
   file_nam=$(basename "$1")
   file_pth=$(dirname "$1")"/"
   rsync -avm --progress --include='*/' --include=$file_nam --exclude='*' $file_pth $2
   echo -e "\nusage: move /src/pattern /dst/"

Code: Select all

safely remove external drive from the terminal
this finds the mount point, unmounts, & powers off the device
I use this a LOT!

usage: x-drv [drive label]

the script: ~/bin/x-drv -or- ~/.local/bin/x-drv

if [ "$#" = 0 ]
   echo -e "\nusage: x-drv drive_name\n"
   if [ -d "$dev_pth" ]
      tgt_dev=`findmnt -n -r -o SOURCE "$dev_pth"`
      echo -e "\nejecting: $dev_pth - $tgt_dev"
      umount "$tgt_dev"
      udisksctl power-off -b "$tgt_dev"
      echo -e ">>> safe to remove <<<\n"
      echo -e "$dev_pth - not mounted\n"

Code: Select all

list home directories & sizes
does not list hidden stuff
a 4.0K directory is empty

the script: ~/bin/lshmdir -or- ~/.local/bin/lshmdir

echo > temp.txt
find ~ -maxdepth 1 -type d ! -name '.*' -exec du -hs {} \; >> temp.txt
sort -k2 temp.txt
rm temp.txt

Linux Mint Tips - Another Tip

Posted: Thu Aug 09, 2018 4:05 pm
by Caltrop
This one is good for DOSBox.

Code: Select all

permanently mount drives
automounting is fine most of the time but...

open Drive Manager, select drive, turn off automount, select name

instead of the drive being mounted '/media/[user]/[drive]'
it is now '/mnt/[drive]'

do this for
      now it is mounted without accessing it
      system monitor now shows the drive without having to access or mount it
      permanently mounted
      can be accessed by DOSBox without mounting each CD
      you can now mount it in DOSBox [autoexec]