Posts

Showing posts from February, 2010

SQUID Server

Image
How SQUID server communicate with router & layer 3 switch Interception caching is a popular technique for getting traffic to Squid without configuring any clients. Instead, you configure a router or switch to divert HTTP connections to the machine on which Squid is running. Squid's operating system is configured to accept the foreign packets and deliver them to the Squid process. To make HTTP interception work, you need to configure three separate components: a network device, Squid's operating system, and Squid itself. The user-agent wants to request a resource, say /index.html from an origin server, say a-to-z-networking.blogspot.com. It needs the origin server's IP address, so it makes a DNS request: Now that it has the IP address, the user-agent initiates a TCP connection to the origin server on port 80: The switch/router notices a TCP SYN packet with destination port 80. What happens next depends on the particular interception technology. In the case of l...

Unix Commands Part 8

System Status at , chmod , chgrp , chown , crontab , date , df , du , env , finger , ps , ruptime , shutdwon , stty , who . At command. at command along with crontab command is used to schedule jobs. at options time [ddate] [+increment] is syntax of at command. for example if I have a script named usersloggedin which contains. #!/bin/ksh who | wc -l echo "are total number of people logged in at this time." and I want to run this script at 8:00 AM. So I will first type at 8:00 %lt;enter> usersloggedin %lt;enter> I will get following output at 8:00 AM 30 are total number of people logged in at this time. Options: -f file will execute commands in a file. -m will send mail to user after job is completed. -l will report all jobs that are scheduled and their jobnumbers. -r jobnumber will remove specified jobs that were previously scheduled. Chmod command. chmod command is used to change permissions on a file. for example if I have a text file with calender in it ca...

Unix Commands Part 7

Storage commands compress uncompress , cpio , dump , pack , tar , mt . Compress command. Compress command compresses a file and returns the original file with .z extension, to uncompress this filename .Z file use uncompress filename command. syntax for compress command is compress options files Options -bn limit the number of bits in coding to n. -c write to standard output (do not change files). -f compress conditionally, do not prompt before overwriting files. -v Print the resulting percentage of reduction for files. Uncompress command. Uncompress file uncompresses a file and return it to its original form. syntax is uncompress filename.Z this uncompresses the compressed file to its original name. Options -c write to standard output without changing files Cpio command. cpio command is useful to backup the file systems. It copy file archives in from or out to tape or disk, or to another location on the local machine. Its syntax is cpio flags [options] It has three flags, -i, -...

Unix Commands Part 6

Communications cu , ftp , login , rlogin , talk , telnet , vacation and write . Cu command. cu command is used for communications over a modem or direct line with another Unix system. Syntax is cu options destination Options -b n process lines using n-bit characters (7 or 8). -c name Search UUCP's device file and select local area network that matches name. -d Prints diagnostics. -e sends even parity data to remote system -l line communicate on this device (line=/dev/tty001, etc) -n prompts for a telephone number. -s n set transmission rate to n(e.g 1200,2400,9600, BPS) Destination telno is the telephone number of the modem to connect to. system is call the system known to uucp. aadr is an address specific to LAN. Ftp command (protocol). ftp command is used to execute ftp protocol using which files are transferred over two systems. Syntax is ftp options hostname options -d enable debugging. -g disable filename globbing. -i turn off interactive prompts. -v verbose on...

Unix Commands Part 5

Shell and programming Shell programming , bourne shell , ksh , csh , echo , line , sleep , test , cc compiler . Shell programming concepts and commands. Shell programming is integral part of Unix operating systems. Shell is command line userinterface to Unix operating system, User have an option of picking an interface on Unix such as ksh, csh, or default sh., these are called shells(interface). Shell programming is used to automate many tasks. Shell programming is not a programming language in the truest sense of word since it is not compiled but rather an interpreted language. Unix was written in C language and thus c language is integral part of unix and available on all versions. Shells, like ksh and csh are popular shells on unix although there are 5 or 6 different shells available but I will only be discussing ksh and csh as well as sh. Common features among all shells are job control, for example if I am running a processes which is searching the whole system for .Z files and o...

Unix Commands Part 4

