How to Speed Up Ubuntu the easy way

We all know that Ubuntu is used by millions of folks out there but yet it is still considered to be more faster and malware prone to it’s counterpart Windows and perhaps Mac too. Here we shall be discussing an easy way to get a basic Workstation and not sever in general up and zipping along at blazing speed for an LTS release as well as not-LTS for every Tom and Joe out there. So as Anglehit explains here we go,

Remove old files

It is always a fair practice to keep free space in your hard drive so that your machine can always work at it’s best performance. As and when the fresh install of Ubuntu gets older, the residues keep on accumulating and eventually it starts eating up space on your HDD. Hence run this command and have fun. Note this is to be considered once and after like 4 month Ubuntu installed old machine which is not yet made up for the maintenance and we are not using any third party tools like Bleach Bit etc.

sudo apt-get clean

This shall not remove any applications which are running or installed. After you run this the most important command is down here

sudo apt-get autoremove

It shall show you which all files are to be removed and post that hit Y.

Install Preload

In computer science “Preloading” means keeping necessary files in the RAM. This is many fold times faster than keeping the files on the hard disk. Make sure after you run this restart this machine and login this shall reduce your start-up time drastically.

sudo apt-get install preload

Increase SWAP space(file paging)

We all Linux freaks are aware of what swap space is and what it is like to have more. The more resource hog your machine is the better it is to have swap space, even though there is a rule of thumb. Note that set it what you actually shall need and the rest is good to go with. For me this is what i adhere to, as shown above.

Monitor your Startup apps

Linux always is light on resources and tries not to be a resource hog on your machine. But still there can be bloatware and few new apps here and there which might be sucking and draining resources. You may use the GUI app called “Startup Applications” in Gnome menu or use the command line

service --status-all

to stop running few services

sudo service <name> stop

to delete an unwanted or unused program of choice

sudo apt-get remove <program name>

Use light-weight GUI / desktops

If you’re paranoid about the RAM and disk management systems and want to switch to or consider a lighter alternative than LXDE can come to save you, this is still better and my favorite, hence Anglehit recommends this desktop GUI.

sudo apt-get install lubuntu-desktop
Finally not to be mentioned keep the system updated and to the latest release if possible for the LTS folks be on the point release and that is a good way and a fair practice as well. 

Before I log out from this machine, just a note. Do restart your machine at least few times a week so that the updates can be applied and the patches get stitched and well integrated and everything falls in place. I know for developers and bloggers out there, this might be a lil harsh, but yes the above mentioned things does help for a Ubuntu Workstation, desktop lovers like me, so I think this shall work for you folks out there as well.

Have fun with fast and zippy Ubuntuing !

Fixing Setting Up Arduino Uno IDE error on Ubuntu

Ubuntu is pretty awesome and I am loving it. I just want to burn a code to my Arduino Uno. When uploading the code, there’s an error message saying, Serial Port COM1 not fount found. Did you select the correct one from tools -> serial port menu?. Now, visiting the tools, I can’t select serial port because it is disabled. I am attaching a screen-shot of how it looks. I have done something similar in windows. How to find the serial port on Ubuntu?


COM1 is a Windows(TM) designation – it will look like /dev/ttyACM0, /dev/ttyUSB0 or similar in Linux.

Greyed out port tends to mean you haven’t set the board type first – go through the settings in arduino Tools menu & set board to ‘Uno’, you should see the ‘port’ enable & auto-fill as well, most likely.

— OR —

In case you’re using version 1.X of arduino IDE, I assume that you installed the one in the apt repositories.You can either try to install one from the snapcraft or the one from arduino’s website.

Also either the case you can try to loon on Tools->Port if exists a port that is not a /dev/ttyS0 one. Try to play with these options. Finally by searching on dmesg you can find out which port has been located for arduno as well.

Finally an another approach is to unplug your arduino plug it again and type the following command:

dmesg | tail

In order to record the last event as the one that happens when arduino is plugged in to a usb port. The command above will show you the correct port.

For better results you can try this

  dmesg | tail -f

And continioulsy plug and unplug the arduino from the usp port till you see any arduino related message. The -f parameter allows to show realtime the new logs.

Fastest way to format External drives on Ubuntu and its Derivatives

Let’s talk about a little less complicated and a casual way though powerful enough to get the job done. Yes we’re considering a task to format or perhaps make a bootable drive USB here, for command line freaks you may read here.

Gparted the Gnome by defacto tool for disk related chores for Joe, Tom and folks a like a tool so powerful which can even make a newbie & a seasoned user more confident, before doing any changes to the core system.

I’ve used this tool for a decade now and as of now testing on my Eoan Ermine, Gnome 3.34 the latest at the time of writing and I’ve already installed it via the default Ubuntu Software, but you may get the package from elsewhere that’s fine as far as it’s stabe and does the work for you. Snap pack, Fine ! Flatpak, Cool!! .deb package, shall do = > Your mileage may vary Joe.

Now let us get into the business, insert your external flash, usb or pen drive and just let the tool run, after that select the drive via dropdown from the top left hand corner and you’re good to go.

Now just select the partion wherein you wish to erase as per se format and select via GUI those comfortable anxiety free buttons and keep rolling.

Enjoy ! rest all is self explanatory, the tool is intuitive in itself IMO.

How to recover deleted “dpkg” directory in Debian or Ubuntu


