Linux

Oh My Zsh!

2015-07-01 Linux No comments

If you are Unix user and don’t use Oh My Zsh, you should definitely start. Oh My Zsh is a framework for Zsh, the Z shell.
It has many plugins and great community. Actually, it’s enhanced and more intelligent terminal. I find it very useful while working with Git. It’s much more comfortable than via default Ubuntu shell. In addition, you can customize its look & feel. My favorite theme is minimal. It’s just a piece of functionality of this tool, you can discover much more by yourself.

daveverwer

You can install Zsh in the following way:

$ sudo apt-get install zsh

To set it as your default shell type:

chsh -s /usr/bin/zsh

Now, you can install Oh My Zsh via the following command:

$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

Project is open-source. You can find it on GitHub: https://github.com/robbyrussell/oh-my-zsh.
Visit official website at: http://ohmyz.sh/.

Automation of basic software installation on Ubuntu

2015-06-30 Linux, Ubuntu No comments

Recently, I had to re-install my system again and I didn’t want to go again through manual installation of software I use daily. Due to this fact, I decided to create shell script, which will download, install & configure software for me. It can be executed right after installing Ubuntu. Please remember, this applies to my configuration and may be not appropriate for yours (e.g. drivers for wireless Logitech headset). This script won’t install IDEs & editors like: Android Studio, IntelliJ IDE, Pycharm and Atom. You can download them manually from their websites. I realize, not everything is automated and we will have to confirm a few installations manually. Moreover, script won’t do everything I need. Nevertheless, it performs a lot of work for me and in case of system re-installation I can re-use this solution.
If you want to know more about software installed with this script, browse Linux & Ubuntu categories on this blog.

You can run the script with the following command:

$ curl -L https://gist.githubusercontent.com/pwittchen/1a6abe83cb7067d66f1c/raw/337564c6fd4e36d2ee372c5bce53bafeab162d62/install-stuff.sh | sh

Mutate – yet another Spotlight for Ubuntu

2015-04-06 Linux, Ubuntu No comments

Overview

Some time ago, I published post about Synapse indicator, which is an alternative to MAC’s Spotlight for Ubuntu. Recently, I’ve found another software, which is in my opinion even better than Synapse. It’s called Mutate. I like it, because it works quite smooth, looks simple and clean. In addition, it’s open-source.

mutate-1

Installation

We can install it with the following commands:

sudo add-apt-repository ppa:mutate/ppa
sudo apt-get update
sudo apt-get install mutate

Configuration

After installation, we can run Mutate from Ubuntu dashboard or via default hot-key CTRL+D and type preference.

mutate-7

After that, we can configure default hot-key for muate. E.g. CTRL+Space as on the screen below or another hot-key, which we prefer.

mutate-8

This configuration is saved in ~/.config/Mutate/config.ini file and we can edit it manually. Manual editing is, in my opinion, more convenient, because GUI of Mutate preferences seems to be buggy and config.ini file is quite readable. After editing of the file, changes are available in Mutate immediately without any reboot. We can also add more shortcuts and create our own python or shell scripts in ~/.config/Mutate/scripts/ directory or create references to scripts in other places.

References

Making Ubuntu and Unity faster

2015-03-28 Linux, Ubuntu No comments

Unity desktop environment consumes lot of computer’s memory. I’ve recently found good article about
4 simple tweaks to improve Unity performance on Ubuntu.

Here is the short summary of that tweaks:

Remove Unwanted Lenses

It will speed up loading data under “Super” button.

sudo apt-get autoremove unity-lens-music unity-lens-photos unity-lens-gwibber unity-lens-shopping unity-lens-video

Install Compiz Config Settings Manager

sudo apt-get install compizconfig-settings-manager

In Compiz Config Settings Manager perform the following operations:

  • Disable Animations and Fading windows
  • Set the Texture Filter to “Fast”

After that OS won’t use additional resources for performing animations.

Install Preload

sudo apt-get install preload

Preload analyzes applications, which are currently used and predicts, which applications might be used. After proper analysis, it loads to memory commonly used software. That process can drastically boost speed of loading programs and overall Ubuntu performance.

Adjusting Look & Feel of IntelliJ IDEA and Android Studio on Ubuntu

