Wednesday, July 28, 2021

My-Weather-Indicator (Panel and Desktop Widget Options)

My Weather Indicator is my go to weather app.  It shows current weather conditions for your area on the Panel or on a nice Desktop Widget (widget is off by default).  It also allows you to pick from four different weather sources (OpenWeatherMap, World Weather Online, Yahoo Weather, or Wunderground) and will show both your local weather and one additional area (optional).  You can see detailed hourly forecast, weekly forecast, and current weather maps.  In addition it has sunrise, sunset, and moon phases.  Best of all it runs on Ubuntu 20.04 unlike Gnome Weather (at least for me).

I have an old article on how to install My Weather Indicator and it was popular so I thought I'd do an updated post.

It's fairly easy to get it running, you just need to add a repository, update them, install and configure My-Weather-Indicator. Let get it installed and running:


1. open a terminal window

2. Type in the following command and press ENTER

sudo add-apt-repository ppa:atareao/atareao

3.Type in the following command and press ENTER

sudo apt update

4. Type in the following command and press ENTER 

sudo apt install my-weather-indicator


Once the My-Weather-Indicator has installed it should appear in your app list.  Simple run the program and it will start it's configuration screen.


I selected AUTO LOCATION which worked just fine for me.  If you want the Desktop Widget active make sure you check the SHOW WIDGET box here.

Open Weather Maps is default which is what I used.  Some of the optional services may require you to have an account with them.  Open Weather Map did NOT require an additional settings other than just checking the tick.


I'm in the U.S.A. so I set most of the UNITS settings to US Standards


If you want the App to run on startup make sure you check the AUTOSTART box.

Tuesday, June 01, 2021

Mount your Virtualbox OS Guest file system as a Hard Drive in Ubuntu

In case something is broken within your VirtualBox Guest OS or if you just want to access the files, the following will allow you to mount your VirtualBox Guest OS disk images in your Ubuntu (Host) like it's an attached hard drive or just another directory.  This access will have full read/write permissions so you'll be able to copy files to/from it, delete files, or change files on your VirtualBox Guest OS.

Make sure your VirtualBox Guest OS is shutdown and the virtual disk image is NOT in use. 

NOTE: Remember to UN-MOUNT it once your finished accessing the Guest OS files (see below).


Let's get started:

1.  Open a Terminal Window. Run the following command:

vboximg-mount --list

vboximg-mount  is how you make your VirtualBox Disk Images (Guests) available to the Host. The --list option will list all VirtualBox Disk Images along with their UUID.

2.  Next perform a FUSE mount of the virtual disk image:

Create a folder as a mount point. In this case let's use vboxdisc:

mkdir vboxdisc

Then enter the following command:

vboximg-mount -i UUID -o allow_root vboxdisc

NOTE: (remember to replace the UUID with your own in the above command): 

NOTE: You might need to edit the “/etc/fuse.conf” to allow the -o allow_root flag to work. To do this run the command sudo gedit /etc/fuse.conf and enable, by remove # at it's beginning, “user_allow_other” line.

3.  Now mount your partition (vol2 for instance) to /mnt by typing the following command:

sudo mount vboxdisc/vol2 /mnt

NOTE: change vol2 to match your partition name.

4.  Finally go to the /mnt directory to see your Guest OS files.


*************************************************************

Remember to UN-MOUNT once your finished accessing the Guest OS files.


How to Unmount:

To unmount the VirtualBox Guest OS file system, run the following command:

sudo umount /mnt

To unmount the VirtualBox Disk Image, run the following command:

umount ~/vboxdisc

And finally to remove ~/vboxdisc  folder run the following command:

rm -r ~/vboxdisc

Tuesday, May 11, 2021

Useful TERMINAL Commands

I will try to keep updating this post with useful Terminal shortcuts and commands I find helpful.  So bookmark this one and leave any commands you think should be added in the comments and I'll move them to the main post.

Don't get writers block at the Terminal Window


sudo !!

This runs the last command you typed but runs it as sudo.  If you typed a long command and forgot to start it with sudo or didn't know you needed sudo, instead of retyping the whole thing or using UP ARROW to paste the command back in, just type sudo!! and hit ENTER.  This will add the sudo and re-run the command as soon as you press the ENTER key.


CTRL x e

To use this just hold the CTRL key, press x, then press e while still holding down the CTRL key.  This will open the nano text editor where you can type out whatever commands you want to run in Terminal even multi lines.  Think of it as a one use bash script file. When you exit nano your typed in commands will then run in your open Terminal window.


ls -h --group-directories-first --color=auto

This command displays a directory list in colors and puts folders first, organizing them in ascending alphabetical order. Following the folders are the files in said directory also listed in ascending alphabetical order.  It's a little long so you may want to open a text editor and save it as a bash script, that's what I did, so now I can just type l (lower case L) in my terminal and a nice colored, folder first, directory list appears.  HERE is a quick guide on how to write a bash script, make it executable, and add it's folder to your PATH.  The only thing I notice that this tutorial didn't say was you SAVE your script file as a .sh files in a folder that is in your PATH.


mv FileName.txt NewFileName.txt

