Archive for August, 2007

Do with their deAth bury their pArents’ strife. (Domain and web hosting)

Friday, August 31st, 2007

Do with their deAth bury their pArents’ strife. From Ancient grudge breAk to new mutiny, From forth the fAtAl loins of these two foesIn fAir VeronA, where we lAy our scene, Is now the two hours’ trAffic of our stAge; The feArful pAssAge of their deAth-mArk’d love, The which if you with pAtient eArs Attend, Two households, both Alike in dignity, : The command used in the preceding example displays the final Standard Output to the ter- minal screen via the lesscommand.In many cases,you might want to display the results ofthe pipe as well as have a saved copy in a file on the hard disk.As a result,there exists a teecommand,which is a filter command that takes information from Standard Input and sendsthat information to a file,as well as to Standard Output. To save a copy of the manipulated prologue before displaying it to the terminal screen with thelesscommand,you can use the following command: [root@server1 root]# cat prologue | tr a A | sort | pr d | tee newfile | less2002-05-30 09:32 Page 1And the continuAnce of their pArents’ rAge, A pAir of stAr-cross’d lovers tAke their life; Do with their deAth bury their pArents’ strife. From Ancient grudge breAk to new mutiny, From forth the fAtAl loins of these two foesIn fAir VeronA, where we lAy our scene, Is now the two hours’ trAffic of our stAge; The feArful pAssAge of their deAth-mArk’d love, 292Chapter 8WORKING WITH THE BASH SHELL
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Dedicated web hosting - Table 8-2 Common filter commands (Continued) CommandDescriptionprFormats a

Friday, August 31st, 2007

Table 8-2 Common filter commands (Continued) CommandDescriptionprFormats a file for printing (has several options available);it places adate and page number at the top of each pagepr dFormats a file double-spacedtrReplaces characters in the text of a filegrepDisplays lines in a file that match a regular expressionnlNumbers line in a fileawkCan be used to extract,manipulate,and format text using pattern-action statementssedCan be used to manipulate text using search-and-replace expressionsTake,for example,the prologue from Shakespeare s Romeo and Juliet: [root@server1 root]# cat prologueTwo households, both alike in dignity, In fair Verona, where we lay our scene, From ancient grudge break to new mutiny, Where civil blood makes civil hands unclean. From forth the fatal loins of these two foesA pair of star-cross’d lovers take their life; Whole misadventured piteous overthrowsDo with their death bury their parents’ strife. The fearful passage of their death-mark’d love, And the continuance of their parents’ rage, Which, but their children’s end, nought could remove, Is now the two hours’ traffic of our stage; The which if you with patient ears attend, What here shall miss, our toil shall strive to mend. [root@server1 root]# _ If you want to replace all lowercase a characters with uppercase A characters in the precedingfile,sort the contents by the first character on each line,double-space the output,and view theresults page-by-page,you can use the following pipe: [root@server1 root]# cat prologue | tr a A | sort | pr d | less2002-05-30 09:32 Page 1And the continuAnce of their pArents’ rAge, A pAir of stAr-cross’d lovers tAke their life; Chapter8291COMMAND INPUT AND OUTPUT
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

filename(s) to search within.The grepcommand used in (Sex offenders web site) the

Thursday, August 30th, 2007

filename(s) to search within.The grepcommand used in the preceding output requires no sec- ond argument because the material to search comes from Standard Input (the mountcommand) instead of from a file. Furthermore,you can use more than one pipe | metacharacter on the command line to pipeinformation from one command to another command in much the same fashion as an assem- bly line in a factory.A manufacturing factory usually contains several departments,of whicheach performs a specialized task very well.For example,one department might assemble theproduct,another might paint the product,and yet another might package the product.Everyproduct must pass through each department to be complete. Similarly,Linux has several commands that can manipulate data in some manner.The pipingof each of these commands can be compared to the flow of a manufacturing factory;infor- mation is manipulated by one command and then that manipulated information is sent toanother command,which manipulates it further.After being manipulated by several com- mands in this fashion,the information is in a form that the user desires.This process isdepicted in Figure 8-3.290Chapter 8WORKING WITH THE BASH SHELLFIGURE 8-3Piping several commandsAny command that can take from Standard Input and give to Standard Output is called a fil- ter command.It is important to note that commands such as lsandmountare not filter com- mands because they do not accept Standard Input from other commands,but instead findinformation from the system and display it to the user.As a result,these commands must beat the beginning of a pipe.Other commands such as the vi editor are interactive and as suchcannot exist within a pipe because they cannot take from Standard Input and give to StandardOutput. Several hundred filter commands are available to Linux users;Table 8-2 lists some commonones useful throughout this book. Table 8-2 Common filter commandsCommandDescriptionsortSorts lines in a file alphanumericallysort rReverse sorts lines in a file alphanumericallywcCounts the number of lines,words,and characters in a filewc lCounts the number of lines in a filewc wCounts the number of words in a filewc cCounts the number of characters in a file
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