2015-03-28 Linux, Tools, Ubuntu 1 comment

Introduction

In contrast to MS Windows, default installation of IntelliJ IDEA, Android Studio and other JetBrains IDEs, in my opinion, doesn’t look good in Ubuntu with Unity. Unfortunately, adjusting look of my favorite IDE is a common problem right now and it was reported to JetBrains issue tracker. Luckily, we can perform a few tweaks, to improve its look & feel ourselves.

Enabling HUD

Some Java applications don’t have Head Up Display (HUD) enabled by default. The same problem occurs in IntelliJ IDEA. I’ve described that in article about software for common users on Ubuntu. HUD is characteristic element for Unity environment and it’s similar to Apple OS X. I think, it’s useful and allows to have more space on the screen. In addition, I wanted my IDE to behave in the same way as other applications. In order to enable HUD, we have to install additional software:

sudo add-apt-repository ppa:danjaredg/jayatana
sudo apt-get update
sudo apt-get install jayatana

Hint: We can skip this step if we’re using different Windows Manager than Unity (e.g. Gnome).

Font fix

IntelliJ IDEA has problem with font anti-aliasing on Ubuntu. In order to resolve that problem, we need to install Font Fix for Open JDK.

sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix
sudo apt-get update
sudo apt-get install openjdk-7-jdk

Preparing run script

To finalize font fixing process, we need to prepare additional shell script, place it in the bin/ directory with the IDE and run IntelliJ IDEA with that script. Below, I present source of my scripts for IntelliJ IDEA and Android Studio. We can create scripts for other JetBrains IDEs (e.g. PyCharm) in the same way.

run-idea.sh

#!/bin/sh
# change to your location
IDEA_HOME=/home/piotr/Development/java/idea-ce
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

# Note: Can modify $IDEA_HOME/bin/idea{,64}.vmoptions
# instead of setting here.
# "-Dawt.useSystemAAFontSettings=on" seems worse to me
# "-Dsun.java2d.xrender=true" makes fonts darker
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=lcd \
                      -Dsun.java2d.xrender=true \
                      -Dswing.aatext=true \
		      -Dsun.java2d.pmoffscreen=false"
# Having this set makes menu font size smaller (wtf?)
export GNOME_DESKTOP_SESSION_ID=this-is-deprecated
# unset GNOME_DESKTOP_SESSION_ID
exec $IDEA_HOME/bin/idea.sh "$@" 

run-studio.sh

#!/bin/sh
# change to your location
ANDROID_STUDIO_HOME=/home/piotr/Development/android/android-studio
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

# Note: Can modify $ANDROID_STUDIO_HOME/bin/studio{,64}.vmoptions
# instead of setting here.
# "-Dawt.useSystemAAFontSettings=on" seems worse to me
# "-Dsun.java2d.xrender=true" makes fonts darker
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=lcd \
                      -Dsun.java2d.xrender=true \
                      -Dswing.aatext=true \
		      -Dsun.java2d.pmoffscreen=false"
# Having this set makes menu font size smaller (wtf?)
export GNOME_DESKTOP_SESSION_ID=this-is-deprecated
# unset GNOME_DESKTOP_SESSION_ID
exec $ANDROID_STUDIO_HOME/bin/studio.sh "$@" 

Configuring fonts & appearance

I wasn’t satisfied by default font configuration of IntelliJ IDEA and Android Studio, so I updated it a little. In my opinion, it looks better after such operation. You can see my configuration on the screenshots below. Screenshots are from Android Studio, but configuration can be the same for all JetBrains IDEs. Of course, I also prefer Darcula theme.

android_studio_font_01

android_studio_font_02

Finishing configuration & system reboot

When we performed all of the tasks mentioned in the steps above, we need to perform reboot of the system. After that, our IDE and its fonts should look fine. That’s it. I hope it will be helpful for you.

Synapse Indicator – Spotlight for Ubuntu

2014-12-27 Linux, Ubuntu 3 comments

Introduction

If you were using Ubuntu for some time, you might have noticed that Ubuntu Dash from Unity is working quite slow. We can disable on-line search or a few other elements, but it’s still very slow. If we want to have fast search, we can use external software like synapse.

