fatal error: Python.h: No such file or directory

While trying to install some python module I got following exception:

fatal error: Python.h: No such file or directory

Reason for exception:

If you haven’t properly installed the header files and static libraries for python dev this issue may occur.

To resolve this issue install python-dev module by using following command:

$ sudo apt-get install python-dev

Linux – Ping multiple hosts using fping


fping is a ping like program which uses the Internet Control Message Protocol (ICMP) echo request to determine if a host is up.

With fping we can ping multiple hosts at a time. Use following command to ping multiple hosts:

$ fping -f IPsFiles.txt 

where in IPsFiles.txt I have multiple hots.

Below are some other examples of fping:

To ping a host/IP:

$ fping

Output: is alive

$ fping

Output: is unreachable

To ping range of IP’s:

$ fping -g

To list only unreachable hosts/IP’s

$ fping -q -u -f IPsFiles.txt

where -q is for Quiet mode and -u is to list only unreachable targets.

To list only reachable hots/IP’s

$ fping -q -a -f IPsFiles.txt

where -a is to list only alive hots.

OpenSSL is not properly installed on your system – Ubuntu

While trying to install some module I got error saying that “OpenSSL is not properly installed on your system ubuntu”.

I tried to reinstall this module after installing openssl, but no luck.

After debugging and exploring for a while I got to know that installing libssl-dev could resolve this issue, so I installed libssl-dev with following command:

$ sudo apt-get install libssl-dev

Now retried installation and it worked like charm.

iptables allow port for ip


To allow only an ip to access a port use following iptables rule

iptables -I INPUT -p tcp -m tcp -s --dport 8080 -j ACCEPT

Above iptables rule will allow only to access port 8080 and reject all other ip addresses.

Similarly we can give any other ip address and port combination.

Crontab every 30 seconds


To run a cron every 30 seconds check following example:

* * * * * /path/to/your/script arg1 arg2
* * * * * (sleep 30; /path/to/your/script arg1 arg2)

In above example both commands will start at 0th second of every minute, but the second command will sleep for 30 seconds and then start.

Vim – highlight search keyword


By default search keyword won’t be highlighted in vim with Ubuntu OS.

To highlight search keyword we need to set hlsearch flag in vimrc.

Open /etc/vim/vimrc with sudo and append following line in it:

set hlsearch

After that save & exit from vimrc file. This will enable search keyword highlight across all vim sessions.

If you want to enable highlighting only for current session run following command in vim after opening a file:

:set hlsearch

Username and password with wget/curl


To download a url with basic authentication we need to pass username & password.

To acheive this functionality with wget or curl observer following examples:

With curl:

$ curl -u 'username:password' 'http://www.example.com'

With wget:

$ wget --user='username' --password='password' 'http://www.example.com'

Wget with cookie:

Login to server & save cookie to a file:
$ wget --save-cookies cookiesFile.txt --post-data 'user=username&password=password' http://www.example.com/login.html

Download a page by using saved cookie file:
$ wget --load-cookies cookiesFile.txt -p http://www.example.com/somecontent.html

Ubuntu – apt-get auto complete not working

To fix apt-get auto complete issue we need to edit /etc/bash.bashrc file.

Open /etc/bash.bashrc file with any text editor, here I am using vim.

$ vim /etc/bash.bashrc

Now search for below lines in /etc/bash.bashrc file:

# enable bash completion in interactive shells
# if ! shopt -oq posix; then
#  if [ -f /usr/share/bash-completion/bash_completion ]; then
#    . /usr/share/bash-completion/bash_completion
#  elif [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#  fi
# fi

Uncomment external if condition(uncomment all line except first line), after uncomment it look like below:

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion

Next save and exit /etc/bash.bashrc file and reopen terminal.

I got this issue after installing Ubuntu 14.04 64 bit desktop edition & and resolved it by following above mentioned procedure.

ssh disable warning messages – Linux/Ubuntu

To disable ssh warning message we need to add LogLevel to quiet in $HOME/.ssh/config file.


We can also diable warning messages with ssh command as shown below:

$ ssh -o LogLevel=quiet

With following example we can also disable Host Key Checking, set known hosts file to null and disable logging:

$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet