Archive for July, 2007

Vps web hosting - Chapter 2 . Running Commands from the Shell

Tuesday, July 31st, 2007

Chapter 2 . Running Commands from the Shell 75 . /The.*foot Searches forward for a line that has the word The in it and also, after that at some point, the word foot. . ?[pP]rint Searches backward for either print or Print. Remember that case matters in Linux, so make use of brackets to search for words that could have different capitalization. The vi editor was originally based on the ex editor, which didn t let you work in fullscreen mode. However, it did enable you to run commands that let you find and change text on one or more lines at a time. When you type a colon and the cursor goes to the bottom of the screen, you are essentially in ex mode. Here is an example of some of those ex commands for searching for and changing text. (I chose the words Local and Remote to search for, but you can use any appropriate words.) . :g/Local Searches for the word Local and prints every occurrence of that line from the file. (If there is more than a screenful, the output is piped to the more command.) . :s/Local/Remote Substitutes Remote for the word Local on the current line. . :g/Local/s//Remote Substitutes the first occurrence of the word Local on every line of the file with the word Remote. . :g/Local/s//Remote/g Substitutes every occurrence of the word Local with the word Remote in the entire file. . :g/Local/s//Remote/gp Substitutes every occurrence of the word Local with the word Remote in the entire file, and then prints each line so that you can see the changes (piping it through more if output fills more than one page). Using Numbers with Commands You can precede most vi commands with numbers to have the command repeated that number of times. This is a handy way to deal with several lines, words, or characters at a time. Here are some examples: . 3dw Deletes the next three words. . 5cl Changes the next five letters (that is, removes the letters and enters input mode). . 12j Moves down 12 lines. Putting a number in front of most commands just repeats those commands. At this point, you should be fairly proficient at using the vi command. When you invoke vi in many Linux systems, you re actually invoking the vim text editor, which runs in vi compatibility mode. Those who do a lot of programming might prefer vim because it shows different levels of code in different colors. vim has other useful features, such as the capability to open a document with the cursor at the same place as it was when you last exited that file. Note
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

74 Part I . Linux First Steps . (Web hosting india)

Tuesday, July 31st, 2007

74 Part I . Linux First Steps . :! command You can run a command while you are in vi using :! followed by a command name. For example, type :!date to see the current date and time, type :!pwd to see what your current directory is, or type :!jobs to see if you have any jobs running in the background. When the command completes, press Enter and you are back to editing the file. You could even use this technique to launch a shell (:!bash) from vi, run a few commands from that shell, and then type exit to return to vi. (I recommend doing a save before escaping to the shell, just in case you forget to go back to vi.) . — INSERT When you are in insert mode, the word INSERT appears at the bottom of the screen. . Ctrl+G If you forget what you are editing, pressing these keys displays the name of the file that you are editing and the current line that you are on at the bottom of the screen. It also displays the total number of lines in the file, the percentage of how far you are through the file, and the column number the cursor is on. This just helps you get your bearings after you ve stopped for a cup of coffee at 3 a.m. Moving Around the File Besides the few movement commands described earlier, there are other ways of moving around a vi file. To try these out, open a large file that you can t do much damage to. (Try copying /var/log/messages to /tmp and opening it in vi.) Here are some movement commands you can use: . Ctrl+F Page ahead, one page at a time. . Ctrl+B Page back, one page at a time. . Ctrl+D Page ahead one-half page at a time. . Ctrl+U Page back one-half page at a time. . G Go to the last line of the file. . 1G Go to the first line of the file. (Use any number to go to that line in the file.) Searching for Text To search for the next occurrence of text in the file, use either the slash (/) or the question mark (?) character. Follow the slash or question mark with a pattern (string of text) to search forward or backward, respectively, for that pattern. Within the search, you can also use metacharacters. Here are some examples: . /hello Searches forward for the word hello. . ?goodbye Searches backward for the word goodbye.
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Chapter 2 . Running Commands from (Web hosting billing) the Shell

Monday, July 30th, 2007