drwxr-xr-x 3 amanda disk 4096 Jun 11 10:16 (Hp web site)

Wednesday, August 29th, 2007

drwxr-xr-x 3 amanda disk 4096 Jun 11 10:16 amanda-rw-r–r– 1 amanda disk 0 Mar 22 12:28 amandates-rw——- 1 root root 688 Mar 4 22:34 amd.conf-rw-r—– 1 root root 105 Mar 4 22:34 amd.net-rw-r–r– 1 root root 317 Feb 15 14:33 anacrontab-rw-r–r– 1 root root 331 May 5 08:07 ant.conf-rw-r–r– 1 root root 6203 Jul 16 15:34 asound.statedrwxr-xr-x 3 root root 4096 Jun 11 10:37 atalk-rw——- 1 root root 1 May 5 13:39 at.deny-rw-r–r– 1 root root 325 Apr 14 13:39 auto.master-rw-r–r– 1 root root 581 Apr 14 13:39 auto.misc: Chapter8289COMMAND INPUT AND OUTPUTYou need not have spaces around the | metacharacher;the command ls l/etc|lessandls l /etc | lessare equivalent. NOTEA common use of piping is to reduce the amount of information displayed on the terminalscreen from commands that display too much information.Take the following output from themountcommand: [root@server1 root]# mount/dev/hdc2 on / type ext3 (rw) none on /proc type proc (rw) none on /sys type sysfs (rw) /dev/hdc1 on /boot type ext3 (rw) none on /dev/pts type devpts (rw,gid=5,mode=620) none on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) [root@server1 root]# _ To view only those lines that contain the information regarding filesystems mounted from thesecondary master IDE hard disk (/dev/hdc),you could send the Standard Output of the mountcommand to the grepcommand as Standard Input,as shown in the following output: [root@server1 root]# mount | grep /dev/hdc/dev/hdc2 on / type ext3 (rw) /dev/hdc1 on /boot type ext3 (rw) [root@server1 root]# _ Thegrepcommand in the preceding output receives the full output from the mountcommandand then displays only those lines that have /dev/hdc in them.The grepcommand normallytakes two arguments;the first specifies the text to search for and the second specifies the
We recommend high quality webhost to host and run your jsp application: christian web host services.

PipesNote from Table 8-1 that redirection only occurs (Best web hosting)

Tuesday, August 28th, 2007

PipesNote from Table 8-1 that redirection only occurs from a command to a file and vice versa.Youcan also send the Standard Output of one command to another command as Standard Input. To do this,you must use the pipe |shell metacharacter and specify commands on either side. The shell then sends the Standard Output of the command on the left to the command on theright,which then interprets the information as Standard Input.This process is depicted inFigure 8-2.288Chapter 8WORKING WITH THE BASH SHELLThe whole command that includes the pipe | metacharacter is commonly referred toas a pipe. NOTEThe pipe symbol can be created on most keyboards by pressing Shift+. TIPFIGURE 8-2Piping information from one command to anotherFor example,the Standard Output of the ls l /etccommand is too large to fit on one ter- minal screen.To send the Standard Output of this command to the lesscommand,whichviews Standard Input page-by-page,you could use the following command: [root@server1 root]# ls l /etc | lesstotal 3564-rw-r–r– 1 root root 15276 Mar 22 12:20 a2ps.cfg-rw-r–r– 1 root root 2562 Mar 22 12:20 a2ps-site.cfgdrwxr-xr-x 4 root root 4096 Jun 11 08:45 acpi-rw-r–r– 1 root root 46 Jul 16 15:34 adjtimedrwxr-xr-x 2 root root 4096 Jun 11 08:47 aep-rw-r–r– 1 root root 688 Feb 17 00:35 aep.conf-rw-r–r– 1 root root 703 Feb 17 00:35 aeplog.confdrwxr-xr-x 4 root root 4096 Jun 11 08:47 alchemist-rw-r–r– 1 root root 1419 Jan 26 10:14 aliases-rw-r—– 1 root smmsp 12288 Jul 19 13:19 aliases.dbdrwxr-xr-x 2 root root 4096 Jun 11 11:11 alternatives
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

