Archive for September, 2007

250 Part II . Getting Around in Linux (Web server version)

Sunday, September 30th, 2007

250 Part II . Getting Around in Linux The database is updated using the updatedb command. An example of the use of the updatedbcommand is shown below. Only the root user is authorized to use this command on the system. # updatedb The locate utility uses the options shown below in Table 6-12. Table 6-12 Options Used with locate Option Use -U /PATH Start at the specified path when creating the slocate database. -e DIR Exclude the specified directories when creating the slocate database. -c Parses the /etc/updatedb.conf file when creating the database. -i Searches without regard to case. -o FILE Specifies the output file to create. -d PATH Specifies the path of databases to search. -u Start at / when creating the slocate database. which The which command takes one or more arguments. For each of its arguments it prints to stdout the full path of the executables that would have been executed when this argument is entered at the shell prompt. It does this by searching for an executable or script in the directories listed in the environment variable PATHusing the same algorithm as bash. This allows you to see the full path to a command before it is run. This can be useful for verifying that you are running the command that you meant to run. The utility uses the following syntax: which options programname An example of the proper use of this command is shown in the example below to discover the location of the locatecommand. # which locate /usr/bin/locate
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Chapter 6 . Managing Files 249 find The (Web design templates)

Sunday, September 30th, 2007

Chapter 6 . Managing Files 249 find The find utility is used to search for files. This utility begins searching at a specified directory and will then search all subdirectories contained within that directory for filenames matching the specified pattern. When no directory is specified, the find utility begins by searching the pwd and then searches all subdirectories located within that directory. The correct syntax for this utility is as follows: find /path expression Searches using the findutility can take a while and use a lot of system resources depending on the search being done. Table 6-11 shows some of the various conditions that can be searched for using find. Following is an example of the use of the find utility. # find /home/angie name stuff /home/angie/stuff # find /home/angie user root /home/angie/morestuff Table 6-11 Conditions Used with find Option Use -ctime Searches based on the number of days since directory entry last changed. -group Searches for files belonging to the specified group. -newer Searches for files more recent than the specified file. -name Searches for files with names matching the specified string. -user Searches for files belonging to the specified user. -atime Searches based on the number of days since last accessed. locate The secure locate command provides a secure way to index and quickly search for files on your system. It uses incremental encoding to compress its database to make searching faster, but it will also store file permissions and ownership so that users will not see files they do not have access to. The locatecommand uses the slocate database, by default, to find file locations. It is possible to specify other database files to use. This command uses the following syntax: locate options arguments
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Kids web site - 248 Part II . Getting Around in Linux

Saturday, September 29th, 2007

248 Part II . Getting Around in Linux /usr/local Contains applications that aren t part of the Linux operating system. /usr/local/bin Contains software installed after the initial operating system installation. This should also be in the user s path. /usr/local/sbin Contains administrative software installed after the initial operating system installation. . /var/log Contains log files. . /var/spool Contains mail and printing files. . /bin Contains binaries used during system startup. . /sbin Contains administrative binaries used by the superuser. System directories The following are a number of system directories with specific purposes on Linux systems: . / System root directory. . /root Home directory for superuser. . /home Contains user s home directories. . /boot Contains files used by the boot loader including the kernel. . /dev Contains peripheral access files. . /proc A virtual directory containing system information. Locating Files Objective 2.4 Devices, Linux File Systems, Filesystem Hierarchy Standard Find system files and place files in the correct location. Understand the filesystem hierarchy standard, know standard file locations, know the purpose of various system directories, find commands and files. Involves using the commands: find, locate, which, updatedb. Involves editing the file: /etc/ updatedb.conf Another capability that you will require on a Linux system is locating files. Luckily, Linux provides several methods for searching for files. The find, locate,which, and whereis commands all prove useful for this task.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Chapter 6 . Managing Files 247 directories can (My web site)

Friday, September 28th, 2007

Chapter 6 . Managing Files 247 directories can also be created as needed. In order to create the directories /home/angie/ourfiles, /home/angie/ourfiles/myfiles, /home/angie/ ourfiles/yourfiles the following command can be used. # mkdir /home/angie/ourfiles /home/angie/ourfiles/myfiles /home/angie/ourfiles/yourfiles In the above command the directory /home/angie/ourfiles is created first. The command then creates the directories myfiles and yourfiles within the ourfiles directory. Understanding File System Hierarchy Objective 2.4 Devices, Linux File Systems, Filesystem Hierarchy Standard Find system files and place files in the correct location. Understand the filesystem hierarchy standard, know standard file locations, know the purpose of various system directories, find commands and files. Involves using the commands: find, locate, which, updatedb. Involves editing the file: /etc/ updatedb.conf The Linux file system follows a tree-like structure. The root (/) contains primary directories. Each directory located off the root can contain other directories as it branches off. Being familiar with several key directories when working with Linux is important. In this section we examine many of those directories. Standard file locations The following are some standard file locations on Linux systems. . /etc Contains many of the script and configuration files used on the system. . /etc/skel Contains the files that are to be copied to each user s home directory. Cross-The /etc/skel file is covered in greater detail in Chapter 10. Reference . /usr Contains many subdirectories that store applications and source files used by the user and superuser accounts. Some of these include the following: /usr/bin Contains executables used by users. This should be included in the user s path statement. /usr/sbin Contains executables used by superuser.
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

