Thursday, February 28, 2013

Upgrading Linux Kernel 3.7.5 (Stable) release in Ubuntu 12.10


Linux kernel 3.7.5 has recently released on January 28, 2013 with lots of bugfixes and improvements.

The changelog contains all the improvements and bugfixes made in the kernel.

* Below mentioned are some important fixes and improvements.
* ACPI: Add fixups for AMD P-state figures
* ACPI / processor: Get power info before updating the C-states
* ALSA: hda - Fix mute led for another HP machine
* ACPI / cpuidle: Fix NULL pointer issues when cpuidle is disabled
* module: fix missing module_mutex unlock
* usb: gadget: FunctionFS: Fix missing braces in parse_opts
* usb: dwc3: gadget: fix ep->maxburst for ep0
* USB: UHCI: fix IRQ race during initialization
* arm64: elf: fix core dumping to match what glibc expects
* arm64: makefile: fix uname munging when setting ARCH on native machine
* vfio-pci: Fix buffer overfill
* ioat: Fix DMA memory sync direction correct flag

We shall upgrade the default kernel version 3.5.0-17.28 shipped with Ubuntu 12.10 to 3.7.5-030705.

Download the script to perform an automated kernel upgrade process.

Now open the terminal and run the below command from the folder where script is downloaded to make it executable.
$ sudo chmod +x ker-upg-3.7.5.sh

$ sudo sh ker-upg-3.7.5.sh

After the completion, reboot the system for the changes to take effect and after reboot run the below command to confirm the version.

$ uname -r

In case if the kernel 3.7.5 is not compatible with your system hardware, then run the below command to remove the kernel 3.7.5 and switch back to previous kernel.

$ sudo apt-get purge linux-image-3.7.5-030705

Friday, February 15, 2013

Upgrading Linux Kernel 3.7.4 (Stable) release in Ubuntu 12.10

Linux kernel 3.7.4 has recently released on January 21, 2013 with lots of bugfixes and improvements.

The changelog contains all the improvements and bugfixes made in the kernel.

Below mentioned are some important fixes and improvements.

* wlan-ng: Fix clamping of returned SSID length
* Add support for Broadcom TruManage redirected serial port
* ifx6x60:Delete SPI timer when shut down port
* USB: option: blacklist network interface on ONDA MT8205 4G LTE
* USB: option: add TP-LINK HSUPA Modem MA180
* igb: release already assigned MSI-X interrupts if setup fails
* intel-iommu: Prevent devices with RMRRs from being placed into SI Domain
* drm/radeon: fix a bogus kfree
* usb: chipidea: Allow disabling streaming not only in udc mode
* ALSA: usb - fix race in creation of M-Audio Fast track pro driver
* x86/Sandy Bridge: reserve pages when integrated graphics is present

We shall upgrade the default kernel version 3.5.0-17.28 shipped with Ubuntu 12.10 to 3.7.4-030704.

Download the script to perform an automated kernel upgrade process.

Now open the terminal and run the below command from the folder where script is downloaded to make it executable.
$ sudo chmod +x ker-upg-3.7.4.sh

$ sudo sh ker-upg-3.7.4.sh

After the completion, reboot the system for the changes to take effect and after reboot run the below command to confirm the version.

$ uname -r

In case if the kernel 3.7.4 is not compatible with your system hardware, then run the below command to remove the kernel 3.7.4 and switch back to previous kernel.

$ sudo apt-get purge linux-image-3.7.4-030704

Thursday, February 14, 2013

Sar and vmstat in Linux & Solaris

Sar and vmstat utilities have been used to calculate the precise values of used/unused memory. Though there's a difference if we do so in UNIX based systems like solaris. Usually the linux operating system reports the same value for both sar and vmstat. The below screenshot shows the similarity of outputs of both sar and vmstat in Ubuntu 12.04.


where “free” and “kbmemfree” represent free unused memory. Both have equal values in case of linux.

