Google Ads

Linux and Software: News, Reviews, Tutorials

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

December 16, 2017

Ubuntu improve WIFI performance and reliability

If you need a stable internet connection through WIFI then it is important that WIFI performance remains consistent and WIFI connection is reliable at any given time. This is vital if you are running any kind of server or using torrents. Unfortunately, the power management feature exists for different devices within Ubuntu promotes unstable and slow WIFI connection which is enabled by default for WIFI devices. This creates problems such as automatic turning of WIFI and loosing of WIFI connectivity randomly while the system stays idle for a while or there is no inbound packets coming to your system. To check whether you have power management active for your WIFI device execute the following command into the terminal:

iwconfig | grep -w "Power Management"

Now if it is active then you can easily turn it off by executing following command:

sudo iwconfig wlan0 power off

Where you have to replace wlan0 word with your WIFI device name which can be found by executing following command:

ifconfig -a

The above command will list all the network devices present in the system including WIFI devices. If the terminal says that command not found then install the program by installing the package net-tools. To do that, execute the following in the terminal:

sudo apt-get install net-tools

Now to make this setting persistent between the boots you can do several things. First, make changes to the /etc/pm/config.d/blacklist file. To do that, in the terminal execute the following to open the file:

sudo gedit /etc/pm/config.d/blacklist

Add the following line in the /etc/pm/config.d/blacklist file:

HOOK_BLACKLIST="wireless"

Second, make changes to the /etc/pm/power.d/wifi_pwr_off file. To do that, in the terminal execute the following to open the file:

sudo gedit /etc/pm/power.d/wifi_pwr_off

Now add the following lines in the /etc/pm/power.d/wifi_pwr_off file:

#!/bin/sh 
/sbin/iwconfig wlan0 power off


Do not forget to replace the word wlan0 with your WIFI device name and save the file. Now, execute the following command it make the file executable upon every boot:

sudo chmod +x /etc/pm/power.d/wifi_pwr_off

Third, make changes to the /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf file. To do that, in the terminal execute the following to open the file:

sudo gedit /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

Now in the /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf file, replace wifi.powersave = 3 with wifi.powersave = 2 and save the file.

That is it!

Cheers!
Imam

February 22, 2017

Linux .desktop file run a executable file from the same directory

Desktop files in GNU/Linux define shortcuts for conveniently launching installed applications in the system from system menus and file managers. They can be found in many different places such as in /usr/share/applications directory for system wide applications and in ~/.local/share/applications for user applications. These files can be opened in any text editor program to edit application executable file names or for adding new options to application executables. A typical desktop file may look like below:
[Desktop Entry]
Name=Install
GenericName=Package Installer
Comment=Copy package files to your system
Exec=Install.sh
Terminal=false
Type=Application
Encoding=UTF-8
Each key and value pair defines different attributes of the application launcher. For example the Name key assigns a name for the application launcher which would appear in the system menus and file managers. The most important key is Exec which tells the name of the application executable file. The value of the Exec key can be either just the application executable file name or absolute address of the application executable file like shown below:

Exec=App.sh

Or

Exec=/opt/ApplicationX/App.sh

However, sometimes it is preferable to tell Exec key that the application executable file is located in the same directory as the desktop file. This can be easily achieved with the %k code which is available to the Exec key. The %k code in the Exec key value gives us the absolute location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is known. Now, to run a application executable in the same directory as desktop file, Exec key can have the following value:

Exec=xdg-open "%k"/App.sh


The above Exec key value also ensures portability across different GNU/Linux distributions and can be used for many different application scenarios such as shipping portable application packages.

That's all for today.

Cheers!
Imam