Friday, November 30, 2012

Quick Listing of users who have current login session

If you wish to have quicklisting of users who are logging on to your servers, you can use the command "users". If a user is running multiple session, they will appear multiple time.

# users
root root user1 user2 user3 user3
There are more comprehensive tools like who and finger. Will write in future blog entries.

Thursday, November 29, 2012

Using host command as an alternative to nslookup

host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host prints a short summary of its command line arguments and options.

Common basic Usages

Using host command to check resolving DNS Servers
# host www.google.com.sg

www.google.com.sg has address 173.194.38.159
www.google.com.sg has address 173.194.38.151
www.google.com.sg has address 173.194.38.152
www.google.com.sg has IPv6 address 2404:6800:4003:802::1018

Using host command with "-a" to display a query of type ANY

# host -a google.com.sg

Trying "google.com.sg"
;; ->>HEADER<<- 51686="51686" br="br" id:="id:" noerror="noerror" opcode:="opcode:" query="query" status:="status:">;; flags: qr rd ra; QUERY: 1, ANSWER: 14, AUTHORITY: 4, ADDITIONAL: 3

;; QUESTION SECTION:
;google.com.sg.                 IN      ANY

ANSWER SECTION:
google.com.sg.          177     IN      TXT     "v=spf1 -all"
google.com.sg.          86277   IN      SOA     ns1.google.com. dns-admin.google.com. 2012032600 21600 3600 1209600 300
google.com.sg.          177     IN      AAAA    2404:6800:4003:801::101f
google.com.sg.          177     IN      A       74.125.235.63
google.com.sg.          177     IN      A       74.125.235.55
google.com.sg.          177     IN      A       74.125.235.56
google.com.sg.          10677   IN      MX      10 google.com.s9b1.psmtp.com.
google.com.sg.          10677   IN      MX      10 google.com.s9b2.psmtp.com.
google.com.sg.          10677   IN      MX      10 google.com.s9a1.psmtp.com.
google.com.sg.          10677   IN      MX      10 google.com.s9a2.psmtp.com.
google.com.sg.          345477  IN      NS      ns2.google.com.
google.com.sg.          345477  IN      NS      ns3.google.com.
google.com.sg.          345477  IN      NS      ns1.google.com.
google.com.sg.          345477  IN      NS      ns4.google.com.

;; AUTHORITY SECTION:
google.com.sg.          345477  IN      NS      ns2.google.com.
google.com.sg.          345477  IN      NS      ns3.google.com.
google.com.sg.          345477  IN      NS      ns1.google.com.
google.com.sg.          345477  IN      NS      ns4.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.         188413  IN      A       216.239.32.10
ns2.google.com.         188413  IN      A       216.239.34.10
ns3.google.com.         188413  IN      A       216.239.36.10

Using host -t parameter to select the query type
# host -t MX google.com.sg

google.com.sg mail is handled by 10 google.com.s9b2.psmtp.com.
google.com.sg mail is handled by 10 google.com.s9a1.psmtp.com.
google.com.sg mail is handled by 10 google.com.s9a2.psmtp.com.
google.com.sg mail is handled by 10 google.com.s9b1.psmtp.com.

Monday, November 26, 2012

Using free to see memory and cache usage

The utility free is a useful tool for Linux to help to analyse the memory usage

To get the output below, I issued a command
# free -mt
where
-m => Display amount in  megabytes
-t => Add a Total row at the bottom
-s N => Run continuously and update the display  every N seconds
             total       used       free     shared    buffers     cached
Mem:          7871       5995       1875          0        310       3729
-/+ buffers/cache:       1956       5914
Swap:        10047        283       9764
Total:       17919       6279      11640

How do we interpret the results. I would like to credit the article from Determining free memory on Linux for a simple but very good explanation on memory.Here is what I have gathered from the read-up.

Basically, Linux caches blocks from the disk in memory to make data reading as efficient as possible. The buffer cache will shrink to accommodate the increased memory needs.

The actual free memory is column free (1875) + Buffers (310) + Cached (3729). So it is more than we think

Friday, November 23, 2012

Compiling and Installing Boost C++ Libraries on CentOS

Boost C++ libraries provides free peer-reviewed portable C++ source libraries. Boost libraries are intended to be widely useful, and usable across a broad spectrum of applications.

Easy Build and Install (Taken from Getting Started on Unix Variants)

$ cd path/to/boost_1_52_0
$ ./bootstrap.sh --help

Select your configuration options and invoke ./bootstrap.sh again without the --help option. Unless you have write permission in your system's /usr/local/ directory, you'll probably want to at least use
$ ./bootstrap.sh --prefix=/usr/local/boost
$ ./b2 install
This will leave Boost binaries in the lib/ subdirectory of your installation prefix. You will also find a copy of the Boost headers in the include/ subdirectory of the installation prefix, so you can henceforth use that directory as an #include path in place of the Boost root directory.

Thursday, November 22, 2012

JELLYFISH - Fast, Parallel k-mer Counting for DNA


What is Jellyfish - Fast, Parallel k-mer Counting for DNA?
(Taken from Jellyfish Site)
JELLYFISH is a tool for fast, memory-efficient counting of k-mers in DNA. A k-mer is a substring of length k, and counting the occurrences of all such substrings is a central step in many analyses of DNA sequence. JELLYFISH can count k-mers using an order of magnitude less memory and an order of magnitude faster than other k-mer counting packages by using an efficient encoding of a hash table and by exploiting the "compare-and-swap" CPU instruction to increase parallelism.

JELLYFISH is a command-line program that reads FASTA and multi-FASTA files containing DNA sequences. It outputs its k-mer counts in an binary format, which can be translated into a human-readable text format using the "jellyfish dump" command. See the documentation below for more details.



Requirements:

JELLYFISH runs on 64-bit Intel-compatible processors running Linux or FreeBSD (including Intel Macs). It requires GNU GCC to compile.


Download (current version 1.1.6.):
http://www.cbcb.umd.edu/software/jellyfish/jellyfish-1.1.6.tar.gz


Installation:
# ./configure --prefix=/usr/local/jellyfish
# make
# make install

Testing- Test 1
# make check

... 
...
====================
All 19 tests passed
(1 test was not run)
====================
...
...
All tests should pass and 1 test should be skipped (big.sh). Running
'make check' will use about 50MB of disk space and will use every CPUs
found on the machine. On our test machine with 32 cores, it takes a
few minutes to run.

Testing -Test 2
# make check BIG=1

....
....
PASS: tests/generate_sequence.sh
PASS: tests/serial_hashing.sh
PASS: tests/parallel_hashing.sh
PASS: tests/serial_direct_indexing.sh
PASS: tests/parallel_direct_indexing.sh
....
....