Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Executing jobs in parallel using GNU parallel

Answer:

GNU parallel is a tool for executing jobs in parallel. It is not part of standard Linux distribution yet, so it is so worth to install it.

You can download the latest version from: http://ftp.gnu.org/gnu/parallel/

E.g.

# wget http://ftp.gnu.org/gnu/parallel/parallel-20101202.tar.bz2
# tar -jxvf parallel-20101202.tar.bz2
# cd parallel-20101202
# ./configure
# make && sudo make install

Example usages:

#  echo -e "a\nb\nc"  | parallel echo "foo"

foo a
foo b
foo c

Show the Domain Name Servers for a domain

Answer:

To show the Domain Name Servers for a domain, use the command below:

E.g. example.com

# nslookup -type=ns example.com
Server:         203.98.160.11
Address:        203.98.160.11#53

Non-authoritative answer:
example.com     nameserver = b.iana-servers.net.
example.com     nameserver = a.iana-servers.net.

Authoritative answers can be found from:
a.iana-servers.net      internet address = 192.0.34.43
b.iana-servers.net      internet address = 193.0.0.236
b.iana-servers.net      has AAAA address 2001:610:240:2::c100:ec

Underline the current line in vim

Answer:

Underline the current editing line in vim is very useful, to do so, follow the guide below.

1. Press [ESC] to get into command mode

2. Enter :set cursorline

Enable compression during scp transfer

Answer:

When you transfer files which are mainly text based using scp command, it is always good to compress them to save the bandwidth needed.

To do so:

# scp -C test.txt john@remoteserver:/home/john/

Set filename in terminal title in vim

Answer:

To display the currently editing filename in the title of terminal of vim, you can try the tricks below:

1. Press [ESC] to get into command mode

2. Enter :set title