Archive for the ‘Uncategorized’ Category

Policy based routing in cisco

May 31, 2009

http://blog.humanmodem.com/?p=67

A joke

April 1, 2009

লিঙ্গ সমস্যা:

একবার সরকারের নীতি নির্ধারকদের একটি দল জটিল সমস্যায় পড়লেন।সমস্যাটা লিঙ্গ নির্ধারন সংক্রান্ত।

তো তারা গেলেন খালেদা জিয়ার কাছে।ম্যাডাম, কাঠাল কোন লিঙ্গ ? ম্যাডাম বললেন, এটা নির্ধারন করা কোনো সমস্যা না।আমি আজকেই বাংলা একাডেমীর ডিজিকে বলে দিচ্ছি তিনি জানিয়ে দিবেন।

কিন্তু দুইদিন গেল, ডিজি জানালেন না।তখন তারা গেল এরশাদের কাছে।এরশাদের ঝটপট জবাব-আরে কাঠাল হল পুং লিঙ্গ।কারণ কাঠালের বিচি আছে।

এরপর পত্রিকার খবর বের হল-পুলিশ একদল ছাত্রকে ডান্ডা দিয়ে বেধড়ক পেটাচ্ছে।
আচ্ছা, পুলিশ কোন লিঙ্গ ? জানতে চাওয়া হল প্রধানমন্ত্রী খালেদা জিয়ার কাছে।খালেদা বললেন, এটা স্বরাষ্ট্র মন্ত্রণালয়ে খোঁজ নিতে হবে।সেই খোঁজ আর আসে না দেখে এরশাদের কাছে জানতে চাওয়া হয়।তিনি বললেন যেহেতু পুলিশের ডান্ডা আছে তাই পুলিশ পুংলিঙ্গ।
এরপর প্রশ্ন উঠে আইন কোন লিঙ্গ।এবারও যথারীতি খালেদা জিয়া ফেলটুস।বলতে পারলেন না।অগত্যা আবার কাবিল এরশাদের কাছে জিজ্ঞাসা।তিনি ভেবেচিন্তে বললেন, আইনের ফাঁক আছে, তাই আইন স্ত্রী লিঙ্গ।

Cheers.

How to reboot single user mode

March 7, 2009

Port mirroring in cisco,extreme,juniper

March 3, 2009

http://www.networkintrusion.co.uk/index.php/miscellaneous/switchport.html

Solaris UNIX tape backup and recovery with tar and cpio command

September 15, 2008

We have recently brought a new Sun Solaris UNIX server. How do I Backup data and make a recovery for the Solaris OS?

A. Sun Solaris UNIX comes with various commands and utilities to make a backup and recovery job:

a) tar command
b) cpio command

Task: Use tar command to backup /data and /home directory

Usually /dev/rmt/0 is tape device name.
To create a new tar file you can type:
# tar cvf home-back.tar /home /data /etc/file1

To create a new tape backup use:
# tar cvf /dev/rmt/0 /home /data /etc/file1

Task: Display the contents of a tar file/tape

Pass tvf option to tar command:
# tar tvf home-back.tar
OR
# tar tvf /dev/rmt/0

Task: Restore files from tar file / tape

To extract the tar file to the current directory type:
# tar xvf home-back.tar
# tar xvf /dev/rmt/0

Understanding tar command options:

  • x : Extract tar file
  • v : Verbose
  • f : filename : Use to specify file name / tape device name
  • t : List tar file contents

Task: Backup files with cpio command

You can also use cpio command, which copies files into and out of a cpio archive. The cpio archive may span multiple volumes. The -i, -o, and -p options select the action to be performed. For example copy all *.c files to tape device or file called prog.cpio:
# ls *.c | cpio -oVc > /dev/rmt/0
OR
# ls *.c | cpio -oVc > prog.cpio

Task: Restore file using cpio

To copy from tape back to a directory, use the command as follows:
# cpio -icvD < /dev/rmt/0
OR
# cpio -icvum < /dev/rmt/0

Task: View the contents of cpio

Use the command as follows:
# cpio -ict < /dev/rmt/0

Understanding cpio command options:

  • : (copy in) Reads an archive from the standard input and conditionally extracts the files contained in it and places them into the current directory tree.
  • c : Reads or writes header information in ASCII character form for portability.
  • t : Prints a table of contents of the input.
  • o : (copy out) Reads a list of file path names from the standard input and copies those files to the standard output in the form of a cpio archive.
  • v : Verbose
  • : Use for an unconditional copy; old files will not replace newer versions.
  • m ; Retains previous file modification time.
  • d: Create as many directories as needed.

Further readings:

  • Read Solaris tar, tape and cpio man pages, by typing following command:

man tar
man tape
man cpio

Tar & Untar in one step in unix

September 15, 2008

 

tar cf – $yesterday/* | gzip > /tmp/ins-$yesterday.tar.gz

For tar.gz
gzip -dc target.tar.gz | tar xf -

For tar.bz2

bzip2 -dc target.tar.gz | tar xf -

How to split file & restore in Linux?

September 15, 2008
To split a file:

split -b200m book.rar book-split 

Here 200m is 200 MegaByte
book.rar is the source file to be splitted.
and book-split is prefix of generated file.
To restore the file:
cat book-split* > NEWFILENAME

Source:

Transforming a CSV Line to many lines based on comma

September 15, 2008

Here is the command to transform a line like:
<>
a,b,c,d,e

Command cat cdr_wap.log | tr “,” “n” | cat -n

It will be looks like:
1 a
2 b
3 c
4 d
5 e

Cheers.

Encrypting shell script

September 15, 2008

How to create a hard links in Linux / UNIX

September 15, 2008

Both Linux / UNIX allows the data of a file to have more than one name in separate places in the same file system. Such a file with more than one name for the same data is called a hard-linked file. How do I create a hard link in Linux / UNIX?AA hard link to a file is indistinguishable from the original directory entry; any changes to a file are effectively independent of the name used to reference the file. Hard links may not normally refer to directories and may not span file systems.

ln command to make links

ln command make links between files. By default, ln makes hard links.

ln command syntax

ln {source} {link}

Where,
=> source is an existing file
=> link is the file to create

To create hard link for foo file, enter:
ln foo bar
ls -i foo
ls -i bar

Hard links limitations

There are some issues with hard links that can sometimes make them unsuitable. First of all, because the link is identical to the thing it points to, it becomes difficult to give a command such as “list all the contents of this directory recursively but ignore any links”. Most modern operating systems don’t allow hard links on directories to prevent endless recursion. Another drawback of hard links is that they have to be located within the same file system, and most large systems today consist of multiple file systems.