Synapse

Synapse is searching really fast and we don’t have to wait a few seconds like in Ubuntu Dash or disable some search options.

synapse

Synapse can be installed with the following commands:

sudo add-apt-repository ppa:synapse-core/ppa
sudo apt-get update
sudo apt-get install synapse

After installing it, in Synapse Preferences we can set appropriate shortcut for opening Synapse.

Synapse Indicator

If we want to have “Mac OS-like” experience, we can use Synapse Indicator which is similar to Spotlight from OS provided by Apple.

spotlightsynapse

Synapse Indicator (AKA indicator-synapse) can be installed with the following commands:

sudo add-apt-repository ppa:noobslab/apps
sudo apt-get update
sudo apt-get install indicator-synapse

Drawback of Synapse Indicator is the fact that it does not have shortcut for search. We can set it by doing some “hack” described at Nerd Answer page.

Adding keyboard shortcut for Synapse Indicator (hack)

Step 1: Install xdtool.

sudo apt-get install xdotool

Step 2: Move your mouse over the synapse icon and get mouse location

xdotool getmouselocation

You should get output like this:

x:1568 y:9 screen:0 window:62914568

Step 3: Add keyboard shortcut for indicator

Go to System Settings -> Keyboard -> Shortcuts -> Custom Shortcuts.

Click add and for the command type (replace x and y with the ones from the previous command):

xdotool mousemove <x> <y> click 1 mousemove restore

Then add the shortcut you want.

It’s not pretty and elegant way, but I don’t know any other solution. If you know, how to do it better, leave a comment, below this article.

Additional note

Please remember that if you change your screen resolution or switch between two screens (e.g. laptop screen and external, bigger screen), your mouse click coordinates will have to be updated in the shortcut.

How to switch Java version on Linux?

2014-11-02 Java, Linux No comments

Sometimes we need to run specific program with a concrete version of JVM. We can also work with Java 7, but we want to try Java 8. In such cases, we can have installed both Java 7 and 8 on our system and easily switch between them.

In order to show current java version, we can simply type: java -version in terminal.
On my computer I received the following response:

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

We can see that I am using Java 8. If we want to switch to Java 7, we can use the following command:
sudo update-alternatives --config java

I am using Polish lanugage version of Ubuntu, so I received response, which you can see below.
If you are using another language version, you will see messages in your language.

Są 3 dostępne alternatywy dla java (dostarczające /usr/bin/java).

  Wybór       Ścieżka                                       Priorytet  Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-oracle/jre/bin/java          1075      tryb auto
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      tryb ręczny
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1074      tryb ręczny
* 3            /usr/lib/jvm/java-8-oracle/jre/bin/java          1075      tryb ręczny

Proszę wcisnąć Enter, aby pozostawić bieżący wybór[*]; albo wpisać wybrany numer:

Basically, we can just type number of a concrete version of JVM and press Enter. Currently, I have Oracle Java 7, Oracle Java 8 and Open JDK 7 installed in the system. When we type 2, we will switch to Java 7. After that, when we type: java -version, we will see the following message:

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)

If we want to switch back to Java 8, we can do it in the same way.

Indicators for Ubuntu

2014-09-07 Linux, Ubuntu No comments

I recently found an article about Best Useful Indicators Collection for Ubuntu. Indicators are very useful feature of the Ubuntu and Unity. Ubuntu has some default indicators, but we can add new indicators if we want to. Mentioned article contains list of many indicators, but personally I prefer and use only a few of them.

Here are my favorites:

ubuntu_indicators

Multi Load indicator

Nice thing. This indicator monitors system resources. E.g. usage of the processor, RAM, disk and network. We can customize it and set refresh interval. I found default low interval like 500 ms very disturbing, so I changed it to 5000 ms and it’s ok for me. In the screenshot above, you can see blue chart for CPU usage, green chart for RAM usage and yellow chart for network usage. You can change, configure and customize it as you want.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:indicator-multiload/stable-daily
sudo apt-get update
sudo apt-get install indicator-multiload

System Monitor indicator