246 Part II (Web server extensions) . Getting Around in Linux

Thursday, September 27th, 2007

246 Part II . Getting Around in Linux Deleting files Another task often required when working with files and directories is removing them. The rm command (short for remove) is used to delete files and directories on Linux systems. The rmcommand uses the following syntax: rm -options FILE Several options can be used with the rmcommand. The most frequently used options are shown in Table 6-10. Table 6-10 Options Used with rm Option Use -f Processes filenames without prompting, even if they don t exist. -i Prompts the user when removing files. -r Removes directory contents recursively. -d Used by superuser. Removes directories regardless of whether they are empty. -v Verbosely removes files. In the following example all files in the pwd beginning with nn are deleted. # rm nn* The second command removes all files located in the filesdirectory verbosely, along with the directory itself. # rm -frv files removing files/fileaa removing files/fileab removing files/fileac removing files/filead removing files/fileae removing files/filespace removing the directory itself: files Creating directories At this point we have covered the creation and removal of files as well as the removal of directories. Now we will examine the mkdircommand (short for make directory) that is used to create directories. This is a very basic command that can create one directory layer at a time. When used with the p option parent
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Chapter 6 . Managing Files 245 (Virtual web hosting) In this

Wednesday, September 26th, 2007

Chapter 6 . Managing Files 245 In this example, the ddcommand is used to copy a file from the Linux boot partition to another partition formatted using the FAT file system. This command is also useful when converting files from ASCII to EBCDIC, the Extended Binary Coded Decimal Interchange Code used by IBM, such as when working with tape backup systems. Moving files It is possible to move a file manually by copying it to the new location and erasing the original file. However, Linux includes a command for moving files that automates these tasks. The mv command (short for move) allows you to move and rename files on Linux systems. This command works much like the cp command covered earlier in the chapter, using the same command syntax. The options used with the mvcommand are a bit different and are covered in Table 6-9. Table 6-9 Options Used with mv Option Use -i Prompts the user before overwriting files. -u Specifies that files are not moved to a destination with the same or newer modification times. -v Verbosely prints the names of files as they are moved. -f Removes existing files without prompting. In the following example, all filenames matching the pattern beginning with file are moved verbosely to the myfiles directory. # mv -v file* myfiles fileaa -> myfiles/fileaa fileab -> myfiles/fileab fileac -> myfiles/fileac filead -> myfiles/filead fileae -> myfiles/fileae filespace -> myfiles/filespace In the second example, the directory myfilesis renamed to files. # mv myfiles files
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Tomcat web server - 244 Part II . Getting Around in Linux

Tuesday, September 25th, 2007

244 Part II . Getting Around in Linux Table 6-8 Options Used with dd Option Use of=FILE Specifies the location of the destination to use instead of standard output. This is the output file. ibs=BYTES Specifies the number of BYTES read at a time. obs=BYTES Specifies the number of BYTES written at a time. bs=BYTES Specifies the number of BYTES to read and write at a time. cbs=BYTES Specifies the number of BYTES to convert at a time. skip=BLOCKS Specifies the BLOCKS to skip in the input file before copying. seek=BLOCKS Specifies the BLOCKS to skip in the output file before writing. count=BLOCKS Specifies the BLOCKS of the input file to copy instead of copying the entire file. if=FILE Specifies the location of a source to use instead of standard input. This is the input file. The dd command can be used for a variety of special tasks. For example, suppose the system you currently use is running both Windows NT and Windows 98. The first partition contains Windows 98 system files and is formatted with FAT. The second partition contains Windows NT system files and is formatted with NTFS. A third partition, formatted as FAT, contains data that is shared between the two operating systems. This drive also contains 3GB of space that you wish to use for Linux. Because this computer is used by your young children, you prefer to use the NT boot loader that they are familiar with using. This can be done by installing the Linux boot sector along with LILO to a location that doesn t overwrite the master boot record; in this case you install the Linux boot partition to /dev/hda5. While in Linux, mount the Windows 98 system partition so that you can write to it. Then run the following command: # /bin/dd if=/dev/hda5 bs=512 count=1 of=/mnt/win_c/bootsek.lin This will create a file named bootsek.lin on the Windows 98 system partition. The file will be written as one block with a size of 512 bytes. You will then need to boot to either NT or Windows 98 and edit the boot.ini file to include the following line: c:bootsek.lin= Linux This will add a line to the NT boot loader for Linux. When this line is selected during boot, the system will then boot to the LILO boot loader. Any time the lilo command is run on the Linux system the bootsek.linfile will need to be rewritten.
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Chapter 6 . Managing Files 243 In the (Web server hosting)

