Archive for May, 2007

? This matches any one character. (Zeus web server)

Saturday, May 5th, 2007

? This matches any one character. […] This matches any one of the characters between the brackets, which can include a dash-separated range of letters or numbers. To try out some of these file-matching metacharacters, go to an empty directory (such as the test directory described in the previous section) and create some files. Here s an example of how to create some empty files: $ touch apple banana grape grapefruit watermelon The next few commands show you how to use shell metacharacters to match file names so they can be used as arguments to the ls command. Using metacharacters shown below, you can match the file names you just created with the touch command. Type the following commands and 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 example matches any file that begins with g and has e as its fifth character (grape, grapefruit). Here are a few examples of 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. 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:
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision servlet hosting services

$ chmod 700 test This changes the permissions (Anonymous web server)

Saturday, May 5th, 2007

$ chmod 700 test This changes the permissions of the directory to give you complete access and everyone else no access at all. (The new permissions should read like rwx——.) 6. Next, make the test directory your current directory as follows: $ cd test Identifying Directories When you need to identify your home directory on a shell command line, you can use the following: $HOME This environment variable stores your home directory name. ~ The tilde (~) represents your home directory on the command line. You can also use the tilde to identify someone else s home directory. For example, ~chris would be expanded to the chris home directory (probably /home/chris). Other special ways of identifying directories in the shell include the following: . A single dot (.) refers to the current directory. .. Two dots (..) refers to a directory directly above the current directory. $OLDPWD This environment variable refers to the previous working directory before you changed to the current one. Using metacharacters and operators To make more efficient use of your shell, the bash shell lets you use certain special characters, referred to as metacharacters and operators. Metacharacters can help you match one or more files without typing each file out completely. Operators let you direct information from one command or file to another command or file. Using file-matching metacharacters To save you some keystrokes and to be able to refer easily to a group of files, the bash shell lets you use metacharacters. Anytime you need to refer to a file or directory, such as to list it, open it, or remove it, you can use metacharacters to match the files you want. Here are some useful metacharacters for matching filenames: * This matches any number of characters.
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision tomcat hosting services

Creating files and directories As a Red Hat

Saturday, May 5th, 2007

Creating files and directories As a Red Hat Linux user, most of the files you save and work with will probably be in your home directory. Here are some of the commands you use in the file creation process: cd Change to another current working directory pwd Print the name of the current working directory mkdir Create a directory chmod Change the permission on a file or directory ls List the contents of a directory The following procedure steps you through creating directories within your home directory, moving among your directories, and setting appropriate file permissions: 1. First, go to your home directory. To do this, simply type cd. (For other ways of referring to your home directory, see the sidebar on identifying directories.) 2. To make sure that you got to your home directory, type pwd. When I do this, I get the following response (yours will reflect your home directory): $ pwd /home/chris 3. Create a new directory called test in your home directory, as follows: $ mkdir test 4. Check the permissions of the directory by typing: $ ls -ld test drwxr-xr-x 2 chris sales 1024 Jan 24 12:17 test Notice that this listing says that test is a directory (d), the owner is chris, the group is sales, and the file was most recently modified on Jan 24 at 12:17 p.m. Suppose that you want to prevent everyone else who uses this computer from using or viewing the files in this directory. The permissions for the directory are rwxr-xr-x. I explain what these permissions mean later in this section. 5. For now, type the following:
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

access these devices directly through (Web hosting rating) the device files.)

Friday, May 4th, 2007

