OpenSource For You

Detecting the operating system of a remote host

-

Many a time, we need to know details of a remote system. xprobe2 is a remote active operating system fingerprin­ting tool that can fetch the details we need.

Let us first install xprobe2 as follows:

#sudo apt-get update #apt-get install xprobe2

After successful installati­on, run the following command:

#sudo xprobe2 <host/ip address>

#sudo xprobe2 192.168.0.10 The tool works only if ICMP is not blocked, i.e., ping is not blocked on the system that is to be tested. #sudo xprobe2 -B xyzxyz.com

Here, the B option forces the TCP handshake module that tries to guess which the open TCP port is.

You can also use nmap for getting the OS details of a remote system, as follows: #sudo nmap -O <ip addr of Host> Here, O enables OS detection. If the OS doesn’t get detected, then use the following option to guess the OS. #sudo nmap -O --osscan-guess 192.168.61.2 Here, osscan-guess can guess the OS more aggressive­ly. —Rupin Puthukudi, rupinmp@gmail.com

Easy-to-read grep output

When we use grep to filter text (e.g., Web logs, source code or program output), the pattern we are looking for might be anywhere in the matched lines. Hence, output will be a little difficult to read when we look for exactly where the match occurred.

In this case, we can use the following command: #grep --color=always PATTERN

… which will show the output with matching characters in red, by default. This output is easy to read.

We can customise the colours with GREP_COLOR and GREP_COLORS environmen­t variables, as shown below: export GREP_COLOR=”01;31” grep --color=always int SomeCProgr­am.c

This will show all int strings in SomeCProgr­am.c in blue.

With GREP_COLORS, we can customise even further, like have a different colour for file names and a different colour for line numbers.

For complete informatio­n beyond this small tip (what exactly the colour codes are, what else can be coloured, what other customisat­ions are possible, etc), I would suggest searching the Web for ‘grep with colour’. —Prem Ranjan, ranjan_september@yahoo.com

Finding and getting rid of big files

A common problem with computers is when you have a number of large files (such as audio/video clips) that you want to get rid of. You can find the biggest files in the current directory with the following command ( only in the current directory). #ls -lSrh

The r causes the large files to be listed at the end, and the h gives human readable output (MB and such).

You can search for the biggest MP3/MPEG files, using the following command: #ls -lSrh *.mp* You can also look for the largest directorie­s with: #du -kx | egrep -v “\./.+/” | sort -n

You can find the biggest files in your home directory (in the whole directory structure), using the command given below: #find ~ -type f -exec ls -s {} \; | sort -n To list only the top 10 biggest files, use the following command: #find . -type f -exec ls -s {} \; | sort -nr | head -10 Hope this simple tip will help you address this common problem. — Pallavi Rawat, pallavifir­st@rediffmail.com

 ??  ??
 ??  ??

Newspapers in English

Newspapers from India