To RENAME a file you use the command mv for some reason. Simple repalce FileName.txt with the file name you want to rename and replace NewFileName.txt with the name you want the file to have. The mv command also functions as a MOVE command too. To use it as a MOVE command just add a destination directory path in front of the NewFileName.txt part. i.e.


mv FileName.txt /home/UserName/Documents/NewFileName.txt

This will move the FileName.txt to /home/UserName/Documents/ directory and rename the file to NewFileName.txt if you don't want to rename the file and just want to move it, then just make the file name the same as it was (mv FileName.txt /home/UserName/Documents/FileName.txt)


Some simple commands I forget:

  • ~  is a shortcut or substitution for the directory /home/userName/  think of it as the root of your home directory.

  • cp FileName.txt ~/Documents/ This copies FileName.txt to the Documents folder in your home directory. cp FileName.txt ~/Documents/NewFileName.txt would copy and rename FileName.txt  to NewFileName.txt and put it in your Documents folder.

  • find . -name "*.bak" -type f -delete  This deletes all files with the .bak extension in your current directory and in all sub-directories below your current directory. BEFORE USING THIS YOU SHOULD RUN  find . -name "*.bak" -type f TO SEE THE LIST OF ALL FILES YOU WILL BE DELETING.  USE WITH CAUTION.

  • rm -r DirectoryName This will remove a directory and everything below it.  This is a recursive delete of a directory or directories and all their files. USE WITH CAUTION. 

  • rmdir dir1 is a safer command that will remove empty directories but will give you an error if dir1 has files or sub-directories in it.  This command deletes the empty directory called dir1 .



chmod options permissions file_name
   
   Examples

  • chmod u=rwx,g=rx,o=r myfile.txt
  • chmod 754 myfile.txt
  • chmod -R 755 /PATH/TO/DIRECTORY

In the first Example above;

The Current User(u=) can read(r), write(w) and execute(x) myfile.txt 
Members of Current User's Group(g=) can read(r) and execute(x) myfile.txt
Others(o=) may only read(r) the file myfile.txt


If you wanted to, you could add r,w and/or x 's to the g= or o= part of that command or take away either r, w, or x from the u= part of that example, BUT YOU SHOULDN'T.  Very, very, rarely do want to give USER, GROUP and OTHERS all permission or take all permission away for all.  With the wrong combinations of r,w, and/or x you could easily lock yourself and everyone else out of access to a file by not giving enough permission to the file or cause security risks by giving too many permissions to your files.  The above example is the most common permissions you will find on user's files (home directories or additional hard drives storage space).  The System Files are another matter and you should read a more in depth article before playing with those permissions.

In the second Example above;
This means the exact same thing as the first example, it's just 
using octal permissions notation.  Here is how it works;

The first position of the 3 digit number, represents the user(u=), the 2nd digit position represents the group(g=), the 3rd digit position represents others(o=).  The actual numbers in those positions are derived from the following table;

4 stands for "read"
2 stands for "write"
1 stands for "execute"
0 stands for "no permission."

By simply adding the above numbers together you will get a single digit number that will represent the permissions you want the User, Group and Others to have.  Lets say you want to give User full access (read, write and execute) and you want Group's to just have read access (read) and you want Others to have any write and read but not execution.  All you do is add; you want User to read (4) + write(2) + execute(1). Well that's 4+2+1=7.  So our first number is 7.  You want Group to have only read. Well that's just 4. So our second digit is 4.  You also want Others to have read and write, but no execute. Well that's read(4) + write(2). So it's 4 + 2 = 6.  Our last digit is 6.  You now have your three digit number, 746.  Your command to set those permissions on myfile.txt would be chmod 746 myfile.txt.  

In the third example above we uses an Option;

In the third example we want to change the permissions on all the files and folders and subfolders/subfiles in the directory located at /PATH/TO/DIRECTORY.  This is called a Recursive Change. So if we run the command chmod -R 777 Documents from our Home directory, this would change the permissions of every files, folder, subfolder, and subfiles in the Documents directory allowing everyone full unrestricted access to everything contained in the Documents directory (Not a good Idea BTW).  When using the -R option with chmod you should check all the subfolders and subfiles you'll be changing.  You can use chmod in combination with find for a more selective recursive like change (see chmod Helper Commands below). 
Of special note on options, chmod -r 777 Documents means something completely different from chmod -R 777 Documents  CASE MATTERS -R means Recursive, -r means take away read permissions

Options for chmod

-c, --changes Like --verbose, but gives verbose output only when a change is actually made.
-f, --silent, --quiet Quiet mode; suppress most error messages.
-v, --verbose Verbose mode; output a diagnostic message for every file processed.
--no-preserve-root Do not treat '/' (the root directory) in any special way, which is the default setting.
--preserve-root Do not operate recursively on '/'.
--reference=RFILE Set permissions to match those of file RFILE, ignoring any specified MODE.
-R, --recursive Change files and directories recursively.
--help Display a help message and exit.
--version Output version information and exit.

chmod Helper Commands;

ls -l myfile.txt  
Show a single file called myfile.txt and displays its permissions. Here is what that output will look like;

