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

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

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

Remove downloaded archive files from apt-get

Answer:

To remove ownloaded archive files from apt-get to save spaces, try the following command:

# sudo apt-get clean

So all the unneeded archive files will be removed.

Compress and decompress file using 7zip

Answer:

7zip is a well known compression program if you need a very small file size, i.e. high compression ratio.

To install under Ubuntu/Debian:

# sudo apt-get install p7zip

To compress a file

# p7zip test.txt

To decompress a file

# p7zip -d test.txt.7z