Whereas as you can see in the below shown screenshot that on contrary to linux, solaris operating system gives different values for both commands.


This doesn't mean that sar or vmstat output is wrong. It's just that the “free” column in vmstat's output is represented in “kilobytes” whereas the “freemem” column in sar's output is represented in “number of pages”.
So in order to make both command outputs look similar, first we need to know exactly how many pages equals to 1 kilobyte. In order to do so we need to execute “pagesize” command to get the default size of a page in Solaris OS.

In my case I found the pagesize to be 4096 bytes (i.e. 4 kilobyte). Multiplying pagesize value (in kilobytes) with average freemem value of sar output, gives and output that is pretty much equal to vmstat free output. Refer below screenshot for more details.

There's a slight difference in output because I didnt run both the commands at exact same time.

Similarly, in case of swap in Solaris OS you will again find some difference in swap readings. The output vmstat command reports free swap memory in “swap” column and “freeswap” column in sar output. The only reason for both the outputs to be different is that sar reports the output in blocks whereas vmstat continues to report in kilobytes.
Since, the sar utility reports its swap in blocks, also we all know that one block is 512 bytes in size and two blocks will be 1024 bytes.
Hence, in order to convert the swap blocks to kilobytes we need to divide average freeswap output by 2 and we will get the freeswap size in kilobytes. Refer the below mentioned screenshot for more details.





Wednesday, February 13, 2013

Upgrading Linux Kernel 3.7.3 (Stable) release in Ubuntu 12.10


Linux kernel 3.7.3 has recently released on January 17, 2013 with lots of bugfixes and improvements.

The changelog contains all the improvements and bugfixes made in the kernel.

Below mentioned are some important fixes and improvements.

* drm/radeon: fix amd afusion gpu setup aka sumo v2
* drm/radeon: fix eDP clk and lane setup for scaled modes
* Fixes flickering with some high res montiors
* KVM: PPC: 44x: fix DCR read/write
* KVM: Fix user memslot overlap check
* iwlwifi: fix PCIe interrupt handle return value
* iwlwifi: fix the reclaimed packet tracking upon flush queue
* ALSA: pxa27x: fix ac97 warm reset
* video: mxsfb: fix crash when unblanking the display
* cpuidle / coupled: fix ready counter decrement
* sony-laptop: fix SNC buffer calls when SN06 returns Integers
* EDAC: Fix kernel panic on module unloading
* drm/i915: fix OOPS in lid_notify
* Add device quirk for Microsoft Lifecam VX700 v2.0 webcams.
* Fixes squeaking noise of the microphone.
* drm/nouveau/clock: fix support for more than 2 monitors on nve0
* b43: Fix firmware loading when driver is built into the kernel
* staging: zram: fix invalid memory references during disk write
* ext4: fix extent tree corruption caused by hole punch

We shall upgrade the default kernel version 3.5.0-17.28 shipped with Ubuntu 12.10 to 3.7.3-030703.

Download the script to perform an automated kernel upgrade process.

Now open the terminal and run the below command from the folder where script is downloaded to make it executable.
$ sudo chmod +x ker-upg-3.7.3.sh

$ sudo sh ker-upg-3.7.3.sh

After the completion, reboot the system for the changes to take effect and after reboot run the below command to confirm the version.

$ uname -r

In case if the kernel 3.7.3 is not compatible with your system hardware, then run the below command to remove the kernel 3.7.3 and switch back to previous kernel.

$ sudo apt-get purge linux-image-3.7.3-030703

Friday, February 08, 2013

Share folders to Ubuntu Guest in VMware Workstation

Shared Folders is very helpful when we need to share large amount of data to a guest machine. To use this feature in vmware we need to have VMware-Tools configured in the guest machine.
Recently I tried to share a folder to my Ubuntu 12.10 guest machine. Normally we do it simply adding a folder to Shared Folders option that can be found in "Settings" option in "VM" Menu in the menu bar of VMware Workstation. Below screenshot illustrates the same.

