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.

Linux Ask!

Dec 042010
 

Simple port forwarding using SSH

Answer:

Assume you are working at office, you want to browse the example.com securely, you can do so by using a computer at home (e.g. HOME_IP)to build a secure tunnel using ssh.

# sudo ssh -L 80:example.com:80 HOME_IP

Then in your browser, type http://localhost and you can view the example.com securely.

Dec 032010
 

Determine file type using the file command

Answer:

If you want to determine file type, you can try the file command:

# file /usr/share/perl5/Time/Zone.pm
/usr/share/perl5/Time/Zone.pm: Perl5 module source text

# file /usr/share/vim/vim72/doc/usr_90.txt
/usr/share/vim/vim72/doc/usr_90.txt: ASCII English text
Dec 022010
 

How to find a Perl Module's Path

Answer:

For example, we want to know where the module JSON and related modules exist in the local file system, we can try:

# perl -MJSON -e'print $_ . " => " . $INC{$_} . "\n" for keys %INC'

attributes.pm => /usr/share/perl/5.10/attributes.pm
XSLoader.pm => /usr/local/lib/perl/5.10.0/XSLoader.pm
warnings/register.pm => /usr/share/perl/5.10/warnings/register.pm
Carp.pm => /usr/share/perl/5.10/Carp.pm
Exporter/Heavy.pm => /usr/share/perl/5.10/Exporter/Heavy.pm
common/sense.pm => /usr/local/share/perl/5.10.0/common/sense.pm
vars.pm => /usr/share/perl/5.10/vars.pm
Exporter.pm => /usr/share/perl/5.10/Exporter.pm
strict.pm => /usr/share/perl/5.10/strict.pm
constant.pm => /usr/local/share/perl/5.10.0/constant.pm
warnings.pm => /usr/share/perl/5.10/warnings.pm
JSON/XS.pm => /usr/local/lib/perl/5.10.0/JSON/XS.pm
overload.pm => /usr/share/perl/5.10/overload.pm
base.pm => /usr/share/perl/5.10/base.pm
JSON.pm => /usr/local/share/perl/5.10.0/JSON.pm
Nov 302010
 

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