Useful indicator, which allows you to monitor temperature of your hardware components. It can monitor only those components, which have appropriate sensors. In my case I can monitor only CPU, but it is possible to monitor temperature of some GPUs and disks. If you don’t want to overheat your processor, you should use such indicator. Of course, check specifications of your processor, its maximum and common temperature. Sometimes, it’s necessary to clean computer inside or buy cooling stand in order to decrease CPU temperature.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:noobslab/indicators
sudo apt-get update
sudo apt-get install indicator-sysmonitor

Indicator Sensors

Indicator Sensors allows you to display temperature of your hardware sensors like CPU. In addition, you can set an alarm for situation where temperature of your hardware will exceed given value.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:alexmurray/indicator-sensors
sudo apt-get update
sudo apt-get install indicator-sensors

My Weather indicator

Indicator, which allows you to monitor current state of the weather. It can also display weather forecast for your city and display very detailed information about weather conditions.

Indicator can be installed by the following terminal commands:
sudo add-apt-repository ppa:atareao/atareao
sudo apt-get update
sudo apt-get install my-weather-indicator

Software for common users on Ubuntu

2014-08-18 Linux, Ubuntu No comments

In this article, I’ll describe Ubuntu software for common users, which I personally use and which could be helpful on daily basis.
Ubuntu software dedicated to programmers AKA developers will be described in separate article.

Chrome