Chapter 2 . Running Commands from the Shell 73 . M Moves the cursor to the first character of the middle line on the screen. . L Moves the cursor to the lower-left corner of the screen (last line on the screen). The only other editing you need to know is how to delete text. Here are a few vi commands for deleting text: . x Deletes the character under the cursor. . X Deletes the character directly before the cursor. . dw Deletes from the current character to the end of the current word. . d$ Deletes from the current character to the end of the current line. . d0 Deletes from the previous character to the beginning of the current line. To wrap things up, use the following keystrokes for saving and quitting the file: . ZZ Save the current changes to the file and exit from vi. . :w Save the current file but continue editing. . :wq Same as ZZ. . :q Quit the current file. This works only if you don t have any unsaved changes. . :q! Quit the current file and don t save the changes you just made to the file. If you ve really trashed the file by mistake, the :q! command is the best way to exit and abandon your changes. The file reverts to the most recently changed version. So, if you just did a :w, you are stuck with the changes up to that point. If you just want to undo a few bad edits, press u to back out of changes. You have learned a few vi editing commands. I describe more commands in the following sections. First, however, here are a few tips to smooth out your first trials with vi: . Esc Remember that Esc gets you back to command mode. (I ve watched people press every key on the keyboard trying to get out of a file.) Esc followed by ZZ gets you out of command mode, saves the file, and exits. . u Press U to undo the previous change you made. Continue to press u to undo the change before that, and the one before that. . Ctrl+R If you decide you didn t want to undo the previous command, use Ctrl+R for Redo. Essentially, this command undoes your undo. . Caps Lock Beware of hitting Caps Lock by mistake. Everything you type in vi has a different meaning when the letters are capitalized. You don t get a warning that you are typing capitals things just start acting weird. Tip
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Web server hosting - 72 Part I . Linux First Steps If

Monday, July 30th, 2007

72 Part I . Linux First Steps If this is a new file, you should see something similar to the following: ~~~~~ /tmp/test [New File] The box at the top represents where your cursor is. The bottom line keeps you informed about what is going on with your editing (here you just opened a new file). In between, there are tildes (~) as filler because there is no text in the file yet. Now here s the intimidating part: There are no hints, menus, or icons to tell you what to do. On top of that, you can t just start typing. If you do, the computer is likely to beep at you. And some people complain that Linux isn t friendly. The first things you need to know are the different operating modes: command and input. The vi editor always starts in command mode. Before you can add or change text in the file, you have to type a command (one or two letters and an optional number) to tell vi what you want to do. Case is important, so use uppercase and lowercase exactly as shown in the examples! To get into input mode, type an input command. To start out, type either of the following: . a The add command. After it, you can input text that starts to the right of the cursor. . i The insert command. After it, you can input text that starts to the left of the cursor. Type a few words and then press Enter. Repeat that a few times until you have a few lines of text. When you re finished typing, press Esc to return to command mode. Now that you have a file with some text in it, try moving around in your text with the following keys or letters: Remember the Esc key! It always places you back into command mode. .Arrow keys Move the cursor up, down, left, or right in the file one character at a time. To move left and right you can also use Backspace and the space bar, respectively. If you prefer to keep your fingers on the keyboard, move the cursor with h (left), l (right), j (down), or k (up). . w Moves the cursor to the beginning of the next word. . b Moves the cursor to the beginning of the previous word. . 0 (zero) Moves the cursor to the beginning of the current line. . $ Moves the cursor to the end of the current line. . H Moves the cursor to the upper-left corner of the screen (first line on the screen). Tip
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Chapter 2 . Running Commands from (Web server hosting) the Shell

Sunday, July 29th, 2007

Chapter 2 . Running Commands from the Shell 71 The vi editor is difficult to learn at first, but once you know it, you never have to use a mouse or a function key you can edit and move around quickly and efficiently within files just by using the keyboard. Starting with vi Most often, you start vi to open a particular file. For example, to open a file called /tmp/test, type the following command: $ vi /tmp/test Exploring Other Text Editors Dozens of text editors are available for use with Linux. Here are a few that might be in your Linux distribution, which you can try out if you find vi to be too taxing. Text Editor Description nano A popular, streamlined text editor that is used with many bootable Linuxes and other limited-space Linux environments. For example, nano is often available to edit text files during a LInux install process. gedit The GNOME text editor that runs in the GUI. jed This screen-oriented editor was made for programmers. Using colors, jed can highlight code you create so you can easily read the code and spot syntax errors. Use the Alt key to select menus to manipulate your text. joe The joe editor is similar to many PC text editors. Use control and arrow keys to move around. Press Ctrl+C to exit with no save or Ctrl+X to save and exit. kate A nice-looking editor that comes in the kdebase package. It has lots of bells and whistles, such as highlighting for different types of programming languages and controls for managing word wrap. kedit A GUI-based text editor that comes with the KDE desktop. mcedit With mcedit, function keys help you get around, save, copy, move, and delete text. Like jed and joe, mcedit is screen-oriented. nedit An excellent programmer s editor. You need to install the optional nedit package to get this editor. If you use ssh to log in to other Linux computers on your network, you can use any editor to edit files. A GUI-based editor will pop up on your screen. When no GUI is available, you will need a text editor that runs in the shell, such as vi, jed, or joe.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Web site counters - 70 Part I . Linux First Steps Moving,