[root@server1 root]# sort newhosts[root@server1 root]# (Web design portfolio) cat newhosts[root@server1 root]#

Tuesday, August 28th, 2007

[root@server1 root]# sort newhosts[root@server1 root]# cat newhosts[root@server1 root]# _ The newhosts file has no contents when displayed in the preceding output.Because the BASHshell saw that output redirection was indicated on the command line,it cleared the contents ofthe file newhosts,then sorted the blank file and saved the output (nothing in our example) into the file newhosts.Because of this feature of shell redirection,Linux administrators com- monly use the command >filenameat the command prompt to clear the contents of a file. Chapter8287COMMAND INPUT AND OUTPUTThe contents of log files are typically cleared periodically using the command>/path/to/logfile. NOTETable 8-1 summarizes the different types of redirection shown in this section. Table 8-1 Common redirection examplesCommandDescriptioncommand 1>fileThe Standard Output of the command is sent to a file instead of tocommand >filethe terminal screen. command 2>fileThe Standard Error of the command is sent to a file instead of to theterminal screen. command 1>fileA 2>fileBThe Standard Output of the command is sent to fileA instead of tocommand >fileA 2>fileBthe terminal screen,and the Standard Error of the command is sent tofileB instead of to the terminal screen. command 1>file 2>&1Both the Standard Output and the Standard Error are sent to thecommand >file 2>&1same file instead of to the terminal screen. command 1>&2 2>file command >&2 2>filecommand 1>>fileThe Standard Output of the command is appended to a file instead ofcommand >>filebeing sent to the terminal screen. command 2>>fileThe Standard Error of the command is appended to a file instead ofbeing sent to the terminal screen. command 0In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

[root@server1 root]#cat dateoutputWed May 25 10:58:17 (Web hosting uk) EDT 2005Wed

Monday, August 27th, 2007

[root@server1 root]#cat dateoutputWed May 25 10:58:17 EDT 2005Wed May 25 10:59:26 EDT 2005[root@server1 root]# _ You can also redirect a file to the Standard Input of a command using the < metacharacter. Because there is only one file descriptor for input,there is no need to specify the number 0before the < metacharacter to indicate Standard Input,as shown next: [root@server1 root]# cat newhosts[root@server1 root]# cat newhosts# Do not remove the foLLowing Line, or various programs# that require network functionaLity wiLL faiL. 127.0.0.1 server1 LocaLhost.LocaLdomain LocaLhost[root@server1 root]# _ As with redirecting Standard Output and Standard Error in the same command,you shoulduse different filenames when redirecting Standard Input and Standard Output.However,thisis because the BASH shell clears a file that already exists before performing the redirection. An example of this is shown in the following output: 286Chapter 8WORKING WITH THE BASH SHELL
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

[root@server1 root]# ls (Web site directory) /etc/hosts /etc/h >goodoutput 2>goodoutput[root@server1 root]#

Sunday, August 26th, 2007