Here we add a the directory we want to share simply by browsing.

I followed the same procedure but I got an error as shown in the below mentioned screenshot.

It was because of the "vmhgfs" module that was responsible for the shared folders to function was unable to load while sharing. After I tried loading the module manually which helped me in successful sharing the folder. Below are the steps that I had followed.
Check and confirm whether the module "vmhgfs" is loaded or not by running the below command.
$ sudo lsmod | grep -i vmhgfs

If the command returns no output then it confirms that the module is not loaded. Hence our next step is to load the module using the below command.
$ sudo modprobe vmhgfs

Now again we can confirm if the command really worked for us.

As I had already done the basic configurations to share the folder, we need to confirm the if the shared folder is available in the guest machine using the below command.
$ sudo vmware-hgfsclient
Below screenshot shows the folder that is available for share in my system but due to some reason Ubuntu 12.10 was unable to mount it automatically.

As we have already loaded the "vmhgfs" module in the kernel, now we can go ahead and mount the shared folder manually into our guest machine.
$ sudo mount -t vmhgfs .host:/<path_of_folder_to_be_mounted> /<path_of_mount_point>

As you can see in the above screenshot that after manually mounting the folder into the guest system the folder was available for use in my Ubuntu 12.10 guest.

Thursday, February 07, 2013

Upgrading Linux Kernel 3.7.2 (Stable) release in Ubuntu 12.10


Linux kernel 3.7.2 has recently released on January 11, 2013 with lots of bugfixes and improvements.

The changelog contains all the improvements and bugfixes made in the kernel.

Below mentioned are some important fixes and improvements.

* ARM: 7607/1: realview: fix private peripheral memory base for EB rev. B boards
* Revert "Bluetooth: Fix possible deadlock in SCO code"
* CRIS: fix I/O macros
* nfs: fix null checking in nfs_get_option_str()
* NFS: Fix access to suid/sgid executables
* nfsd4: fix oops on unusual readlike compound
* nfsd: fix v4 reply caching
* usb: gadget: network: fix bind() error path
* USB: chipidea: fix use after free bug
* rtlwifi: fix incorrect use of usb_alloc_coherent with usb_control_msg
* ALSA: hda - Fix pin configuration of HP Pavilion dv7
* ALSA: hda - Fix the wrong pincaps set in ALC861VD dallas/hp fixup
* ALSA: hda - Add stereo-dmic fixup for Acer Aspire One 522
* ALSA: usb-audio: Fix missing autopm for MIDI input
* tmpfs mempolicy: fix /proc/mounts corrupting memory
* xfs: fix stray dquot unlock when reclaiming dquots
* xfs: fix direct IO nested transaction deadlock.
* tcp: fix MSG_SENDPAGE_NOTLAST logic

We shall upgrade the default kernel version 3.5.0-17.28 shipped with Ubuntu 12.10 to 3.7.2-030702.

Download the script to perform an automated kernel upgrade process.

Now open the terminal and run the below command from the folder where script is downloaded to make it executable.
$ sudo chmod +x ker-upg-3.7.2.sh

$ sudo sh ker-upg-3.7.2.sh

After the completion, reboot the system for the changes to take effect and after reboot run the below command to confirm the version.

$ uname -r

In case if the kernel 3.7.2 is not compatible with your system hardware, then run the below command to remove the kernel 3.7.2 and switch back to previous kernel.

$ sudo apt-get purge linux-image-3.7.2-030702

Sunday, February 03, 2013

Install and configure Munin on Ubuntu 12.04

Munin monitoring tool is used to monitor the performance of your system. It provides every little information that a person needs and is very useful in troubleshooting the problems. You can easily monitor the disk usage, network, cpu usage, memory usage, processes and many more with the help of easy to read website. All statistics are provided in the form of graphs which makes things pretty neat easy to monitor. Munin can be configured for multiple nodes i.e. we can monitor many systems at a time. It can be done so using munin and munin-node software appropriately. Munin-node is the actual package that monitors the system and munin-master collects the data to produce the statistics.
We will be installing it only on a single system to get the overall idea of installation and use.

