Archive for July, 2007

Learning Linux Commands150Sorting text filesYou can sort (Bulletproof web design) the

Monday, July 16th, 2007

ShellLearning Linux Commands149As each screen pauses, I press (Dedicated web hosting)

Monday, July 16th, 2007

ShellLearning Linux Commands149As each screen pauses, I press the spacebar to go to the next page. Many more Linux commands work on files mostly on text files, but somecommands also work on any file. I describe a few of the file-processingtoolsnext. Counting words and lines in a text fileI am always curious about the size of files. For text files, the number of charac- ters is basically the size of the file in bytes (because each character takes up abyte of storage space). What about words and the number of lines, though? The Linux wccommand comes to the rescue. The wccommand displays thetotal number of characters, words, and lines in a text file. For example, trythe following command: wc /etc/inittab53 229 1666 /etc/inittab The second line shows the output. In this case, wcreports that 53 lines, 229words, and 1666 characters are in the /etc/inittabfile. If you simply wantto see the number of lines in a file, use the -loption, such as this: wc l /etc/inittab53 /etc/inittabAs you can see, in this case, wcsimply displays the line count. If you don t specify a filename, the wccommand expects input from the stan- dard input. You can use the pipe feature of the shell to feed the output ofanother command to wc,which can be handy sometimes. Suppose you want a rough count of the processes running on your system. You can get a list of all processes with the ps axcommand, but instead ofcounting lines manually, just pipe the output of psto wcand you get a roughcount automatically: ps ax | wc -l76Here the pscommand produced 76 lines of output. Because the first linesimply shows the headings for the tabular columns, you can estimate thatabout 75 processes are running on your system. (Of course, this count prob- ably includes the processes used to run the psand wccommands as well, but who s reallycounting?)
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

Learning Linux Commands148As you can see, the datecommand (Web design templates)

Sunday, July 15th, 2007

Learning Linux Commands148As you can see, the datecommand alone displays the current date and time. To set the date, log in as rootand then type datefollowed by the date andtime in the MMDDhhmmYYYYformat, where each character is a digit. For exam- ple, to set the date and time to December 31, 2004 and 9:30 p.m., you typedate 123121302004The MMDDhhmmYYYYdate and time format is similar to the 24-hour militaryclock, and has the following meaning: .MMis a two-digit number for the month (01 through 12). .DDis a two-digit number for the day of the month (01 through 31). .hhis a two-digit hour in 24-hour format (00 is midnight and 23 is 11:00 PM). .mmis a two-digit number for the minutes (00 through 59). .YYYYis the 4-digit year (such as 2004). The other interesting date-related command is cal. If you type calwithoutany options, it prints a calendar for the current month. If you type calfol- lowed by a number, caltreats the number as the year and prints the calen- dar for that year. To view the calendar for a specific month in a specific year, provide the month number (1 = January, 2 = February, and so on) followedby the year. Thus, to view the calendar for January 2005, type the followingand you get the calendar for that month: cal 1 2005January 2005Su Mo Tu We Th Fr Sa12 3 4 5 6 7 89 10 11 12 13 14 1516 17 18 19 20 21 2223 24 25 26 27 28 2930 31Processing filesYou can search through a text file with grepand view a text file, a screen at atime, with more. For example, to search for my username in the /etc/passwdfile, I usegrep naba /etc/passwdTo view the /etc/inittabfile a screenful at a time, I typemore /etc/inittab
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

ShellLearning Linux Commands147Managing processesEvery time the shell executes (Web design)

Sunday, July 15th, 2007

ShellLearning Linux Commands147Managing processesEvery time the shell executes a command that you type, it starts a process. The shell itself is a process. So are any scripts or programs that the shell runs. Use the ps axcommand to see a list of processes. When you type ps ax, Bash shows you the current set of processes. Here are a few lines of outputfrom the ps axcommand (I also included the –cols 132option to ensurethat you can see each command in its entirety): ps ax –cols 132PID TTY STAT TIME COMMAND1 ? S 0:06 init [5] 2 ? SWN 0:01 [ksoftirqd/0] 3 ? SW< 0:00 [events/0] 4 ? SW< 0:04 [kblockd/0] 8 ? SW< 0:00 [aio/0] 5 ? SW 0:00 [pdflush] 6 ? SW 0:01 [pdflush] 7 ? SW 0:20 [kswapd0] 9 ? SW 0:00 [kseriod] 13 ? SW 0:20 [kjournald] ... lines deleted ... 8973 pts/2 R 0:00 ps ax --cols 132In this listing, the first column has the heading PIDand shows a number foreach process. PID stands for process ID(identification), which is a sequentialnumber assigned by the Linux kernel. If you look through the output of theps axcommand, you see that the initcommand is the first process andthat it has a PID or process number of 1. That s why initis referred to asthe mother of all processes. The COMMANDcolumn shows the command that created each process. The process ID or process number is useful when you have to forcibly stop anerrant process. Look at the output of the ps axcommand and note the PIDofthe offending process. Then, use the killcommand with that process number. To stop process number 8550, for example, type the following command: kill -9 8550Working with date and timeYou can use the datecommand to display the current date and time or set anew date and time. Type the datecommand at the shell prompt and you geta result similar to the following: dateMon Apr 19 21:51:33 EST 2004
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Learning Linux Commands146Table 2-1 (continued) Command NameActionduDisplays disk (Web server iis)