access these devices directly through the device files.) /etc Contains administrative configuration files. /home Contains directories assigned to each user with a login account. /mnt Provides a location for mounting devices, such as remote file systems and removable media (with directory names of cdrom, floppy, and so on). /root Represents the root user s home directory. /sbin Contains administrative commands and daemon processes. /tmp Contains temporary files used by applications. /usr Contains user documentation, games, graphical files (X11), libraries (lib), and a variety of other user and administrative commands and files. The file systems in the DOS or MS Windows operating systems differ from Linux s file structure. See the sidebar on the Linux file system versus MS file systems. Red Hat Linux File System versus MS File Systems Although similar in many ways, the Linux file system has some striking differences from the file systems used in MS-DOS and Windows operating systems. Here are a few: In MS-DOS and Windows file systems, drive letters represent different storage devices (for example, A: is a floppy drive and C: is a hard disk). In Linux, all storage devices are fit into the file system hierarchy. So, the fact that all of /usr may be on a separate hard disk or that /mnt/rem1 is a file system from another computer is invisible to the user. Slashes, rather than backslashes, are used to separate directory names in Linux. So, C:homechris in an MS system is /home/chris in a Linux system. Filenames almost always have suffixes in DOS (such as .txt for text files or .doc for word-processing files). Though at times you can use that convention in Linux, three-character suffixes have no required meaning in Linux. They can be useful for identifying a file type. Every file and directory in a Linux system has permissions and ownership associated with it. Security varies among Microsoft systems. Because DOS and MS Windows began as single-user systems, file ownership was not built into those systems when they were designed. Later releases added features such as file and folder attributes to address this problem.
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services

Adding aliases Setting aliases can save (Web servers) you even

Friday, May 4th, 2007