Installation
Update your ubuntu repository and installed packages using the below command.
$ sudo apt-get update

Make sure that the apache is installed prior to installing the munin package.
$ sudo apt-get install apache2

Install the munin package
$ sudo apt-get install munin munin-node

As soon as you install the package you can access the website using "127.0.0.1/munin" on the same machine. To make it available on any machine located locally on lan we have to make some changes to /etc/munin/apache.conf file. Below mentioned are the necessary changes.
Change "Allow from localhost127.0.0.1/8 ::1" to "Allow from all"

Securing Munin
To password protect the munin web-interface and output directory make the changes to /etc/munin/apache.conf file as shown in below screenshot.

Uncomment/add the below lines in /etc/munin/apache.conf
AllowOverride None
AuthUserFile /etc/munin/munin-htpasswd
AuthName "Munin"
AuthType Basic
require valid-user

After this you need to set the password for /etc/munin/munin-htpasswd file which will password protect the output directory.
$ sudo htpasswd -c /etc/munin/munin-htpasswd Munin
Enter the new password twice.

Now restart the apache and munin-node services on the system.
$ sudo service apache2 restart
$ sudo service munin-node restart

Now open "127.0.0.1/munin" in a browser. The web-interface will prompt for User Name and Password. Type the username as "Munin" and password as specified earlier.

Below shown are some screenshots of Munin on my system.





There are many other tools to monitor the system which you can find in-built with the system and also available for free on internet. Click here to know more.

Note: It takes a week to generate all the graphs. Normally you will see the graphs generating after 10 minutes of successful munin configuration.

Friday, February 01, 2013

Monitoring Ubuntu

Monitoring your linux system is one of the main roles played by the administrators in their day-to-day life. Though linux is equipped with many monitoring tools that provide us many options to monitor the system the way we want it to. We will discuss few that are largely used, easy to remember and use. These tools can be built-in commands or programs and add-on tools.

Monitoring any system includes cpu usage, process activity, memory consumption, storage (disk) usage, network statistics and many more. These all criteria can be observed through command line and also there are a few graphical tools that can be useful too. We will first of all go through the built-in commands and tools that can help us in monitoring the linux machine.

Monitoring CPU
Using Sysstat
You need to install this package from the ubuntu repository.
$ sudo apt-get install sysstat

After which we can do deep monitoring of cpu using mpstat command.
$ mpstat
This command helps in monitoring smp box where multiple cpu are present We can use mpstat to display individual cpu utilization.
The command mpstat displays the average activities of all present processors.


$ mpstat -P ALL
This will display all the processors present in the system with their invidual stats.
On my laptop

baban@hashprompt:~$ mpstat -P ALL
Linux 3.2.0-35-generic (hashprompt) Sunday 20 January 2013 _x86_64_ (4 CPU)

12:20:19  IST  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
12:20:19  IST  all    5.09    0.01    3.47    1.41    0.00    0.03    0.00    0.00   89.99
12:20:19  IST    0    6.44    0.01    3.41    2.01    0.00    0.12    0.00    0.00   88.01
12:20:19  IST    1    4.09    0.01    3.43    2.24    0.00    0.02    0.00    0.00   90.22
12:20:19  IST    2    6.55    0.00    3.25    0.93    0.00    0.00    0.00    0.00   89.27
12:20:19  IST    3    3.29    0.00    3.79    0.49    0.00    0.00    0.00    0.00   92.44
baban@hashprompt:~$


On SMP box
HPC2:~ # mpstat -P ALL
Linux 2.6.16.60-0.35-default (HPC2) Sunday 20 January 2013