Sunday, July 15th, 2007

Learning Linux Commands146Table 2-1 (continued) Command NameActionduDisplays disk usage information. fdformatFormats a diskette. fdiskPartitions a hard disk. fsckChecks and repairs a file system. mkfsCreates a new file system. mknodCreates a device file. mkswapCreates a swap space for Linux in a file or a disk partition. mountMounts a device (for example, the CD-ROM) on a directory inthe file system. swapoffDeactivates a swap space. swaponActivates a swap space. syncWrites buffered (saved in memory) data to files. ttyDisplays the device name for the current terminal. umountUnmounts a device from the file system. Working with Date and TimecalDisplays a calendar for a specified month or year. dateShows the current date and time or sets a new date and time. Becoming root (superuser) When you want to do anything that requires a high privilege level (for exam- ple, administering your system), you have to become root. Normally you login as a regular user with your normal username. When you need the privi- leges of the superuser, though, use the following command to become root: su - That s sufollowed by the minus sign (or hyphen). The shell then promptsyou for the rootpassword. Type the password and press Enter. After you re done with whatever you wanted to do asroot(and you havethe privilege to do anything as root), type exitto return to your normal self. Instead of becoming rootby using the sucommand, you can also type sudo, followed by the command that you want to run as root. If you are listed asan authorized user in the /etc/sudoersfile, sudoexecutes the command as if you were logged in as root. Type man sudoersto read more about the/etc/sudoersfile.
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Photography web hosting - ShellLearning Linux Commands145Command NameActionArchiving and Compressing FilescompressCompresses files.

Sunday, July 15th, 2007

ShellLearning Linux Commands145Command NameActionArchiving and Compressing FilescompressCompresses files. cpioCopies files to and from an archive. gunzipDecompresses files compressed with GNU ZIP (gzip). gzipCompresses files using GNU ZIP. tarCreates an archive of files in one or more directories (originallymeant for archiving on tape). uncompressDecompresses files compressed with compress. Managing ProcessesbgRuns an interrupted process in the background. fgRuns a process in the foreground. freeDisplays the amount of free and used memory in the system. haltShuts down Linux and halts the computer. killSends a signal to a process (usually used to terminate aprocess). lddDisplays the shared libraries needed to run a program. niceRuns a process with lower priority (referred to as nicemode). psDisplays a list of currently running processes. printenvDisplays the current environment variables. pstreeSimilar to ps, but shows parent-child relationships clearly. rebootStops Linux and then restarts the computer. shutdownShuts down Linux. topDisplays a list of most processor- and memory-intensiveprocesses. unameDisplays information about the system and the Linux kernel. Managing UserschshChanges the shell (command interpreter). groupsPrints the list of groups that includes a specified user. idDisplays the user and group ID for a specified username. passwdChanges the password. suStarts a new shell as another user or root(when invokedwithout any argument). Managing the File SystemdfSummarizes free and available space in all mounted storagedevices. (continued)
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

Learning Linux Commands144Table 2-1 (continued) Command NameActionwhereisFinds files (Unlimited web hosting)

Saturday, July 14th, 2007

Learning Linux Commands144Table 2-1 (continued) Command NameActionwhereisFinds files based in the typical directories where executable(also known as binary) files are located. whichFinds files in the directories listed in the PATH environment variable. Processing FilescatDisplays a file on standard output (can be used to concatenateseveral files into one big file). cutExtracts specified sections from each line of text in a file. ddCopies blocks of data from one file to another (used to copydata from devices). diffCompares two text files and finds any differences. expandConverts all tabs into spaces. fileDisplays the type of data in a file. foldWraps each line of text to fit a specified width. grepSearches for regular expressions within a text file. lessDisplays a text file, one page at a time (can go backward also). lprPrints files. moreDisplays a text file, one page at a time (goes forward only). nlNumbers all nonblank lines in a text file and prints the lines tostandard output. pasteConcatenates corresponding lines from several files. patchUpdates a text file using the differences between the originaland revised copy of the file. sedCopies a file to standard output while applying specified editingcommands. sortSorts lines in a text file. splitBreaks up a file into several smaller files with specified size. tacReverses a file (last line first and so on). tailDisplays the last few lines of a file. trSubstitutes one group of characters for another throughout afile. uniqEliminates duplicate lines from a text file. wcCounts the number of lines, words, and characters in a text file. zcatDisplays a compressed file (after decompressing). zlessDisplays a compressed file one page at a time (can go back- ward also). zmoreDisplays a compressed file one page at a time.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