Unfortunately I’ve deleted dpkg directory while removing the lock. By mistake I typed

root@akupedia:~$ rm -r /var/lib/dpkg

Now when I am trying to install/uninstall packages it shows me following error.

E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory)

What should I do now?


root + rm + -r = disaster

So let us begin step by step?

ls -l /var/lib/dpkg/
total 9964
drwxr-xr-x 2 root root    4096 nov 28 11:18 alternatives
-rw-r--r-- 1 root root      11 sep 18 14:08 arch
-rw-r--r-- 1 root root 2573807 nov 28 11:18 available
-rw-r--r-- 1 root root 2561322 nov 28 10:25 available-old
-rw-r--r-- 1 root root       8 abr 24  2013 cmethopt
-rw-r--r-- 1 root root     538 sep 25 17:24 diversions
-rw-r--r-- 1 root root     457 sep 25 17:24 diversions-old
drwxr-xr-x 2 root root  483328 nov 28 11:17 info
-rw-r----- 1 root root       0 nov 28 11:18 lock
drwxr-xr-x 2 root root    4096 mar 22  2013 parts
-rw-r--r-- 1 root root     135 abr 24  2013 statoverride
-rw-r--r-- 1 root root 2269113 nov 28 11:18 status
-rw-r--r-- 1 root root 2268870 nov 28 11:18 status-old
drwxr-xr-x 2 root root    4096 nov 28 11:18 triggers
drwxr-xr-x 2 root root    4096 nov 28 11:18 updates

You removed 5 directories, the status file, etc. So, lets try to fix the stuff. First, create the directory:

sudo mkdir -p /var/lib/dpkg/{alternatives,info,parts,triggers,updates}

Recover some backups:

sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status

Now, let’s see if your dpkg is working (start praying):

apt-get download dpkg
sudo dpkg -i dpkg*.deb

If everything is “ok” then repair your base files too:

apt-get download base-files
sudo dpkg -i base-files*.deb

Now try to update your package list, etc.:

dpkg --audit
sudo apt-get update
sudo apt-get check

Now, let’s take a deep breath. Phew!!! Do ls -l /var/lib/dpkg and compare with the above list. If some -old file is not present don’t worry it will be there after few days.

How to display network traffic in the terminal?


how to display the actual network traffic (wireless) in a terminal?

Additionally: Is it possible to add this info to the chart of top?


It’s quite easy! install “iftop” with:

sudo apt-get install iftop

Then run

sudo iftop

from any terminal!


There is a nice tool called speedometer that displays a graph in the terminal using Unicode block characters, colors, and even adds labels to each peak in the graph.

$ sudo apt-get install speedometer
$ speedometer -l  -r wlan0 -t wlan0 -m $(( 1024 * 1024 * 3 / 2 ))
Screenshot after running the previous command

It has several options, can monitor multiple interfaces, can show multiple graphs in several rows or columns, and can even monitor the download speed of a single file (by watching the file size on disk).

X server started with “-nolisten tcp” in spite of DisallowTCP=false in /etc/gdm/custom.conf

Howdy folks, i needed to start my X.server on Ubuntu LTS Gnome, which should be able to listen for remote connection on port 6000, the gdm has been configured.

Modified /etc/X11/xinit/xserverrc as

exec /usr/bin/X "$@"

Set DisallowTCP=false in /etc/gdm/custom.conf

DisallowTCP = false

Restarted gdm

sudo service gdm restart

Check wether gdm listening on 6000

sudo netstat -tlnp | grep 6000

but result is empty

sudo ps lf -C Xorg command gives

4     0  1362  1342  20   0 176672 61764 poll_s Ss+  tty7       0:02 /usr/bin/X :0 -background none -noreset -verbose -auth /var/run/gdm/auth-for-gdm-XkGfsT/database -seat seat0 -nolisten tcp vt7


After modifying /etc/gdm3/custom.conf content by adding ServerArguments=-listen tcp. I got xserver running on port 6000

ServerArguments=-listen tcp


I get this too. I made a similar change in /usr/share/gdm/gdm.schemas as well, rebooted, and no X11 server listening on port 6000 🙁 I even see this: shell /usr/lib/gdm3/gdm-x-session --run-script --allow-remote-connections env GNOME_SHELL_SESSION_MODE=pop gnome-session --session=pop Note the use of –allow-remote-connections

Cannot install wine-staging in Ubuntu

I had previously installed wine-stable, but for a particular program I wanted to run it was recommended that I run wine-staging. So I uninstalled wine-stable, and tried to install wine-staging as normal. 

When I run 

sudo apt install wine-staging

I get

 Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
 wine-staging : Depends: wine-staging-amd64 (= 4.0~rc7~cosmic) but it is not going to be installed
                Depends: wine-staging-i386 (= 4.0~rc7~cosmic)
E: Unable to correct problems, you have held broken packages.

Solution as follows:

I had similar issue. I forgot to add the wine repository key.

$ wget -qO- | sudo apt-key add -

then add the repository

$ sudo apt-add-repository 'deb bionic main'

and install your flavor of wine

$ sudo apt install winehq-staging

or $ sudo apt install winehq-stable

Checkout the new version

$ wine --version


I had multiple sources for wine in my /etc/apt/sources.list.d/additional-repositories.list. Before you do the nuclear option, correct repo key and install what you need.