01:14:19  IST  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
01:14:19  IST  all   27.25    0.00    4.28    3.11    0.01    0.04    0.00   65.31  33521.58
01:14:19  IST    0   57.27    0.00   16.10    0.11    0.00    0.00    0.00   26.52    251.21
01:14:19  IST    1   61.99    0.00   21.39    0.09    0.00    0.00    0.00   16.53    250.30
01:14:19  IST    2   20.57    0.00    0.47    3.25    0.00    0.00    0.00   75.71    255.70
01:14:19  IST    3   14.18    0.00    0.30    2.35    0.00    0.00    0.00   83.17    264.58
01:14:19  IST    4   19.85    0.00    0.48    4.35    0.00    0.00    0.00   75.32    255.94
01:14:19  IST    5   19.73    0.00    0.52    4.44    0.00    0.00    0.00   75.31    252.76
01:14:19  IST    6   18.51    0.00    0.42    4.35    0.00    0.00    0.00   76.71    252.80
01:14:19  IST    7   17.23    0.00    0.46    4.41    0.00    0.00    0.00   77.90    253.14
01:14:19  IST    8   15.15    0.00    0.25    0.52    0.00    0.00    0.00   84.08    285.23
01:14:19  IST    9   11.64    0.00    0.17    0.69    0.00    0.00    0.00   87.49    256.51
01:14:19  IST   10   60.21    0.00   21.76    0.10    0.00    0.00    0.00   17.93    250.22
01:14:19  IST   11   51.33    0.00   20.29    0.53    0.00    0.00    0.00   27.85    250.50
01:14:19  IST   12   29.35    0.00    7.06    4.45    0.00    0.00    0.00   59.14    253.43
01:14:19  IST   13   18.03    0.00    1.25    4.46    0.00    0.00    0.00   76.26    252.86
01:14:19  IST   14   17.11    0.00    1.84    4.52    0.00    0.00    0.00   76.53    252.98
01:14:19  IST   15   19.60    0.00    1.92    4.49    0.00    0.00    0.00   73.99    253.35
01:14:19  IST   16   21.50    0.00    0.54    4.23    0.00    0.00    0.00   73.73    255.17
01:14:19  IST   17   24.73    0.00    0.46    4.20    0.00    0.00    0.00   70.61    253.58
01:14:19  IST   18   21.40    0.00    0.42    4.24    0.00    0.00    0.00   73.94    254.26
01:14:19  IST   19   18.53    0.00    0.43    4.42    0.00    0.00    0.00   76.62    254.53
01:14:19  IST   20   24.57    0.00    0.47    4.15    0.00    0.00    0.00   70.81    253.20
01:14:19  IST   21   19.74    0.00    0.46    3.91    0.00    0.00    0.00   75.90    252.75
01:14:19  IST   22   21.53    0.00    0.46    4.00    0.00    0.00    0.00   74.01    252.93
01:14:19  IST   23   18.15    0.00    0.55    4.18    0.00    0.00    0.00   77.13    257.21
01:14:19  IST   24   22.35    0.00    0.58    2.84    0.00    0.00    0.00   74.23    257.91
01:14:19  IST   25   23.74    0.00    0.52    2.79    0.00    0.00    0.00   72.95    252.30
01:14:19  IST   26   23.79    0.00    0.44    2.69    0.00    0.00    0.00   73.08    253.89
01:14:19  IST   27   27.48    0.00    0.44    2.74    0.00    0.00    0.00   69.34    254.86

-----output truncated-----

Using SAR (System Activity Recorder)
To make the sysstat utility to collect system activity information we have to edit the file /etc/default/sysstat and set the option "ENABLED" as "true". Refer the below screenshot for more details.


$ sar -u


$ sar -u 2 5


$ sar -u -P ALL