ShellLearning Linux Commands143command-line utilities that come with Linux. (Web hosting solutions)

Saturday, July 14th, 2007

ShellLearning Linux Commands143command-line utilities that come with Linux. In this section, I introduce youto a few major categories of Linux commands. I can t possibly cover all the Linux commands in this chapter, but I want togive you a feel for the breadth of the commands by showing you a list ofcommon Linux commands in Table 2-1. It lists common Linux commands bycategory. Before you start learning any Linux commands, browse this table. Table 2-1Overview of Common Linux CommandsCommand NameActionGetting Online HelpaproposFinds online manual pages for a specified keyword. infoDisplays online help information about a specified command. manDisplays online help information. whatisSimilar to apropos, but searches for complete words only. Making Commands EasieraliasDefines an abbreviation for a long command. typeShows the type and location of a command. unaliasDeletes an abbreviation defined using alias. Managing Files and DirectoriescdChanges the current directory. chmodChanges file permissions. chownChanges file owner and group. cpCopies files. lnCreates symbolic links to files and directories. lsDisplays the contents of a directory. mkdirCreates a directory. mvRenames a file as well as moves a file from one directory toanother. rmDeletes files. rmdirDeletes directories. pwdDisplays the current directory. touchUpdates a file s time stamp. Finding FilesfindFinds files based on specified criteria such as name, size, andso on. locateFinds files using a periodically updated database. (continued)
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Learning Linux Commands142Repeating previously typed commandsTo make repeating (Web hosting service)

Saturday, July 14th, 2007

Learning Linux Commands142Repeating previously typed commandsTo make repeating long commands easy for you, Bash stores up to 500 oldcommands. Bash keeps a command history(a list of old commands). To seethe command history, type history. Bash displays a numbered list of the oldcommands, including those that you entered during previous logins. If the command list is too long, you can limit the number of old commands youwant to see. To see only the most recent 10 commands, type this command: history 10To repeat a command from the list that the historycommand shows, simplytype an exclamation point (!), followed by that command s number. To repeatcommand number 3, type !3. You can repeat an old command without knowing its command number. Suppose you typed more /usr/lib/X11/xdm/xdm-configa few minutesago, and now you want to look at that file again. To repeat the previous morecommand, type the following: !moreOften, you may want to repeat the last command that you just typed, perhapswith a slight change. For example, you may have displayed the contents ofthe directory by using the ls -lcommand. To repeat that command, typetwo exclamation points as follows: !! Sometimes, you may want to repeat the previous command but add extraarguments to it. Suppose that ls -lshows too many files. Simply repeatthat command, but pipe the output through the morecommand as follows: !! | moreBash replaces the two exclamation points with the previous command andthen appends | moreto that command. Here s the easiest way to recall previous commands. Just press the up-arrowkey and Bash keeps going backward through the history of commands youpreviously typed. To move forward in the command history, press the down- arrow key. Learning Linux CommandsYou type Linux commands at the shell prompt. By Linux commands,I meansome of the commands that the Bash shell understands as well as the
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Business web site - ShellUsing the Bash Shell141Wildcards are handy when you

Saturday, July 14th, 2007

ShellUsing the Bash Shell141Wildcards are handy when you want to do something to a whole lot of files. For example, to copy all the files from the /mnt/cdromdirectory to the cur- rent directory, type the following: cp /mnt/cdrom/* . Bash replaces the wildcard character *with the names of all the files in the/mnt/cdromdirectory. The period at the end of the command represents thecurrent directory. You can use the asterisk with other parts of a filename to select a more spe- cific group of files. Suppose you want to use the grepcommand to searchfor the text typedef structin all files of the /usr/includedirectory thatmeet the following criteria: .The filename starts with s. .The filename ends with .h. The wildcard specification s*.hdenotes all filenames that meet these crite- ria. Thus you can perform the search with the following command: grep typedef struct /usr/include/s*.hThe string contains a space that you want the grepcommand to find, so youhave to enclose that string in quotation marks. That way, Bash does not tryto interpret each word in that text as a separate command-line argument. The question mark (?) matches a single character. Suppose that you havefour files image1.pcx, image2.pcx, image3.pcx, and image4.pcx in thecurrent directory. To copy these files to the /mnt/floppydirectory, use thefollowing command: cp image?.pcx /mnt/floppyBash replaces the single question mark with any single character, and copiesthe four files to /mnt. The third wildcard format […] matches a single character from aspecific set of characters enclosed in square brackets. You may want to com- bine this format with other wildcards to narrow down the matching file- names to a smaller set. To see a list of all filenames in the /etc/X11/xdmdirectory that start with xor X, type the following command: ls /etc/X11/xdm/[xX]*
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.