Archive

Archive for the ‘ubuntu’ Category

shopt: change additional shell optional behavior

November 22, 2014 1 comment

There is a command called shopt that allows you to change additional shell optional behavior.

I use both Ubuntu and Manjaro and I noticed that sometimes bash behaved differently on Manjaro. For instance, I had a folder called “Test_me”. Once accidentally I wrote “cd test_me” and Manjaro entered the folder “Test_me” (notice the capital ‘T’) without any problem. Under Ubuntu it was impossible :)

As it turned out, the different behaviour is due to different shopt settings. In the example above, “cdspell” was on in Manjaro, while in Ubuntu it was off by default.

Since I use both systems and I want bash to behave similarly, I added these lines to the end of my ~/.bashrc:

# shopt settings (normalize Ubuntu and Manjaro)
shopt -s cdspell
shopt -s dotglob
shopt -s hostcomplete
shopt -s nocaseglob
shopt -u sourcepath

I switched “sourcepath” off. Read this post if you want to know why.

Categories: bash, manjaro, ubuntu Tags: ,

detect easily if your machine is frozen

October 6, 2014 Leave a comment

Problem
Very rarely my system gets frozen. But is it just my keyboard and mouse that have problems? Or is my whole machine frozen? Or is it just temporary and everything will be normal in a few seconds?

Solution
I have an easy solution to detect if the whole system is frozen. In the top right corner you have a clock, right? Well, add seconds too :) If the seconds are stuck, there is a problem. If they are moving, there is still hope.

clock

Update (20141014)
Yesterday my machine got frozen quite interestingly. I got an email with a youtube link that I wanted to play in Gmail. The machine got frozen, i.e. the mouse/keyboard had no effect and the clock didn’t move BUT the audio of the video was rolling :) I could do nothing but listen to it. At the end I had to restart the machine manually. Lesson learned: even if the clock is stuck, it doesn’t mean that your machine is completely frozen. (I guess this all happened because of Flash).

Categories: ubuntu Tags: ,

Firefox is started automatically but it looks corrupted

September 28, 2014 Leave a comment

Problem
On my home desktop I have autologin enabled, i.e. I don’t need to log in manually. Since I always need a terminal and a browser, “konsole” and “firefox” are started automatically. So I just switch on my machine and when I come back 5 minutes later, I’m ready to work.

However, sometimes Firefox doesn’t start normally. It looks strange: some colors are replaced with a different one, fonts are different, tooltips on tabs are plain black (text in tooltips is not visible), etc. If I restart Firefox, it becomes OK. I’m not sure what causes this problem, but my guess is that Firefox is started too quickly. I think it would require some libraries that are not yet loaded when Firefox is started. Then these pieces of software are loaded, that’s why Firefox gets OK after a restart.

Solution
The solution is simple. Don’t start Firefox immediately after the login. Wait some time until everything else is loaded, and start it after. Of course, we still want to start Firefox automatically, not manually. So we need a simple script:

#!/usr/bin/env bash

# /home/jabba/bin/start_firefox.sh
sleep 60    # Wait 60 seconds. You can play with this value.
/usr/bin/firefox &

Then in the Startup Applications, remove “firefox” and add this script instead. Provide the absolute path of the script. Make sure it’s executable. Here is a screenshot of the applications that are started automatically on my machine:

start_firefox

Categories: firefox, ubuntu

Launch gedit in the background

September 11, 2014 1 comment

Problem
Sometimes I use gedit but it is launched in the foreground, blocking my terminal. There are two ways to put it in the background: (1) Press CTRL+Z in the terminal, then send the job to the background with the command bg, or (2) launch gedit directly in the background with the “&” sign.

Neither of them is convenient. I often forget about it and I always end up in a blocked terminal. I just simply want to write “gedit” or “gedit ehh.txt“, and I want it to start in the background.

Solution
Create a script called “gedit” in your $HOME/bin directory with the following content:

/usr/bin/gedit "$@" &

Make it executable and make sure the directory $HOME/bin is in your PATH.

Categories: bash, ubuntu Tags: ,

Windows 8.1 with Linux

September 4, 2014 Leave a comment

I got a new laptop at my workplace, a Toshiba Satellite C55. I decided to put Windows 8.1 and Ubuntu 14.04 LTS on it.

Installation
I had a Windows 8.1 ISO but I didn’t want to burn it on a DVD. Instead, I put it on a USB stick. I found an excellent tool called Rufus that allows you to create a bootable USB stick from an ISO file. Here is a youtube video tutorial too.

When Windows 8.1 was installed, the next step was to install Ubuntu. Restarting Windows is tricky if you want to change the boot order: hold down the SHIFT key and select reboot while pressing the SHIFT. Upon reboot I had to press F12 to get to the boot order menu.

Installation of Ubuntu went flawlessly.

NTFS partitions cannot be mounted
Once I had a strange problem. Ubuntu started to complain that it cannot mount the Windows partitions. It turned out that Windows was hibernated and thus the NTFS paprtitions cannot be mounted in read/write mode. But why is it hibernated when I restarted Windows?

Well, another “cool feature” of Windows 8.1 is that you can power it off / restart it in two different ways! Option 1: right click on the Windows button in the bottom left corner and select halt / restart. This will do some hibernation, thus the next boot will be faster. Option 2: move the mouse to the bottom right corner, wait for the tiles to show up and halt / restart the machine there. It is a normal power off / reboot without any hidden hibernation.

So, if you use Linux with Windows 8.1 in dual boot, you’d better stop / restart Windows using Option 2 (on the right side).

my current Ubuntu wallpaper

July 11, 2014 Leave a comment

broken_windows-wallpaper-1920x1080

Categories: fun, ubuntu, windows Tags:

machine shuts down, then restarts in a few seconds

July 11, 2014 Leave a comment

Problem
My new desktop machine has a strange behaviour. It shuts down normally, but after a few seconds it restarts automatically.

Solution
I found the solution here. In short:

Edit the file “/etc/default/grub” and modify this line:

GRUB_CMDLINE_LINUX_DEFAULT="acpi=noirq quiet splash"

The new thing is the “acpi=noirq” part. Don’t forget to run “sudo update-grub” at the end.

It solved the problem but when I hit the SPACE button on the keyboard, the machine wakes up as if I had pressed the power button. Strange, but maybe it’s normal for new machines.

Categories: ubuntu Tags: , ,
Follow

Get every new post delivered to your Inbox.

Join 73 other followers