In my opinion, it’s currently the best web browser. We can download, unpack and install it, with the `owing commands:

sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb

Skype

Maybe it’s not the best, but one of the most known messengers and lot of people use it. In addition, at my work people currently use it as a common messenger. We can download and install it with the following commands (first command adds new software repository, from which Skype can be downloaded):

sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype

Spotify

After I started using Spotify, I stopped keeping all my mp3s on the hard drive. Of course, it has pros and cons, but for now I think that Spotify is good choice for people who like to listen to the music quite often. In addition, premium version is quite cheap. We can download and install Linux version of the Spotify with the following commands:

sudo sh -c 'echo "deb http://repository.spotify.com/ stable non-free" > /etc/apt/sources.list.d/spotify.list'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59
sudo apt-get update
sudo apt-get install spotify-client

Disabling notifications after starting new song
Notifications, which appears after starting new song are enabled by default. They are annoying for me, so I decided to turn them off.

I’ve edited file: ~/.config/spotify/Users/[Spotify user name]/prefs
and set ui.track_notifications_enabled=false. After that, I restarted Spotify and notifications disappeared.

Dropbox

Dropbox is great software. I often use it to backup my files and when I want to access specific files on different devices. We can install it with the following command:

cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

After installing, we can launch Dropbox with the following command:

~/.dropbox-dist/dropboxd

We can execute the following command to run Dropbox in the background even if we close terminal:

nohup ~/.dropbox-dist/dropboxd

Unfortunately, Dropbox is not launched on autostart after rebooting computer, so I installed additional software, which runs Dropbox in the background on startup and displays indicator icon. I just typed the following commands:

sudo apt-get install libappindicator1
sudo apt-get install nautilus-dropbox

Deluge

Deluge is lightweight torrent client similar to uTorrent and BitTorrent. We can install it by typing the following command:

sudo apt-get install deluge

Transmission

Yet another light torrent client. Install it with:

sudo apt-get install transmission

Java

Many programs are written in Java, so if we want to use them, we have to have Java Virtual Machine installed on the system.
Using Oracle Java 7 is not formally supported by Ubuntu. There’s plenty solutions for installing it, listed on https://help.ubuntu.com/community/Java.

The simplest one listed is this one:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

It’ll keep your java 7 installation up to date.

To automatically set up the Java 7 environment variables JAVA_HOME and PATH:

sudo apt-get install oracle-java7-set-default

Enabling global menu (HUD) support in Swing applications

Some Java Swing applications do not support global menu (HUD) available in Unity environment enabled by default in Ubuntu.
This problem occurs often in applications for software developers like IntelliJ IDEA, Android Studio, PyCharm, Netbeans, etc. but it may also occur in any Swing application. We can enable this menu by installing jayatana in the following way:

sudo add-apt-repository ppa:danjaredg/jayatana
sudo apt-get update
sudo apt-get install jayatana

Source of this solution: http://www.webupd8.org/2014/02/get-unity-global-menu-hud-support-for.html

Wine

Wine is a software, which allows to run some MS Windows applications on Linux. For sure it works with Adobe Photoshop CS2. We can install it with the following command:

sudo apt-get install wine

Gthumb

Small and useful image browser and editor. Use the command below to install it.

sudo apt-get install gthumb

Pinta

Pinta is simple, lightweight image editor. We can install it with the following command:

sudo apt-get install pinta

Furious ISO Mount

Furious ISO Mount is application similar to Virtual Clone Drive or Daemon Tools available on Windows, which allows us to mount images of the CD into virtual drive. We can install it in the following way:

sudo apt-get install furiusisomount

Virtual Box

Virtual Box allows us to use virtual machines and install on them e.g. MS Windows 7, 8, different Linux distributions or any other operating system and use it in dedicated sandbox. We can install it with the following command:

sudo apt-get install virtualbox

Gedit

Gedit is simple, but very good text editor and a little bit enhanced notepad. It’s available on Ubuntu by default, but in case you don’t have it, use the following command to get it:

sudo apt-get install gedit

Clementine

Ubuntu has one music player installed by default. It’s called Rhythmbox. It looks ok, but it had problems with playing my mp3 files. Problem could be connected both with the drivers and this software. I decided to try another lightweight music player called Clementine. It’s small, configurable and works fine with my mp3s right after installing. Use the following command to download and install it:

sudo apt-get install clementine

VLC

VLC is one of the best video players for MS Windows and Linux. You should have it if you want to play your videos without problems.
Use the following command to install VLC:

sudo apt-get install vlc browser-plugin-vlc

Drivers for Logitech H760 Wireless Headset

I am using Logitech H760 Wireless Headset and it does not work on Ubuntu by default.
In order to bring it to work we have to install additional software in the following way:

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa
sudo apt-get update
sudo apt-get dist-upgrade -y

After connecting headset receiver, I had to change output of the sound and input of the microphone to my headset in system settings. Previously it was set to loud speakers. After switching back to loud speakers, I have to change output of the sound to speakers to hear sound in the speakers. It’s quite inconvenient, but I don’t know, how to automate it. In MS Windows it switches automatically without additional drivers or additional operations, so probably manufacturer should take care of this in case of Linux OS.

Something else?

I guess I listed most of the common Ubuntu software I use (besides of course Terminal, System Monitor and programming tools ;-). If you know any useful software, which wasn’t listed here, write about it in comments below this article. I would be happy to update this post.

Ubuntu system boot problem

2014-08-17 Linux, Ubuntu 4 comments

Description of the problem

Recently, after installing Linux Ubuntu 14.04 LTS on my computer, I encountered strange problem during the system boot. Before system launched, I received the following message:

After that, I typed: exit and system started normally, but this error occurred every time after reboot, so I decided to fix it.

Fixing the problem

Attempt #1

First, I tried to change rootdelay as error message said. I opened file /etc/default/grub
I found there the following line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
and changed it to:
GRUB_CMDLINE_LINUX_DEFAULT="rootdelay=90 quiet splash"
rootdelay became longer, but unfortunately it didn’t fix the problem in my case.

Attempt #2

I edited /etc/fstab file. I executed the following command in terminal: sudo gedit /etc/fstab and edited fstab file in gedit. In the beginning my file looked like that:

Then, I commented one line and added another one describing /dev/sda1 disk device. Now, my file looks as follows:

Problem still existed, so I tried another attempt to solve it.

Attempt #3

I opened terminal and typed the following command:

sudo grub-install /dev/sda

and then I typed another command to update grub:

sudo update-grub

After all of this, I rebooted computer and finally, error disappeared and problem was fixed!

Note #1

After removing rootdelay from the /etc/default/grub file, everything still works fine.

I was struggling with this error for some time, so I am very happy that I managed to fix it. I am a Linux n00b, so If you know any better or more efficient solutions to fix it, I will appreciate all of these.

Note #2

I’ve found another attempt (work-around) for this problem.
You can get rid of the described problem with the following commands.

sudo sed -i 's/maybe_break mount/sleep 5\nmaybe_break mount/g' /usr/share/initramfs-tools/init
sudo update-initramfs -u

For more details check this thread.