UBUNTU 16.04: How to Completely Reset Wifi Settings?

I was struggling with this Wifi issue for three days now and I almost gave up. But then a single command saved my ass! I was about to reinstall Ubuntu again. But I survived the frustration.

PROBLEM:

  • My Wifi was On but it was not lisiting any Wifi so that I can connect
  • I could surf internet via LAN Connection
  • The wifi status is enabled and I checked for available connection via terminal using this command: sudo nmcli conn  but didn't see any connection. 
  • Networking connectivity is full, I can check it via my terminal with this command:
    nmcli networking connectivity check
    full
  • I turned down all netowrk interfaces with ifdown  and upagain with ifup  but it didn't work
Today's blog is a quick solution to hard reset your Wifi Settings. As a quick note it is necessary to know that Linux based OS(Ubuntu in my case) saves its network lists i.e. all connections in this . location: /etc/NetworkManager/system-connections/ 
You can find all your Wifi connections ssid  listed inside this folder. Whenever you have issue with your wifi like case similar to mine, perform two steps:
  • Remove all system connections from the system-connection folder:
    sudo rm-f /etc/NetworkManager/system-connections/*
  • Then kill the signal which is running the process NetworkManager
    sudo pkill -9 NetworkManager -9 means SIGKILL to kill a signal that is ignoring or is hidden.
This remover all the connections, resets Network Manager, restarts your wifi connection. Now the issue is solved. You can connect to your wifi signal and browse the internet.

Wget: How To Scrap Any Website From Terminal?

Today I'm going to share you some easy but cool stuffs which I tried on my Linux Terminal. Today I downloaded this blog techjhola.com to my local machine with the help of command line tool "Wget".

Wget is a free utility for non-interactive download of files from the Web.  It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.  This allows you to start a retrieval and disconnect from the system, letting Wget finish the work.  By contrast, most of the Web browsers require constant user's presence, which can be a great hindrance when transferring a lot of data.

Today I will show you how I did the web scrapping of my website. Web Scrapping simply means downloading data from any online platform through automation of third party software. I've added a screenshot of the downloading activity created by wget. The command below looks kind of lengthy. The command I used is:
sudo wget --show-progress --progress=dot --verbose --recurseve --retryconnrefused -x --level=5 https://www.techjhola.com 

I'll now break the command and describe the use of each parameters used within a single command.

Basically to download a website it is okey to provide the default command wget www.sitename.com. But at the same time you should make sure if the download is on progress so you add the parameter: --show-progress.  So i used --show-progress command along with the dot displaying parameter --progress=dot. 
Now that a website will have different directories that it fetched tie file from so I added a --recursive parameter.  -x  is used such that I shouldn't bother about any restrictions and I can download the site forcefully. 
--retry-connrefused This is useful parameter which helps to continuously retry connecting to the website and establish a connection. 
Wget has this special parameter level,  which you shouldn't miss using wihle downloading a website which has many indepth urls within an article or a page.
Suppose you use --level=3,  than the download begins with the doamin i.e. www.techjhola.com ans it starts downloading all data of the domain. If it finds any content with a weblink then it downloads everything inside that weblink. Same is done till it reaches its final level i.e. 3.

There are huge bunch of parameters that you can implement while executing the command. To learn about the tool type man wget in your terminal.

Offline Wikiepdia in HeNN E-Library Project

There are more than 35 E-Libraries  setup in Nepal by Help Nepal Network which runs on Linux Machine(Edubuntu : Educational Distribution of Ubuntu). What we the volunteers from Kathmandu University Open Source Community have done is, we have download GBs of wikipedia from the High Bandwidth University Internet and added those contents to the E-Libraries. And the volunteers update the content of wikipedia every three months they visit the site for Monitoring.

How to Resolve Issue "UNABLE TO RESOLVE HOST HOSTNAME" in UBUNTU ?



Today's blog is about a simple issue you sometimes encounter after you rename your machine's hostname. 
Issue: 
[email protected]:~$ sudo cat /etc/hostnameUnable to resolve hostname xenialPlease enter your password:
This issue occurred to me just recently when I renamed my machine name from whoareyou to xenail.
Everytime I encountered this "Unable to resolve hostname xenial" issue

Earlier while I checked my hostname with command sudo cat /etc/hostname the result was xenial.
[email protected]:~$ sudo cat /etc/hostnamexenial

But the hostname was not listed inside /etc/hosts. I checked with command sudo cat /etc/hosts

[email protected]:~$ sudo cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 whoareyou
The exact reason for why the host xenail wasn't listed in hosts is yet unknown. But in order to resolve the issue I did this simple tweak.
I renamed the hostname xenial from /etc/hostname to whoareyou.  and restarted the machine. Then after the issue was no more encountered. As simple as it is.
#HAPPYBLOGGING 

Knowing Python Version from Terminal

In Linux it is hard to see the version of any software and module. So from terminal typing:
python -V shows the version of Python that the python command resolves to.
This one is one easy way to figure out python version you are currrently using, but there are other uniwue methods to know which Python version you are using through terminal. Type python in terminal & by default you will see this below:
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Here Python  2.7.6 is the version of your python.
In case  you tpye python 3.4 you will see:
Python 3.4.1 (default, Jul 31 2014, 12:46:17) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
In Ubuntu we can check the resolution with readlink -f $(which python). In default cases in 14.04 this will simply point to /usr/bin/python2.7.
We can chain this in to show the version of that version of Python:
 
$ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: "; % -V'
/usr/bin/python2.7: Python 2.7.6
But this is still only telling us what our current python resolution is. If we were in a Virtualenv (a common Python stack management system) python might resolve to a different version:
$ readlink -f $(which python) | xargs -I % sh -c 'echo -n "%: "; % -V'
/home/oli/venv/bin/python: Python 2.7.4

UBUNTU GUEST SESSION DISABLE


In case your laptop is never used by anobody else, then I see no use of Guest Session. Guest session is only necessary if you let other people to share your laptop. In my case I never let anyone to use my laptop, hence for me my user account is enough. So I removed the gurst session from my device.In order to remove the guest session, do following things in your terminal:
  • First open your terminal:  CTRL+ALT+T
  • Then type: sudo gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
  • In your text editor simply add this line of code allow-guest=false
Now save your configuration file, Close it and restart, this is what you will see:





Troubleshoot Network Manager, Apache, Wireless...

Today's Blog is all about networking stuffs and I will be covering following points:
  1. Know your Network Controller Device with lspci
  2. Display all interfaces which are currently available, even if down with ifconfig
  3. Enable the service networking 
  4. Enable Apache server
  5. Then Enable Network Manager with network-manager
  6. Then  Enable your WiFi with nmcli nm

AND REMEMBER ALL THESE THINGS WILL BE DONE WITH OUR TERMINAL THIS IS WHY LINUX IS SO COOL...


Then we are all set to run the internet.And now we are some basic troubleshooter about networking, though networking is a huge this would be the first step. Not actually first first step in networking is always theory The Basics of Networking, but we are not dealing with it today. So lets begin

1. In order to know  the hardware devices assembled in your laptop open your TERMINAL CTRL+ALT+T and then type lspci .
This displays all the hardware devices  like PCI BRIDGE, SATA controller, SMBus, USB Controller, Audio Device assembled in your laptop / computer. 



My Network controller is:
02:00.0 Network controller: Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter (rev 01)

2. So now we need to know the interfaces that are available in our UBUNTU.  To see this type ifconfig in the terminal and you will see the output like this :

3. To access the internet first your hardware device should be activated, In order to do so type 
sudo service networking  and press tab twice which displays  arguments like:
 force-reload       reload        restart       start         stop
Perform any you need.

4.  To enable apache server in terminal type:

      sudo service apache2 start

5.  Now enable the network manager. In order to do so in terminal type:
    
     sudo service network-manager start 

6. Now First view the available connecting points Wireless point or Ethernet. To view the available wifi points in terminal type
    
     sudo nmcli con list



This displays the available devices With its UID and SSID.
Now to enable the wifi in terminal type:

      Sudo nmcli con up SSID or the UID

You can manipulate these basic networking commands and  triubleshoot on your own.

UBUNTU DESKTOP WALLPAPER TWEAKS

Can you Set a picture of yours as default Ubuntu Desktop Wallpaper?

Well, setting a picture of yours as a wallpaper is totally different then setting default images as wallpaper.That picture of yours after it is deleted or moved in another location, your wallpaper either gets blank or some default images are set as wallpaper.

So in order to set your image as default image you should  work on following steps:
I have tried this tweak  on both 12.04 LTS and 14.04LTS and it works absolutely fine.
  1. First copy your image to /usr/share/backgrounds/ Do this from terminal using root prompt or do it from Nautilus  typing nautilus in terminal, so that you will not face permission denial.
  2. Edit  the XML file /usr/share/backgrounds/contents/trusty.xml and paste this code:
Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable. It is defined by the W3C's XML 1.0 Specification[2] and by several other related specifications,[3] all of which are free open standards.[4]  (Definition referenced from Wkipedia)

<static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/Aurora_500PX.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/Aurora_500PX.jpg</from>
    <to>/usr/share/backgrounds/Reflections_by_Trenton_Fox.jpg</to>
  </transition>

Instead of Aurora_500PX.jpg keep your filename.

     3. Edit file /usr/share/gnome-background-properties/trusty-wallpapers.xml

<wallpaper>
    <name>AURORA 500PX</name>
    <filename>/usr/share/backgrounds/Aurora_500PX.jpg</filename>
    <options>zoom</options>
    <pcolor>#000000</pcolor>
    <scolor>#000000</scolor>
    <shade_type>solid</shade_type>
  </wallpaper>

Edit your filename instead of Aurora_500PX.jpg




Default Ubuntu Wallpapers

Look there are fourteen default wallpapers in Ubuntu. Our purpose is to set our image in that list so that next time we won't have any problem even we lose the picture or move it to another location. 


You can see the image selected with red rectangle and its thumbnail inside the monitor on your left which is the AURORA Borealis  downloaded from 500PX.com
And you can even see I have messed up with images duplication.


Troubleshoot your dead screen in Ubuntu with LightDM.

Troubleshoot your dead screen in Ubuntu with LightDM.

This works great in times when you lose your user interface and reach a dead end.In order to troubleshoot your black screen you need to go through following steps:

  1. Open a Virtual Console
virtual console (VC) – also known as a virtual terminal (VT) – is a conceptual combination of the keyboard and display for a computer user interface. It is a feature of some operating systems such as BSDLinux, and UnixWare in which the system console of the computer can be used to switch between multiple virtual consoles to access unrelated user interfaces. Virtual consoles date back at least to Xenix in the 1980s. 
The Keyboard Combination to open Virtual Terminal is CTRL + ALT + F1. You can even use F2 to F6, but remember F7 is your recent console.

       2. Run LightDM from terminal

LightDM is an X display manager that aims to be lightweight, fast, extensible and multidesktop. It uses various front-ends to draw login interfaces, so-called Greeters. 

I understand that lightdm is the display manager like explorer.exe manages window's display. So a dead screen appears means your lightdm is off.Run it typing: 
sudo lightdm start in your terminal and you are into your interface.

NOTE: Definitions are referenced from wikipedia
HOW TO SPEED UP UBUNTU?

HOW TO SPEED UP UBUNTU?

My 'UBUNTU 14.04' takes too much time after first boot. Well genius people will have many tricks and tweaks to speed up their systems but as a beginner  I am researching in the internet about following things which can possibly boost up performance of Ubuntu:
  1. Packages / Software installed in my #Ubuntu.
  2. Distinguishing useful / obsolete software.
  3. Removing unnecessary software, Releasing space, which can increase the speed.
This could be one way of solving the problem of slow performance of speed.

Today I will show  some ways to see the packages  and software installed in Ubuntu.

  1. Synaptic Package Manager

To open the Synaptic Package Manager in terminal type:

[email protected]:~$ sudo synaptic

This will open the GUI of Synaptic Manager. From there you can explore the installed packages.

    2. dpkg --get-selections

To get a list of packages installed locally do this in your terminal:

[email protected]:~$ sudo dpkg --get-selections | grep -v deinstall

To save that list to a text file called packages on your desktop do this in your terminal:

[email protected]:~$ dpkg --get-selections | grep -v deinstall > ~/Desktop/packages

     3.  aptitute

To get just the packages which were expressly installed (not just installed as dependencies), you can run

[email protected]:~$ aptitude search '~i!~M'

This will also include a brief description, which you may want. If not, use the option -F '%p'


     4. Create Backup

Create a backup of what packages are currently installed:

[email protected]:~$ dpkg --get-selections > list.txt

Then (on another system) restore installations from that list:

[email protected]:~$ dpkg --clear-selections

[email protected]:~$ sudo dpkg --set-selections < list.txt

To get rid of stale packages

[email protected]:~$ sudo apt-get autoremove

To get installed like at backup time (i.e. to install packages set by dpkg --set-selections)

[email protected]:~$ sudo apt-get dselect-upgrade

There are many documentations available in the internet and I searched only few intelligent peoples'  brain. There are many users out there with creative ideas to manipulate terminals and  bash scripts. it can by you as well.

So now I know to list out all the packages and save them in txt file. Next time I will show some methods to remove the old and obsolete packages. In a few blogs we will be able to maintain the speed of our OS i.e. UBUNTU

See you guys soon.