To change nameservers permanently in Ubuntu Desktop Version we need to update /etc/resolvconf/resolv.conf.d/head file with desired list.
Following is the procedure to change nameservers permanently:
Open /etc/resolvconf/resolv.conf.d/head file with your favourite editor:
sudo vim /etc/resolvconf/resolv.conf.d/head
Add following lines to /etc/resolvconf/resolv.conf.d/head, save & exit from the file
Run following command to change nameservers permanently:
sudo resolvconf -u
After running above commands nameservers in your desktop version will get updated with new list as mentioned in /etc/resolvconf/resolv.conf.d/head file.
To conform this open /etc/resolve.conf and validate.
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
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 192.168.2.2
192.168.2.2 is alive
$ fping 192.168.2.22
192.168.1.22 is unreachable
To ping range of IP’s:
$ fping -g 192.168.2.0/24
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.
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.
To allow only an ip to access a port use following iptables rule
iptables -I INPUT -p tcp -m tcp -s 192.168.2.20 --dport 8080 -j ACCEPT
Above iptables rule will allow only 192.168.2.20 to access port 8080 and reject all other ip addresses.
Similarly we can give any other ip address and port combination.
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.
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:
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:
To download a url with basic authentication we need to pass username & password.
To acheive this functionality with wget or curl observer following examples:
$ curl -u 'username:password' 'http://www.example.com'
$ 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
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
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
elif [ -f /etc/bash_completion ]; then
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.
To play H.265/HEVC videos with VLC player in Ubuntu OS we need to install vlc-plugin-libde265 module.
Use following command to install vlc-plugin-libde265
$ apt-get install vlc-plugin-libde265
After install we can ply H.265/HEVC formate videos with VLC player.