Sunday, July 29th, 2007

70 Part I . Linux First Steps Moving, Copying, and Deleting Files Commands for moving, copying, and deleting files are fairly straightforward. To change the location of a file, use the mv command. To copy a file from one location to another, use the cp command. To remove a file, use the rm command. Here are some examples: $ mv abc def $ mv abc ~ $ cp abc def $ cp abc ~ $ rm abc $ rm * Of the two move (mv) commands, the first moves the file abc to the file def in the same directory (essentially renaming it), whereas the second moves the file abc to your home directory (~). The first copy command (cp) copies abc to the file def, whereas the second copies abc to your home directory (~). The first remove command (rm) deletes the abc file; the second removes all the files in the current directory (except those that start with a dot). For the root user, the mv, cp, and rm commands are aliased to each be run with the -i option. This causes a prompt to appear asking you to confirm each move, copy, and removal, one file at a time, and is done to prevent the root user from messing up a large group of files by mistake. Another alternative with mv is to use the -b option. With -b, if a file of the same name exists at the destination, a backup copy of the old file is made before the new file is moved there. Using the vi Text Editor It s almost impossible to use Linux for any period of time and not need to use a text editor. This is because most Linux configuration files are plain text files that you will almost certainly need to change manually at some point. If you are using a GUI, you can run gedit, which is fairly intuitive for editing text. There s also a simple text editor you can run from the shell called nano. However, most Linux shell users will use either the vi or emacs command to edit text files. The advantage of vi or emacs over a graphical editor is that you can use it from any shell, a character terminal, or a character-based connection over a network (using telnet or ssh, for example) no GUI is required. They also each contain tons of features, so you can continue to grow with them. This section provides a brief tutorial on the vi text editor, which you can use to manually edit a configuration file from any shell. (If vi doesn t suit you, see the Exploring Other Text Editors sidebar for other options.) Note
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Apache web server for windows - Chapter 2 . Running Commands from the Shell

Saturday, July 28th, 2007

Chapter 2 . Running Commands from the Shell 69 You can also turn file permissions on and off using plus (+) and minus ( ) signs, respectively. This can be done for the owner user (u), owner group (g), others (o), and all users (a). For example, start with a file that has all permissions open (rwxrwxrwx). Run the following chmod commands using minus sign options. The resulting permissions are shown to the right of each command: chmod a-w file r-xr-xr-x chmod o-x file rwsrwsrwchmod go-rwx file rwx—— Likewise, here are some examples, starting with all permissions closed (———) where the plus sign is used with chmod to turn permissions on: chmod u+rw files rw——- chmod a+x files –x–x–x chmod ug+rx files r-xr-x— When you create a file, it s given the permission rw-r–r– by default. A directory is given the permission rwxr-xr-x. These default values are determined by the value of umask. Type umask to see what your umask value is. For example: $ umask 022 The umask value masks the permissions value of 666 for a file and 777 for a directory. The umask value of 022 results in permission for a directory of 755 (rwxr-xr-x). That same umask results in a file permission of 644 (rw-r–r–). (Execute permissions are off by default for regular files.) Time saver: use the -R options of chmod, to change the permission for all of the files and directories within a directory structure at once. For example, if you wanted to open permissions completely to all files and directories in the /tmp/test directory, you could type the following: $ chmod -R 777 /tmp/test This command line runs chmod recursively (-R) for the /tmp/test directory, as well as any files or directories that exist below that point in the file system (for example, /tmp/test/hat, /tmp/test/hat/caps, and so on). All would be set to 777 (full read/write/execute permissions). This is not something you would do on an important directory on a read/write file system. However, you might do this before you create a directory structure on a CD-ROM that you want to be fully readable and executable to someone using the CD-ROM later. The -R option of chmod works best if you are opening permissions completely or adding execute permission (as well as the appropriate read/write permission). The reason is that if you turn off execute permission recursively, you close off your capability to change to any directory in that structure. For example, chmod -R 644 /tmp/test turns off execute permission for the /tmp/test directory, and then fails to change any files or directories below that point. Caution Tip
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

68 Part I . Linux First Steps Table (Disney web site)

Saturday, July 28th, 2007