-rwx-rw-r-- 1 UserName GroupName 2441 May 27  2022 myfile.txt

This mean that the UserName has read(r), write(w), and execute(x) permissions and the group called GroupName has read(r) and write(w) permissions, no execute. And Others have read(r) only permission, no write, no execute. (it also says the file is 2441 bytes in size and was created on May 27, 2022)

ls -l  
This will list all the files in your current directory and show you their permissions. This an easy way to the permissions from a bunch of files all at once.

find . -name "*.sh" -exec chmod +x {} \; 
This example will make all .sh files in the current directory executable.

sudo chown -R UserName:UserGroup DirectoryToOwn
The chown command  above changes the Ownership of every file, subdirectory, and subfile in the directory DirectoryToOwn to be owned by the user UserName and by the group UserGroup.  Most of the time UserName and UserGroup are the same. No space before or after the colon (:).  Leave out the -R and replace DirectoryToOwn with a single file name to just assign ownership of a single file or combine chown with find command (above) for a selective group of files. 

sudo blkid
This list all of your hard drive or other mounted drives (flash, etc..) on your system.  You can use this command to find the uuid of a hard drive or flash drive to use in your fstab file for auto-mounting drives on system boot.



sudo dmidecode --type 17
Want to know what kind of memory is in your system?  This handy command will tell you way more information than you'll ever want.  I need to know my manufactures name and this command returned that information under the TYPE heading.


Thursday, April 15, 2021

HDMI Audio not showing as an option

Ran a update today (4-15-2021) on my Ubuntu 20.04.1.  The update asked for a reset and I think I saw something about kernel 5.4 before the update started (after the update my kernel is 5.4.0-72-generic according to the uname -r command).  

After the reboot I had no audio (I use the HDMI Output to my monitors built-in speakers).  I checked my Sound Setting as some kernel updates in the past have flipped my sound output to Digital Output Built-in Sound.  I checked and sure enough it was flipped.  When I went to change it back there was only one sound output option (Digital Output Built-in), no HDMI to be found.  After some Googling I found this solution that worked for me:

Step 1

Open a terminal and run the following command:

pulseaudio -k

This kills the running sound process

Step 2

Physically unconnect then reconnect your monitor from the HDMI port while Ubuntu is running.

Step 3

Open Sound Settings and you should see the option of HDMI in the Output tab:


Hopefully this written howto will help someone who loses their sound after an update.  When Googling for help on this problem I ran across several videos with solutions but without sound they were not very helpful. 


Saturday, March 20, 2021

Fix Graphic Glitches in Windows 10 running in VirtualBox 6.1

 I was having weird graphical glitches on my guest Windows 10 running in VirtualBox 6.1.18 on an Ubuntu 20.04 host.  Some of the glitches I was seeing were multiple cursors in Photoshop cs6, some menu's needed minimized to see items I checked, show checked (refresh), and some transparency problems (again tied to a screen refresh).  None of these broke the system or caused crashes but were annoying, especially the Photoshop multiple cursor thing.

I noticed that I did NOT have ENABLE 3D ACCELERATION checked on my Virtualbox host. I figured that this might be causing my problems so I checked it.


The multiple cursors magically went away but my transparency and screen refresh problems multiplied exponentially.   Just to use the virtual, I went into my Windows 10 (guest) then to SETTING and turned off TRANSPARENCY EFFECTS in the Windows 10 guest(see screen shot below).  Once I did that everything worked flawlessly.


I've decided that I do not need or even want the transparency effects in Windows 10.  And by Enabling 3D Acceleration on my VirtualBox host for the Windows 10 guest, some programs that had some 3d effects disable are now working.  Win! Win! (minus Windows 10 transparency) 

Saturday, January 16, 2021

Wine 6.0 installing on Ubuntu 20.04

Wine 6.0 has been released as the newest stable build.  You can read about it at winehq.org.  I use Wine to run a couple of MS Windows programs that I haven't found good Linux replacements for (Photoshop and Omniforms,  I know GIMP is a good Photoshop replacement but I'm used to Photoshop and the workflow is not the same, besides I haven't taken the time to learn GIMP)...Anyway, let's install Wine 6.0 on Ubuntu 20.04 LTS (or 20.10 noting the difference in step 3).

Open a Terminal Window and type the following commands:

1.  Enable 32-bit support on your system.

     sudo dpkg --add-architecture i386 

2.  Add the Wine keys to your system.

    wget -nc https://dl.winehq.org/wine-builds/winehq.key

    sudo apt-key add winehq.key

3. Add the repository for Ubuntu 20.04 (only run one of these commands)

IF YOU'RE RUNNING 20.04

    sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'

IF YOU'RE RUNNING 20.10

    sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ groovy main'

4. Install Wine 6.0

    sudo apt install --install-recommends winehq-stable

If you want to check your Wine Version just type the following in a Terminal Window;

    wine --version


That's it you're done.

*NOTES: When I ran Photoshop after the update, Wine asked to install a couple of items it needed to work.  I just clicked on the yes button.  On step 1, I had already enabled this but running the command again did not hurt anything.