Thursday, September 20th, 2007

Chapter 6 . Managing Files 243 In the second example the directory /home/angie/stuff and its contents are copied to the directory /home/angie/otherstuff. This is particularly useful as it allows the entire directory and its contents to be copied using one command. # cp -r /home/angie/stuff /home/angie/otherstuff Exam Tip This is an important option that you are likely to see as a test question. In the third example the files and directories located in the /home/angie/stuff directory are copied verbosely to the /home/angie/otherstuffdirectory. # cp -rv /home/angie/stuff/* /home/angie/morestuff /home/angie/stuff/abcnames -> /home/angie/morestuff/abcnames /home/angie/stuff/alphanames -> /home/angie/morestuff/alphanames /home/angie/stuff/list -> /home/angie/morestuff/list /home/angie/stuff/marital -> /home/angie/morestuff/marital /home/angie/stuff/morestuff -> /home/angie/morestuff/morestuff /home/angie/stuff/mycommands.12.11.00 -> /home/angie/morestuff/mycommands.12.11.00 /home/angie/stuff/nameslist -> /home/angie/morestuff/nameslist /home/angie/stuff/newstuff -> /home/angie/morestuff/newstuff /home/angie/stuff/newstuff/newnameslist -> /home/angie/morestuff/newstuff/newnameslist /home/angie/stuff/newstuff/newnicks -> /home/angie/morestuff/newstuff/newnicks /home/angie/stuff/nicks -> /home/angie/morestuff/nicks /home/angie/stuff/oldstuff -> /home/angie/morestuff/oldstuff /home/angie/stuff/oldstuff/oldnameslist -> /home/angie/morestuff/oldstuff/oldnameslist /home/angie/stuff/oldstuff/oldnicks -> /home/angie/morestuff/oldstuff/oldnicks /home/angie/stuff/readmes -> /home/angie/morestuff/readmes dd The dd command (short for direct dump) is used to copy and convert files to a different file type simultaneously. This command has different options and a different syntax than the cpcommand. The syntax used by the dd command is as follows: dd [options] The dd command, by default, writes data from standard input to standard output. Options can be used to overwrite these defaults. The options used with the dd command are shown in Table 6-8.
You want to have a cheap webhost for your apache application, then check apache web hosting services.

242 Part II . Getting Around in Linux (Web hosting e commerce)

Wednesday, September 19th, 2007

242 Part II . Getting Around in Linux cp The cp command (short for copy) is used for standard file copies on Linux systems. This command is used to create a new, independent copy of the original file or directory. Several options are used with the cpcommand to customize the copies created. These options are covered below in Table 6-7. Table 6-7 Options Used with cp Option Use -d Specifies that links are to be preserved when copied. -f Overwrites any existing destination files. -i Prompts before overwriting any existing destination files. -l Specifies that hard links, which are discussed later in the chapter, are to be created instead of copies of files. -p Preserves the original file s owner, group, permissions, and time stamps. -r Copies directories and contents recursively while copying all files as standard files. This option shouldn t be used with special files. -R Copies directories and contents recursively, preserving nondirectories. -s Creates symbolic links, covered later in the chapter, of nondirectory files. -v Displays the names of all files as they are being copied. -a Specifies that links and attributes of the original files are to be transferred to the new copy. These options can be used in combination when copying files. Along with these options, arguments are used with the cp command. The correct syntax for the cp command is as follows: cp -option source target When the target specified is a directory, the source file is copied to that directory with the same name as the original file. When the target specified is not a directory, the original file is copied to the specified location with the target name. The following are some examples of the use of the cp command. In the first example the file marital is copied to the directory stuff. # cp marital stuff
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Chapter 6 . Managing Files 241 Table 6-6

Tuesday, September 18th, 2007

Chapter 6 . Managing Files 241 Table 6-6 Options Used with touch Option Use -c Do not create a file if none exists. -d Used to specify the stamp on the file instead of using the current time. r Uses the time of the instead of the current time. -t