%user - Percentage of CPU utilization that occurred while executing at the user level (application).
%nice - Percentage of CPU utilization that occurred while executing at the user level with nice priority.
%system - Percentage of CPU utilization that occurred while executing  at  the  system level (kernel).
%iowait - Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.
%steal - Percentage  of time spent in involuntary wait by the virtual CPU or  CPUs  while  the  hypervisor  was  servicing another virtual processor.
%idle - Percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.

Using iostat
$ sudo iostat -xtc


Using vmstat
$ sudo vmstat 2 5


Monitoring Memory
Using /proc/meminfo
The /proc/meminfo file stores memory usage statistics.
The above shown screenshot is the truncated output. As you can see that the total memory of my laptop is 3838124kB. Below calculation shall give us the the total memory used.
Mem Used = MemTotal - MemFree - Buffers - Cached
                  = 1434868kB
We can compare and verify this output with the gnome-system-monitor ouput.
As you can see both the outputs are same.

Using free
$ free -m
free -m command shows memory utilization in MB. Here, 1364MB is the actual used memory whereas 2383MB is the actual free memory.

$ free -m -t
This command displays the total memory present, utilized and free respectively which includes the swap memory also.

Using vmstat
$ vmstat 2 5

Using top
$ top

Using SAR
$ sar -r 2 5
The above command also helps to calculate the exact memory utilization in ubuntu.


Monitoring Processes
Using Top
Top is a program that provides the real-time dynamic view of running system. By default it displays the cpu intensive processes that are ordered by highest percentage of CPU usage on the top. The top area contains the uptime, load average, no of users and processes and memory consumption.
Few hot-keys that have various usages in top are listed below.
1 - Displays the cpu states of multiple numbers processors present in the system.
A - Displays the top resource hungry processes
k - to kill a particular PID
z - to choose between colour and mono


Using ps
ps is another built-in command which is very useful to monitor processes. It displays the snapshot of the running processes at particular instance of time the command is run. Below mentioned are few common examples of ps command.

$ ps -ejH
This command helps to view the process hierarchy.
  PID  PGID   SID TTY          TIME CMD
  933   933   933 ?        00:00:00   bluetoothd
  934   930   930 ?        00:00:03   rsyslogd
  938   938   938 ?        00:00:03   NetworkManager
 2235  2235   938 ?        00:00:00     dhclient
 2348  2348   938 ?        00:00:00     dnsmasq
  965   903   903 ?        00:00:13   polkitd
  969   968   968 ?        00:00:00   avahi-daemon
  972   968   968 ?        00:00:00     avahi-daemon
  990   990   990 ?        00:00:00   cupsd
 2543  2543  2543 tty7     01:15:55     Xorg
 2641  1092  1092 ?        00:00:00     lightdm
 2731  2731  2731 ?        00:00:00       gnome-session
 2766  2766  2766 ?        00:00:00         ssh-agent
 2783  2731  2731 ?        00:00:13         gnome-settings-
 2822  2731  2731 ?        00:00:10           syndaemon
 2814  2731  2731 ?        00:10:33         cinnamon
 3034  2731  2731 ?        00:00:12           nemo
 3099  2731  2731 ?        00:00:02           /usr/bin/termin
 3109  2731  2731 ?        00:00:00             /usr/bin/termin <defunct>
 3110  3110  3110 pts/0    00:00:00             bash
 3166  3166  3110 pts/0    00:00:00               sudo
 3176  3166  3110 pts/0    00:02:05                 vmware
 3797  2731  2731 ?        00:11:35           chromium-browse
 3815  2731  2731 ?        00:00:11             chromium-browse
 3921  2731  2731 ?        00:00:08             chromium-browse
 9084  2731  2731 ?        00:09:58             chromium-browse