Text processing cut , paste , sort , uniq , awk , sed , vi . Cut command. cut command selects a list of columns or fields from one or more files. Option -c is for columns and -f for fields. It is entered as cut options [files] for example if a file named testfile contains this is firstline this is secondline this is thirdline Examples: cut -c1,4 testfile will print this to standard output (screen) ts ts ts It is printing columns 1 and 4 of this file which contains t and s (part of this ). Options: -c list cut the column positions identified in list. -f list will cut the fields identified in list. -s could be used with -f to suppress lines without delimiters. Paste Command. paste command merge the lines of one or more files into vertical columns separated by a tab. for example if a file named testfile contains this is firstline and a file named testfile2 contains this is testfile2 then running this command paste testfile testfile2 > outputfile will put this into outputfile this is...

Unix Commands Part 3

Comparison and Searching diff , dircmp , cmp , grep , find . Diff command. diff command will compare the two files and print out the differences between. Here I have two ascii text files. fileone and file two. Contents of fileone are This is first file this is second line this is third line this is different as;lkdjf this is not different filetwo contains This is first file this is second line this is third line this is different xxxxxxxas;lkdjf this is not different diff fileone filetwo will give following output 4c4 this is different xxxxxxxas;lkdjf Cmp command. cmp command compares the two files. For exmaple I have two different files fileone and filetwo. cmp fileone filetwo will give me fileone filetwo differ: char 80, line 4 if I run cmp command on similar files nothing is returned. -s command can be used to return exit codes. i.e. return 0 if files are identical, 1 if files are different, 2 if files are inaccessible. This following command prints a message 'n...

Unix Commands Part 2

File Management commands. cat , cd , cp , file , head , tail , ln , ls , mkdir , more , mv , pwd , rcp , rm , rmdir , wc . Pwd command. pwd command will print your home directory on screen, pwd means print working directory. /u0/ssb/sandeep is output for the command when I use pwd in /u0/ssb/sandeep directory. Ls command ls command is most widely used command and it displays the contents of directory. options ls will list all the files in your home directory, this command has many options. ls -l will list all the file names, permissions, group, etc in long format. ls -a will list all the files including hidden files that start with . . ls -lt will list all files names based on the time of creation, newer files bring first. ls -Fx will list files and directory names will be followed by slash. ls -R will lists all the files and files in the all the directories, recursively. ls -R | more will list all the files and files in all the directories, one page at a time. Mkdir comman...

Unix Commands Part 1

Misc commands man , banner , cal , calendar , clear , nohup , tty . Man ual command. man man This is help command, and will explains you about online manual pages you can also use man in conjunction with any command to learn more about that command for example. man ls will explain about the ls command and how you can use it. man -k pattern command will search for the pattern in given command. Banner command. banner prints characters in a sort of ascii art poster, for example to print wait in big letters. I will type banner wait at unix command line or in my script. This is how it will look. # # ## # ##### # # # # # # # # # # # # # ## # ###### # # ## ## # # # # # # # # # # Cal command cal command will print the calander on current month by default. If you want to print calander of august of 1965. That's eightht month of 1965. cal 8 1965 will print following results. Augus...

AT Utility - A quick guide to At jobs in Sun Solaris

A quick reference guide for “at” utility in Sun Solaris. “at” utility in unix is similar to the “cron” daemon except for that “at” jobs are run only once while cron jobs are recurring. “at” is primarily used to schedule a job which can be command or a script to run once at a particular time although it can be made to reschedule the job. This could be immediatly or at a later time. The at utility reads commands from standard input and groups them together as an at job, to be executed at a later time. List AT jobs To list all the at jobs scheduled on the Sun Server sunsolaris# at -l user = root 1210161000.a Wed May 7 12:50:00 2008 user = root 1210161001.a Wed May 7 12:50:01 2008 user = root 1210198500.a Wed May 7 23:15:00 2008 user = root 1210331460.a Fri May 9 12:11:00 2008 user = root 1210198320.a Wed May 7 23:12:00 2008 To run a command at a particular time sunsolaris# at -t 200805072312 at> reboot at> commands will...