Archive for July, 2007

session, you find yourself wanting (Free web host) to run a

Friday, July 27th, 2007

session, you find yourself wanting to run a bunch of commands from a directory that is not normally in your PATH. This temporary addition saves you from typing the full or relative path each time you want to run a command. If you decide that you no longer want a variable to be set, you can use the unset command to erase its value. For example, you could type unset XYZ, which would cause XYZ to have no value set. (Remember to remove the export from the $HOME/.bashrc file if you added it there or it will return the next time you open a new shell.) Managing background and foreground processes If you are using Linux over a network or from a dumb terminal (a monitor that allows only text input with no GUI support), your shell may be all that you have. You may be used to a windowing environment where you have a lot of programs active at the same time so that you can switch among them as needed. This shell thing can seem pretty limited. Though the bash shell doesn t offer you a GUI for running many programs, it does offer a way to move active programs between the background and foreground. In this way, you can have a lot of stuff running, while selectively being able to choose the one you want to deal with at the moment. There are several ways to place an active program in the background. One mentioned earlier is to add an ampersand (&) to the end of a command line. Another way is to use the at command to run one or more commands in a way in which they are not connected to the shell. To stop a running command and put it in the background, press Ctrl+z. After the command is stopped, you can either bring it to the foreground to run (the fg command) or start it running in the background (the bg command). Starting background processes If you have programs that you want to run while you continue to work in the shell, you can place the programs in the background. To place a program in the background at the time you run the program, type an ampersand (&) at the end of the command line. For example: $ find /usr -print > /tmp/allusrfiles & This command finds all files on your Red Hat Linux system (starting from the /usr directory), prints those file names, and puts those names in the file /tmp/allusrfiles. The ampersand (&) runs that command line in the background. To check which commands you have running in the background, use the jobs command, as follows: $ jobs [1] Stopped (tty output) vi /tmp/myfile [2] Running find /usr -print > /tmp/allusrfiles & [3] Running nroff -man /usr/man2/* >/tmp/man2 & [4]- Running nroff -man /usr/man3/* >/tmp/man3 & [5]+ Stopped nroff -man /usr/man4/* >/tmp/man4 The first job shows a text-editing command (vi) that was placed in the background and stopped by pressing Ctrl+z while I was editing. Job two shows the find command I just ran. Jobs three and four show nroff commands currently running in the background. Job five had been running in the shell (foreground) until I decided too many processes were running and pressed Ctrl+z to stop job five until a few processes had completed.
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

TMOUT Can be set to a number (Web hosting contract)

Friday, July 27th, 2007

TMOUT Can be set to a number representing the number of seconds the shell can be idle without receiving input. After the number of seconds is reached, the shell exits. This is a security feature that can help make it less likely for unattended shells to be accessed by unauthorized people. (This must be set in the login shell for it to actually cause the shell to log out the user.) UID The user ID number assigned to your user name. The user ID number is permanently stored in the /etc/password file. Set your own environment variables Environment variables can provide a handy way of storing bits of information that you use often from the shell. You are free to create any variables that you want (although I would avoid those that are already in use) so that you can read in the values of those variables as you use the shell. (See the bash man page for a listing of shell environment variable names that are already in use.) To set an environment variable temporarily, you can simply type a variable name and assign it to a value. Here is an example: $ AB=/usr/dog/contagious/ringbearer/grind ; export AB This example causes a long directory path to be assigned to the AB variable. The export AB command says to export the value to the shell so that it can be propagated to other shells you may open. With AB set, you can go to the directory by typing the following: $ cd $AB Tip You may have noticed that environment variables shown here are in all caps. Though case does matter with these variables, setting them as uppercase is a convention, not a necessity. You could just as easily set a variable to xyz as to XYZ (they are not the same, but either will work). The problem with setting environment variables in this way is that as soon as you exit the shell in which you set the variable, the setting is lost. To set variables more permanently, you should add variable settings to your bash configuration files, which is described later in the section on adding environment variables. If you want to have other text right up against the output from an environment variable, you can surround the variable in braces. This protects the variable name from being misunderstood. For example, if you wanted to add a command name to the AB variable shown earlier, you could do the following: $ echo ${AB}/adventure /usr/dog/contagious/ringbearer/grind/adventure Remember that you need to export the variable for it to be picked up by other commands. You need to add the export line to a shell configuration file for it to take effect the next time you login. The export command is fairly flexible. Instead of running the export command after you set the variable, you could do it all in one step, as follows: $ export XYZ=/home/xyz/bin You can override the value of any environment variable at any time. This can be temporary by typing the new value in the shell. Or you can add the changed variable command line to your $HOME/.bashrc file. One useful variable to update is the PATH variable. Here is an example: $ export PATH=$PATH:/home/xyz/bin In this example, I temporarily added the /home/xyz/bin directory to the PATH. This is useful if, during a shell
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

Mac os x web server - HOSTTYPE A value that describes the computer

Thursday, July 26th, 2007

HOSTTYPE A value that describes the computer architecture on which the Linux system is running. For Intel-compatible PCs, the value is i386. MAIL This is the location of your mailbox file. The file is typically your user name in the /var/spool/mail directory. OLDPWD The directory that was the working directory before you changed to the current working directory. OSTYPE A name identifying the current operating system. In our case, this will say Linux. (Bash can run on other operating systems as well.) PATH The colon-separated list of directories used to find commands that you type. This value is initially set by the operating system, although most people modify it. The default value for regular users is: /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:$HOME/bin. For the root user, the value also includes /sbin, /usr/sbin, and /usr/local/sbin. PPID The process ID of the command that started the current shell (for example, its parent process). PROMPT_COMMAND Can be set to a command name that is run each time before your shell prompt is displayed. Setting PROMPT_COMMAND=date prints the current date and time before the prompt line appears. PS1 Sets the value of your shell prompt. There are many items that you can read into your prompt (date, time, user name, hostname, and so on). Sometimes a command requires additional prompts, which you can set with the variables PS2, PS3, and so on. (Setting your prompt is described later in this chapter.) PWD This is the directory that is assigned as your current directory. This value changes each time you change directories using the cd command. RANDOM Accessing this variable causes a random number to be generated. The number is between 0 and 99999. SECONDS The number of seconds since the time the shell was started. SHLVL The number of shell levels associated with the current shell session. When you log in to the shell, the SHLVL is 1. Each time you start a new bash command (by, for example, using su to become a new user, or by simply typing bash), this number is incremented.
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Using shell environment variables Every (Com web hosting) active shell stores

Thursday, July 26th, 2007

Using shell environment variables Every active shell stores pieces of information that it needs to use in what are called environment variables. An environment variable can store things such as locations of configuration files, mailboxes, and path directories. They can also store values for your shell prompts, the size of your history list, and type of operating system. To see the environment variables currently assigned to your shell, type the declare command. (It will probably fill more than one screen, so type declare | more.) You can refer to the value of any of those variables by preceding it with a dollar sign ($) and placing it anywhere on a command line. For example: $ echo $USER chris This command prints the value of the USER variable, which happens to be the user name (chris). You can substitute any other value for USER to print its value instead. Common shell environment variables When you start a shell (by logging in or opening a Terminal window), there is a bunch of environment variables already set. The following are some of the variables that are either set when you use a bash shell in Linux or that can be set by you to use with different features. BASH Contains the full path name of the bash command. This is usually /bin/bash. BASH_VERSION A number that represents the current version of the bash command. ENV This value identifies the location of a file that contains commands used to initialize the shell. For the bash shell, this file is probably $HOME/.bashrc. See the section about creating configuration files for information on working with the .bashrc file. EUID This is the effective user ID number of the current user. It is assigned when the shell starts. FCEDIT If set, this indicates the text editor used by the fc command to edit history commands. If this variable isn t set, the vi command is used. HISTFILE The location of your history file. It is typically located at $HOME/.bash_history. HISTFILESIZE The number of history entries that can be stored. After this number is reached, the oldest commands are discarded. The default value is 1000. HISTCMD This returns the number of the current command in the history list. HOME This is your home directory. It is your current working directory each time you log in or type the cd command with any options.
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Here is an example of a command (Web server version) being

Wednesday, July 25th, 2007

Here is an example of a command being run in the background: $ troff -me verylargedocument & There are other ways of managing background and foreground processes. These different methods are described in detail in the Managing Background Processes section. Expanding commands With command substitution, you can have the output of a command interpreted by the shell instead of by the command itself. In this way, you can have the standard output of a command become an argument for another command. The two forms of command substitution are $(command) or command . The command in this case can include options, metacharacters, and arguments. Here is an example of using command substitution: $ vi $(find / -print | grep xyzzy) In this command line, the command substitution is done before the vi command is run. First, the find command starts at the root directory (/) and prints out all files and directories in the entire file system. This output is piped to the grep command, which filters out all files except for those that include the string xyzzy. Finally, the vi command opens all filenames for editing (one at a time) that include xyzzy. This particular example may be useful if you knew that you wanted to edit a file for which you knew the name but not the location. As long as the string was fairly uncommon, you could find and open every instance of a particular filename existing in the file system. Expanding arithmetic expressions There may be times when you want to pass arithmetic results to a command. There are two forms you can use to expand an arithmetic expression and pass it to the shell: $[expression] or $((expression)). Here is an example: $ echo “I am $[2002 - 1957] years old.” I am 45 years old. In this example, the shell interprets the arithmetic expression first (2002 1957), and then passes that information to the echo command. The echo command displays the text, with the results of the arithmetic (45) inserted. Expanding variables Environment variables that store information within the shell can be expanded using the dollar sign ($) metacharacter. When you expand an environment variable on a command line, the value of the variable is printed instead of the variable name itself, as follows: $ ls -l $BASH_ENV -rw-r r– 1 chris sales 124 Jan 10 01:50 /home/chris/.bashrc In this example, you wanted to see the location of your bash environment file, and then check its size and when it was last changed. The BASH_ENV environment variable contains the name of your bash environment file. Using $BASH_ENV as an argument to ls -l causes a long listing of that file to be printed. (The $BASH_ENV variable isn t automatically set for the root user, though it should be for all others.) For more information on shell environment variables, see the following section.
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

earlier, a metacharacter is a typed (Web site optimization) character that

Wednesday, July 25th, 2007

earlier, a metacharacter is a typed character that has special meaning to the shell for connecting commands or requesting expansion. Piping commands The pipe (|) metacharacter connects the output from one command to the input of another command. This lets you have one command work on some data, then have the next command deal with the results. Here is an example of a command line that includes pipes: $ cat /etc/password | sort | more This command prints the contents of the /etc/password file and pipes the output to the sort command. The sort command takes the user names that begin each line of the /etc/password file, sorts them alphabetically, and pipes the output to the more command. The more command displays the output one page at a time, so that you can go through the output a line or a page at a time. Pipes are an excellent illustration of how UNIX, the predecessor of Linux, was created as an operating system made up of building blocks. A standard practice in UNIX was to connect utilities in different ways to get different jobs done. For example, before the days of integrated, graphical word processors, users would create plain-text files that included macros to indicate formatting. Then, to see how the document really appeared, they would use a command such as the following: $ nroff -man grep.1 | lpr In this example, the nroff command is used to format the file grep.1 (which is the grep manual page) using the manual macro (-man). The output is piped to the lpr command to print the output. Because the file being printed is in plain text, you could have substituted any number of options to work with the text before printing it. You could sort the contents, change or delete some of the content, or bring in text from other documents. The key is that, instead of all those features being in one program, you get results from piping and redirecting input and output between multiple commands. Sequential commands Sometimes you may want a sequence of commands to run with one command to complete before the next command begins. You can use a semicolon (;) metacharacter to run commands in a sequence. To run a sequence of commands, type them all on the same command line and separate them with semicolons (;). For example: $ date ; troff -me verylargedocument | lpr ; date In this example, I was formatting a huge document and wanted to know how long it would take. The first command (date) showed the date and time before the formatting started. The troff command formatted the document and then piped the output to the printer. When the formatting was done, the date and time was printed again (so I know how long the troff command took to complete). Background commands Some commands can take a while to complete. Sometimes you may not want to tie up your shell waiting for a command to finish. In those cases, you can have the commands run in the background by using the ampersand (&). Text formatting commands (such as nroff and troff, which were described earlier) are examples of commands that you may want to run in the background if you are formatting a large document. You also may want to create your own shell scripts that run in the background to check continuously for certain events to occur, such as the hard disk filling up or particular users logging in.
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

Run Command Number (!n) Replace (Web host sites) the n

Tuesday, July 24th, 2007

Run Command Number (!n) Replace the n with the number of the command line, and the command line indicated is run. Run Previous Command (!!) Runs the previous command line. Run Command Containing String (!?string?) Runs the most recent command that contains a particular string of characters. Instead of just running a history command line immediately, you can recall a particular line and edit it. You can use these keys to do that: Step (Arrow Keys) Press the up ( ua) and down ( da) arrow keys to step through each command line in your history list to arrive at the one you want. Reverse Incremental Search (Ctrl+r) After you press these keys, you are asked to enter a search string to do a reverse search. As you type the string, a matching command line appears that you can run or edit. Forward Incremental Search (Ctrl+s) After you press these keys, you are asked to enter a search string to do a forward search. As you type the string, a matching command line appears that you can run or edit. Reverse Search (Alt+p) After you press these keys, you are asked to enter a string to do a reverse search. Type a string and press Enter to see the most recent command line that includes that string. Forward Search (Alt+n) After you press these keys, you are asked to enter a string to do a forward search. Type a string, and press Enter to see the most recent command line that includes that string. Beginning of History List (Alt+<) Brings you to the first entry of the history list. Beginning of History List (Alt+>) Brings you to the last entry of the history list. Another way to work with your history list is to use the fc command. Type fc followed by a history line number, and that command line is opened in a text editor. Make the changes that you want. When you exit the editor, the command runs. You could also give a range of line numbers (for example, fc 100 105). All the commands open in your text editor, and then run one after the other when you exit the editor. The history list is stored in the .bash_history file in your home directory. Up to 1000 history commands are stored for you by default. Connecting and expanding commands A truly powerful feature of the shell is the capability to redirect the input and output of commands to and from other commands and files. To allow commands to be strung together, the shell uses metacharacters. As noted
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

In this case, there are six possible environment (Web hosting billing)

Tuesday, July 24th, 2007

In this case, there are six possible environment variables that begin with $P. After the possibilities are displayed, the original command line is returned, ready for you to complete it as you choose. If the text you are trying to complete is not preceded by a $, ~, or @, you can still try to complete the text with a variable, user name, or hostname. Press the following to complete your text: Alt+~ Complete the text before this point as a user name. Alt+$ Complete the text before this point as a variable. Alt+@ Complete the text before this point as a host name. Alt+! Complete the text before this point as a command name (alias, reserved word, shell function, built-in, and filenames are checked in that order). In other words, complete this key sequence with a command that you previously ran. C+x+/ List possible user name text completions. C+x+$ List possible environment variable completions. C+x+@ List possible hostname completions. C+x+! List possible command name completions. Command line recall After you type a command line, that entire command line is saved in your shell s history list. The list is stored in a history file, from which any command can be recalled to run again. After it is recalled, you can modify the command line, as described earlier. To view the contents of your history list, use the history command. You can either type the command without options or follow it with a number to list that number of the most recent commands. Here s an example: $ history 8 382 date 383 ls /usr/bin | sort -a | more 384 man sort 385 cd /usr/local/bin 386 man more 387 useradd -m /home/chris -u 101 chris 388 passwd chris 389 history 8 A number precedes each command line in the list. There are several ways to run a command immediately from this list, including:
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

Web servers - Table 3-3: Keystrokes for Cutting and Pasting Text

Monday, July 23rd, 2007

Table 3-3: Keystrokes for Cutting and Pasting Text in Command Lines Keystroke Full Name Meaning Ctrl+k Cut end of line. Cut text to the end of the line. Ctrl+u Cut beginning of line. Cut text to the beginning of the line. Ctrl+w Cut previous word. Cut the word located behind the cursor. Alt+d Cut next word. Cut the word following the cursor. Ctrl+y Paste recent text. Paste most recently cut text. Alt+y Paste earlier text. Rotate back to previously cut text and paste it. Ctrl+c Delete whole line. Delete the entire line. Command line completion To save you a few keystrokes, the bash shell offers several different ways of completing partially typed values. To attempt to complete a value, type the first few characters, and then press Tab. Here are some of the values you can type partially: Environment variable If the text begins with a dollar sign ($), the shell completes the text with an environment variable from the current shell. User name If the text begins with a tilde (~), the shell completes the text with a user name. Command, alias, or function If the text begins with regular characters, the shell tries to complete the text with a command, alias, or function name. Hostname If the text begins with an at (@) sign, the shell completes the text with a hostname taken from the /etc/hosts file. Tip To add host names from an additional file, you can set the HOSTFILE variable to the name of that file. The file must be in the same format as /etc/hosts. Here are a few examples of command completion. (When you see , it means to press the Tab key on your keyboard.) Type the following: $ echo $OS $ cd ~ro $ fing $ mailx root@loc The first example causes $OS to be expanded to the $OSTYPE variable. In the next example, ~ro is expanded to the root user s home directory (~root/). Next, fing is expanded to the finger command. Finally, the address of root@loc is expanded to the computer named localhost (the local computer). Of course, there will be times when there are several possible completions for the string of characters you have entered. In that case, you can check the possible ways text can be expanded by pressing Esc+? at the point where you want to do completion. Here is an example of the result you would get if you checked for possible completions on $P. $ echo $P $PATH $PPID $PS1 $PS2 $PS4 $PWD $ echo $P
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Frontpage web hosting - Press Ctrl+f (or the right arrow ( ra) key).

Monday, July 23rd, 2007

Press Ctrl+f (or the right arrow ( ra) key). Repeat this command a few times to position the cursor under the first slash (/). 3. Press Ctrl+d. Type this command four times to delete /usr. 4. Press Enter. This executes the command line. As you edit a command line, at any point you can type regular characters to add those characters to the command line. The characters appear at the location of your cursor. You can use right ( ra) and left ( la) arrows to move the cursor from one end to the other on the command line. You can also press the up ( ua) and down ( da) arrow keys to step through previous commands in the history list to select a command line for editing. (See the following discussion on command recall for details on how to recall commands from the history list.) There are many keystrokes you can use to edit your command lines. Table 3-1 lists the keystrokes that you can use to move around the command line. Table 3-1: Keystrokes for Navigating Command Lines Keystroke Full Name Meaning Ctrl+f Character forward. Go forward one character. Ctrl+b Character backward. Go backward one character. Alt+f Word forward. Go forward one word. Alt+b Word backward. Go backward one word. Ctrl+a Beginning of line. Go to the beginning of the current line. Ctrl+e End of line. Go to the end of the line. Ctrl+l Clear screen. Clear screen and leave line at the top of the screen. Table 3-2 lists the keystrokes for editing command lines. Table 3-2: Keystrokes for Editing Command Lines Keystroke Full Name Meaning Ctrl+d Delete current. Delete the current character. Backspace or Rubout Delete previous. Delete the previous character. Ctrl+t Transpose character. Switch positions of current and previous characters. Alt+t Transpose words. Switch positions of current and previous characters. Alt+u Uppercase word. Change the current word to uppercase. Alt+l Lowercase word. Change the current word to lowercase. Alt+c Capitalize word. Change the current word to an initial capital. Ctrl+v Insert special character. Add a special character. For example, to add a Tab character, press Ctrl+v+Tab. Table 3-3 lists the keystrokes for cutting and pasting text on a command line.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.