10311  2731  2731 ?        00:00:18             chromium-browse
22853  2731  2731 ?        00:00:06           /usr/bin/termin
22864  2731  2731 ?        00:00:00             /usr/bin/termin <defunct>
22865 22865 22865 pts/2    00:00:00             bash
23495 23495 22865 pts/2    00:00:00               ps
 2844  2731  2731 ?        00:00:00         nm-applet
 2848  2731  2731 ?        00:00:00         polkit-gnome-au
 2852  2731  2731 ?        00:00:00         gnome-fallback-
 3029  2731  2731 ?        00:00:00         gdu-notificatio
 3063  2731  2731 ?        00:00:01         zeitgeist-datah
 3064  2731  2731 ?        00:00:01         gnome-screensav
 1106  1106  1106 ?        00:00:03   irqbalance
 1278  1278  1278 ?        00:00:00   vmware-vmblock-
----- Output truncated -----

$ pstree
Shows the process hierarchy.


$ ps -Al
Shows long output of all processes.



$ ps -AlF
Shows long with some extra full output.



$ ps ax
Prints all processes



$ ps aux

pgrep & ps -p
Displays only the process id(s) associated with the process.

pmap -d
Reports memory map of a process.

Using pidstat
Lists all running processes and the resources that they are using.

Pidstat can be used with options like -u (CPU utilization) and -r (memory utilization) with time intervals.

System Running Status
Using uptime
uptime gives you the duration for which the server has been up and running, number of users logged into the system and the load averages for the past 1min, 5mins and 15mins respectively.
$ uptime

User Stats
Using w
w command lists the users currently logged into the system and the processes they are using.
$ w

We can also list the processes used by particular user.
$ w baban

NFS Statistics
$ nfsstat
Lists NFS statistics. To run this command we need to install the nfs-common package using below command.
$ sudo apt-get install nfs-common

Other Tools
Using Gnome System Monitor
Gnome System Monitor tool is the best graphical monitor tool that comes with the Ubuntu operating system. This tool is very helpful in monitoring CPU, Memory & swap, Network, Processes and File Systems.

Using atop
This command is similar to top command. atop also displays used and free memory like top but differs only in some advanced options. atop does not come bundled with the os. It has to be installed from the ubuntu repository using the below mentioned command.
$ sudo apt-get install atop
$ atop

Using htop
htop is also a similar process as top and atop. It is very interactive as it gives a dynamic graphical representation of cpu utilization, memory and swap usage.
$ sudo apt-get install htop
$ htop

Using Glances
Glances is another free monitoring tool like top/htop which can be used through text interface. It is developed in python. The most unique thing in this software is that this software can determine the status of system resources on the system and can indicate the status in various colors which helps in easy monitoring. Also there is a provision to set the threshold values for the indicators.
This software is maintained by Nicolargo. You can download software and easy step-by-step instructions for installation can be found at github.
Below shown is a screenshot of Glances on my system.


Using GKrellM
GKrellM is a GTK-based stacked monitor program that charts SMP CPUs, memory, swap, disks, load, active net interfaces and internet connections.
It can be installed using the below mentioned command.
$ sudo apt-get install gkrellm 

There are also various exciting skins available at muhri.net. You can download the tarball of all skins from here. Extract the tarball using below command.
$ sudo tar -xzvf GKrellM-Skins.tar.gz

After extraction you will find many skins in tar.gz format. To extract all .tar.gz files run the below command.
$ for i in *.tar.gz; do tar -xzvf $i; done

Now move all the extracted skin directories to themes directory inside .gkrellm2 directory of your home directory. To auto-start it you can add it to "Startup Applications". See the below screenshot for more details.


My system has got GKrellM with invisible skin. Heres what it looks like...


Using Munin
Munin is a graphical monitoring tool for both network and system which presents its output as graph through a web interface.

Installation and configuration of munin can be found here.

Using Conky
It's a light-weight system monitor for X window system. Conky scripts are available for almost all desktop environments like Unity, Gnome, Mate, Cinnamon, etc. You can download the script and edit it as per your requirements. I too have a conky running on cinnamon desktop shown below.

There are lots of conky scripts all over the internet. I had some scripts from this noobslab website.

Note: Please feel free to share any other commands and tools that I have missed.