Adding aliases Setting aliases can save you even more typing than setting environment variables. With aliases, you can have a string of characters execute an entire command line. You can add and list aliases with the alias command. Here are some examples: alias p= pwd ; ls -CF alias rm= rm -i In the first example, the letter p is assigned to run the command pwd, and then to run ls -CF to print the current working directory and list its contents in column form. The second runs the rm command with the -i option each time you simply type rm. (This is an alias that is often set automatically for the root user, so that instead of just removing files, you are prompted for each individual file removal. This prevents you from removing all the files in a directory by mistakenly typing something such as rm *.) While you are in the shell, you can check which aliases are set by typing the alias command. If you want to remove an alias, you can type unalias. (Remember that if the alias is set in a configuration file, it will be set again when you open another shell.) Working with the Red Hat Linux File System The Red Hat Linux file system is the structure in which all the information on your computer is stored. Files are organized within a hierarchy of directories. Each directory can contain files, as well as other directories. If you were to map out the files and directories in Red Hat Linux, it would look like an upside down tree. At the top is the root directory, which is represented by a single slash (/). Below that is a set of common directories in the Linux system, such as /bin, /dev, /home, /lib, and /tmp, to name a few. Each of those directories, as well as directories added to the root, can contain subdirectories. Figure 3-2 illustrates how the Linux file system is organized as a hierarchy. To illustrate how directories are connected, Figure 3-2 shows a /home directory that contains subdirectories for three users: chris, mary, and tom. Within the chris directory are three subdirectories: briefs, memos, and personal. To refer to a file called inventory in the chris memos directory, you could type the full path of /home/chris/memos/inventory. If your current directory were /home/chris/memos, you could refer to the file as simply inventory. Figure 3-2: The Red Hat Linux file system is organized as a hierarchy of directories. Some of the Red Hat Linux directories that may be of interest to you include the following: /bin Contains common Linux user commands, such as ls, sort, date, and chmod. /dev Contains files representing access points to devices on your systems. These include terminal devices (tty), floppy disks (fd), hard disks (hd), RAM (ram), and CD-ROM (cd). (Users normally
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision make web site services

u Prints your current user name. (Web design service)

Friday, May 4th, 2007

u Prints your current user name. w Displays the full path to the current working directory. Tip If you are setting your prompt temporarily by typing at the shell, you should put the value of PS1 in quotes. For example, you could type export PS1=”[t w]$ ” to see a prompt that looks like this: [20:26:32 /var/spool]$. To make a change to your prompt permanent, add the value of PS1 to your .bashrc file in your home directory (assuming that you are using the bash shell). There is probably already a PS1 value in that file that you can modify. Adding environment variables You may consider adding a few environment variables to your .bashrc file. These can help make working with the shell more efficient and effective: TMOUT This sets how long the shell can be inactive before bash automatically exits. The value is the number of seconds for which the shell has not received input. This can be a nice security feature, in case you leave your desk while you are still logged in to Linux. So as not to be annoyed by logging you off while you are still working, you may want to set the value to something like TMOUT=1800 (to allow 30 minutes of idle time). PATH As described earlier, the PATH variable sets the directories that are searched for the commands that you type. If you often use directories of commands that are not in your PATH, you can permanently add them. To do this, add a new PATH variable to your .bashrc file. For example, to add a new directory called /getstuff/bin to your path, add the following line: PATH=$PATH:/getstuff/bin ; export PATH This example first reads all the current path directories into the new PATH ($PATH), adds the /getstuff/bin directory, and then exports the new PATH. Caution Some people add the current directory to their PATH by adding a directory identified simply as a dot (.), as follows: PATH=.:$PATH ; export PATH This lets you always run commands in your current directory (which people may be used to if they have used DOS). However, the security risk with this procedure is that you could be in a directory that contains a command that you don t intend to run from that directory. For example, a hacker could put an ls command in a directory that, instead of listing the content of your directory, does something devious. WHATEVER You can create your own environment variables to provide shortcuts in your work. Choose any name that is not being used and assign a useful value to it. For example, if you do a lot of work with files in the /work/time/files/info/memos directory, you could set the following variable: M=/work/time/files/info/memos ; export M You could make that your current directory by typing cd $M. You could run a program from that directory called hotdog by typing $M/hotdog. You could edit a file from there called bun by typing vi $M/bun.
Note: If you are looking for reliable webhost to maintain and run your java application check Vision java hosting services

[chris@myhost bin]$ If you were to change directories, (My web site)

Friday, May 4th, 2007

[chris@myhost bin]$ If you were to change directories, the bin name would change to the name of the new current working directory. Likewise, if you were to log in as a different user or to a different host, that information would change. You can use several special characters (indicated by adding a backslash to a variety of letters) to include different information in your prompt. These can include your terminal number, the date, and the time, as well as other pieces of information. Here are some examples: ! Shows the current command history number. This includes all previous commands stored for your user name. # Shows the command number of the current command. This includes only the commands for the active shell. $ Shows the standard user prompt ($) or root prompt (#), depending on which user you are. W Shows only the current working directory base name. For example, if the current working directory was /var/spool/mail, this value would simply appear as mail. [ Precedes a sequence of nonprinting characters. This could be used to add a terminal control sequence into the prompt for such things as changing colors, adding blink effects, or making characters bold. (Your terminal determines the exact sequences available.) ] Follows a sequence of nonprinting characters. \ Shows a backslash. d Displays the day, month, and number of the date. For example: Sat Jan 23. h Shows the hostname of the computer running the shell. n Causes a newline to occur. nnn Shows the character that relates to the octal number replacing nnn. s Displays the current shell name. For example, for this bash shell the value would be bash. t Prints the current time in hours, minutes, and seconds. For example, 10:14:39.
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision ftp web hosting services

Web file server - Configuring your shell You can tune your shell

Thursday, May 3rd, 2007

Configuring your shell You can tune your shell to help you work more efficiently. Your prompt can provide pertinent information each time you press Enter. You can set aliases to save your keystrokes and permanently set environment variables to suit your needs. To make each change occur when you start a shell, you can add this information to your shell configuration files. Several configuration files support how your shell behaves. Some of these files are executed for every user and every shell. Others are specific to the particular user that creates the configuration file. Here are the files that are of interest to anyone using the bash shell in Linux: /etc/profile This file sets up user environment information for every user. It is executed when you first log in and the shell starts. This file provides default values for your path, your prompt, the maximum file size that you can create, and the default permissions for the files that you create. It also sets environment variables for such things as the location of your mailbox and the size of your history files. /etc/bashrc This file is executed for every user that runs the bash shell. It is read each time a bash shell is opened. It sets the default prompt and may add one or more aliases. Values in this file can be overridden by information in each user s ~/.bashrc file. ~/.bash_profile This file is used by each user to enter information that is specific to their own use of the shell. It is executed only once, when the user logs in. By default it sets a few environment variables and executes the user s .bashrc file. ~/.bashrc This file contains the bash information that is specific to your bash shells. It is read when you log in and also each time you open a new bash shell. This is the best location to add environment variables and aliases so that your shell picks them up. ~/.bash_logout This file executes each time you log out (exit the last bash shell). By default, it simply clears your screen. To change the /etc/profile or /etc/bashrc files, you must be the root user. Any user can change the information in the $HOME/.bash_profile, $HOME/.bashrc, and $HOME/.bash_logout files in their own home directories. The following sections provide ideas about things to add to your shell configuration files. In most cases, you add these values to the .bashrc file in your home directory. However, if you are an administrator for a system, you may want to set some of these values as defaults for all of your Linux system s users. Setting your prompt Your prompt consists of a set of characters that appear each time the shell is ready to accept a command. Exactly what that prompt contains is determined by the value in the PS1 environment variable. If your shell requires additional input, it uses the values of PS2, PS3, and PS4. When your Red Hat Linux system is installed, your prompt is set to include the following information: your user name, your hostname, and the base name of your current working directory. That information is surrounded by brackets and followed by a dollar sign (for regular users) or a pound sign (for the root user). Here is an example of that prompt:
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

The plus sign (+) next to number 5 (Web design software)

Thursday, May 3rd, 2007

The plus sign (+) next to number 5 shows that this is the job that was most recently placed in the background. The minus sign (-) next to number 4 shows that it was placed in the background just before the most recent background job. Because job 1 requires terminal input, it cannot run in the background. As a result, it appears as Stopped until it is brought to the foreground again. Tip To see the process ID for the background job, add an -l option to the jobs command. If you type ps, you can use the process ID to figure out which command is associated with a particular background command. Using foreground and background commands Continuing with the example shown, you can bring any of the commands on the jobs list into the foreground. For example, if you are ready to edit myfile again, you can type: $ fg %1 As a result, the vi command opens again, with all the text as it was when you stopped the vi job. Caution Before you put a text processor, word processor, or similar program in the background, make sure you save your file. It’s easy to forget you have a program in the background and you will lose your data if you log out or the computer reboots later on. To refer to a background job (to cancel it or bring it to the foreground), you can use a percent sign (%) followed by the job number. You can also use the following to refer to a background job: % A percent sign alone refers to the most recent command put into the background (indicated by the plus sign). This action brings the command to the foreground. %string Refers to a job where the command begins with a particular string of characters. The string must be unambiguous. (In other words, typing %vi when there are two vi commands in the background, results in an error message.) %?string Refers to a job where the command line contains a string at any point. The string must be unambiguous or the match will fail. %– Refers to the previous job stopped before the one most recently stopped. If a command is stopped, you can start it running again in the background using the bg command. For example, take job number 5 from the jobs list in the previous example: [5]+ Stopped nroff -man man4/* >/tmp/man4 Type the following: $ bg %5 After that, the job runs in the background. Its jobs entry appears as follows: [5] Running nroff -man man4/* >/tmp/man4 & Tip After a background command is done, an Exit message will be displayed the next time you press Enter (before a new shell prompt is displayed). If you want to have the exit message appear the moment the command completes, you must set the notify variable. To do this, type export notify=yes.
Note: If you are looking for high quality webhost to host and run your jsp application check Vision florida web design services

Net web server - session, you find yourself wanting to run a

Thursday, May 3rd, 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.
Note: If you are looking for high quality webhost to host and run your jsp application check Vision florida web design services