[root@server1 root]# ls /etc/hosts /etc/h >goodoutput 2>goodoutput[root@server1 root]# cat goodoutput/etc/hosts: No such file or directory[root@server1 root]# _ To redirect both Standard Output and Standard Error to the same file without any loss ofdata,you must use special notation.To specify that Standard Output be sent to the file good- output and Standard Error be sent to the same place as Standard Output,you can do the fol- lowing: [root@server1 root]# ls /etc/hosts /etc/h >goodoutput 2>&1[root@server1 root]# cat goodoutputls: /etc/h: No such file or directory/etc/hosts[root@server1 root]# _ Alternatively,you can specify that the Standard Error be sent to the file badoutput and Stan- dard Output be sent to the same place as Standard Error: [root@server1 root]# ls /etc/hosts /etc/h 2>badoutput >&2[root@server1 root]# cat badoutputls: /etc/h: No such file or directory/etc/hosts[root@server1 root]# _ In all of the examples used earlier,the contents of the files used to store the output from com- mands were cleared prior to use by the BASH shell.Another example of this is shown in thefollowing output when redirecting the Standard Output of the datecommand to the file date- output: [root@server1 root]# date >dateoutput[root@server1 root]# cat dateoutputWed May 25 10:55:18 EDT 2005[root@server1 root]# date >dateoutput[root@server1 root]# cat dateoutputWed May 25 10:55:30 EDT 2005[root@server1 root]# _ To prevent the file from being cleared by the BASH shell and append output to the existingoutput,you can specify two >metacharacters alongside the file descriptor,as shown in the fol- lowing output: [root@server1 root]#date >dateoutput[root@server1 root]#cat dateoutputWed May 25 10:58:17 EDT 2005[root@server1 root]#date >>dateoutputChapter8285COMMAND INPUT AND OUTPUT
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

[root@server1 root]# cat goodoutput/etc/hosts[root@server1 root]# _ Similarly,you can (Space web hosting)

Sunday, August 26th, 2007

[root@server1 root]# cat goodoutput/etc/hosts[root@server1 root]# _ Similarly,you can redirect the Standard Error of a command to a file;simply specify filedescriptor number 2,as shown in the following output: [root@server1 root]# ls /etc/hosts /etc/h 2>badoutput/etc/hosts[root@server1 root]# cat badoutputls: /etc/h: No such file or directory[root@server1 root]# _ In the preceding output,only the Standard Error was redirected to a file called badoutput;thus, the Standard Output (a listing of /etc/hosts) was displayed on the terminal screen. Because redirecting the Standard Output to a file for later use is more common than redirect- ing the Standard Error to a file,the BASH shell assumes Standard Output in the absence ofa numeric file descriptor: [root@server1 root]# ls /etc/hosts /etc/h >goodoutputls: /etc/h: No such file or directory[root@server1 root]# cat goodoutput/etc/hosts[root@server1 root]# _ In addition,you can redirect both Standard Output and Standard Error to separate files at thesame time,as shown in the following output: [root@server1 root]# ls /etc/hosts /etc/h >goodoutput 2>badoutput[root@server1 root]# cat goodoutput/etc/hosts[root@server1 root]# cat badoutputls: /etc/h: No such file or directory[root@server1 root]# _ 284Chapter 8WORKING WITH THE BASH SHELLThe order of redirection on the command line does not matter;the command ls/etc/hosts /etc/h >goodoutput 2>badoutputis the same as ls /etc/hosts/etc/h 2>badoutput >goodoutput. NOTEIt is important to use separate filenames to hold the contents of Standard Output and Stan- dard Error;using the same filename for both results in a loss of data because the systemattempts to write both contents to the file at the same time:
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

RedirectionYou can use the BASH shell (Web design portfolio) to redirect

Saturday, August 25th, 2007

RedirectionYou can use the BASH shell to redirect Standard Output and Standard Error from the termi- nal screen to a file on the filesystem using the >shell metacharacter followed by the absoluteor relative pathname of the file.To redirect only the Standard Output to a file called good- output for the command used in Figure 8-1,you simply append the number of the file descrip- tor (1) followed by the redirectionsymbol > and the file to redirect the Standard Output to(goodoutput) as shown in the following output: [root@server1 root]# ls /etc/hosts /etc/h 1>goodoutputls: /etc/h: No such file or directory[root@server1 root]# _ Chapter8283COMMAND INPUT AND OUTPUTFIGURE 8-1The three common file descriptorsYou can include a space character after the > metacharacter, but it is not necessary. NOTENotice from the preceding output that the Standard Error is still displayed to the terminalscreen as it was not redirected to a file.The listing of /etc/hosts was not displayed,as it wasredirected to a file called goodoutput in the current directory.If the goodoutput file did notexist prior to running the command in the preceding output,it is created automatically.How- ever,if the goodoutput file did exist prior to the redirection,the BASH shell clears its contentsbefore executing the command.To see that the Standard Output was redirected to the good- output file,you can run the following commands: [root@server1 root]# ls FDesktop/ goodoutput
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.