68 Part I . Linux First Steps Table 2-10 Setting Read, Write, and Execute Permissions Permission File Directory Read View what s in the file. See what files and subdirectories it contains. Write Change the file s content, Add files or subdirectories to the directory. rename it, or delete it. Execute Run the file as a program. Change to that directory as the current directory, search through the directory, or execute a program from the directory. You can see the permission for any file or directory by typing the ls -ld command. The named file or directory appears as those shown in this example: $ ls -ld ch3 test -rw-rw-r– 1 chris sales 4983 Jan 18 22:13 ch3 drwxr-xr-x 2 chris sales 1024 Jan 24 13:47 test The first line shows that the ch3 file has read and write permission for the owner and the group. All other users have read permission, which means they can view the file but cannot change its contents or remove it. The second line shows the test directory (indicated by the letter d before the permission bits). The owner has read, write, and execute permission, while the group and other users have only read and execute permissions. As a result, the owner can add, change, or delete files in that directory, and everyone else can only read the contents, change to that directory, and list the contents of the directory. If you own a file, you can use the chmod command to change the permission on it as you please. In one method of doing this, each permission (read, write, and execute), is assigned a number r=4, w=2, and x=1 and you use each set s total number to establish the permission. For example, to make permissions wide open for yourself as owner, you d set the first number to 7 (4+2+1), and to give the group and others only read permission, you d both the second and third numbers to 4 (4+0+0), so that the final number is 744. Any combination of permissions can result from 0 (no permission) through 7 (full permission). Here are some examples of how to change permission on a file (named file) and what the resulting permission would be: # chmod 777 file rwxrwxrwx # chmod 755 file rwxr-xr-x # chmod 644 file rw-r–r- # chmod 000 file ———
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Chapter 2 (Web design company) . Running Commands from the Shell

Saturday, July 28th, 2007

Chapter 2 . Running Commands from the Shell 67 Using File-Redirection Metacharacters Commands receive data from standard input and send it to standard output. Using pipes (described earlier), you can direct standard output from one command to the standard input of another. With files, you can use less than (<) and greater than (>) signs to direct data to and from files. Here are the file-redirection characters: . < Directs the contents of a file to the command. . > Directs the output of a command to a file, deleting the existing file. . >> Directs the output of a command to a file, adding the output to the end of the existing file. Here are some examples of command lines where information is directed to and from files: $ mail root < ~/.bashrc $ man chmod | col -b > /tmp/chmod $ echo I finished the project on $(date) >> ~/projects In the first example, the contents of the .bashrc file in the home directory are sent in a mail message to the computer s root user. The second command line formats the chmod man page (using the man command), removes extra back spaces (col - b), and sends the output to the file /tmp/chmod (erasing the previous /tmp/chmod file, if it exists). The final command results in the following text s being added to the user s project file: I finished the project on Sat Jan 25 13:46:49 PST 2006 Understanding File Permissions After you ve worked with Linux for a while, you are almost sure to get a Permission denied message. Permissions associated with files and directories in Linux were designed to keep users from accessing other users private files and to protect important system files. The nine bits assigned to each file for permissions define the access that you and others have to your file. Permission bits appear as rwxrwxrwx. The first three bits apply to the owner s permission, the next three apply to the group assigned to the file, and the last three apply to all others. The r stands for read, the w stands for write, and the x stands for execute permissions. If a dash appears instead of the letter, it means that permission is turned off for that associated read, write, or execute. Because files and directories are different types of elements, read, write, and execute permissions on files and directories mean different things. Table 2-10 explains what you can do with each of them:
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

66 Part I . Linux First (Web site construction) Steps The

Friday, July 27th, 2007

66 Part I . Linux First Steps The touch command creates empty files. The next few commands show you how to use shell metacharacters with the ls command to match filenames. Try the following commands to see if you get the same responses: $ ls a* apple $ ls g* grape grapefruit $ ls g*t grapefruit $ ls *e* apple grape grapefruit watermelon $ ls *n* banana watermelon The first example matches any file that begins with an a (apple). The next example matches any files that begin with g (grape, grapefruit). Next, files beginning with g and ending in t are matched (grapefruit). Next, any file that contains an e in the name is matched (apple, grape, grapefruit, watermelon). Finally, any file that contains an n is matched (banana, watermelon). Here are a few examples of pattern matching with the question mark (?): $ ls ????e apple grape $ ls g???e* grape grapefruit The first example matches any five-character file that ends in e (apple, grape). The second matches any file that begins with g and has e as its fifth character (grape, grapefruit). Here are a couple of examples using braces to do pattern matching: $ ls [abw]* apple banana watermelon $ ls [agw]*[ne] apple grape watermelon In the first example, any file beginning with a, b, or w is matched. In the second, any file that begins with a, g, or w and also ends with either n or e is matched. You can also include ranges within brackets. For example: $ ls [a-g]* apple banana grape grapefruit Here, any filenames beginning with a letter from a through g is matched.
We recommend high quality webhost to host and run your jsp application: christian web host services.