Archive for October, 2007

The /mnt/cdromdirectory is used for adding a (Web hosting rating) CD-ROM

Wednesday, October 31st, 2007

The /mnt/cdromdirectory is used for adding a CD-ROM to your filesys- tem in some distributions, and others use /media/cdrom(or /media/ dvd, /media/cdrecorder, and so on, depending on what type of hard- ware you have). In the Adding Media to Your Filesystem section, later in this chapter, I showyou how to add these items for each of the distributions. Meet the /usr subdirectoriesThe /usrdirectory is often referred to as its own miniature filesystem hierar- chy. This directory has lots of important or interesting subdirectories, asshown in Table 11-2. An asterisk (*) at the end of a description indicates thatyou need to leave that directory alone unless you have good reason to messwith it after you gain lots of experience with Linux and know exactly whatchanges you need to make so that you don t accidentally alter somethingyour system needs in order to function correctly. An important thing toremember about this segment of the filesystem is that many advanced Linux users often use /usrto store programs that can be shared with other machines. Table 11-2Standard /usr SubdirectoriesSubdirectoryContents/usr/X11R6The files that run the X Window System (the wireframe foryour GUI)* /usr/binThe commands that aren t essential for users but areuseful* /usr/gamesThe games that you install on your system, except forthose that you can choose to place in /opt/usr/includeThe files that the C programming language needs for thesystem and its programs* /usr/libThe code used by many of the programs in this /usrsub- hierarchy* /usr/localThe programs and other items that you want to keeplocally, even if you re sharing everything else in /usr/usr/sbinThe commands that aren t essential for administrators butare useful* 218Part III:Getting Up to Speed with Linux

DirectoryContains/optThe location that some people decide to use (Web hosting solutions)

Tuesday, October 30th, 2007

DirectoryContains/optThe location that some people decide to use (and some pro- grams want to use) for installing new software packages, suchas word processors and office suites/rootThe superuser s (rootuser s) home directory/sbinThe commands the system administrator needs access to* /srvData for your system s services(the programs that run in thebackground)* /tmpThe place where everyone and everything store temporary files/usrA complex hierarchy of additional programs and files /varThe data that changes frequently, such as log files and your mailSome of these directories have some equally important subdirectories, whichI cover in the upcoming sections. Meet the /etc subdirectoriesAlthough the exact subdirectories that exist in /etccan change from distrib- ution to distribution, the following two are fairly standard: The /etc/X11directory contains configuration details for the X WindowSystem (X), which runs your Graphical User Interface (GUI). See Chap- ter15 for more on the GUI. The /etc/optdirectory contains configuration files for the programs inthe /optdirectory, if you decide to use it. An important addition in Fedora is /etc/sysconfig, which contains configu- ration information for the servicesthat start at boot time, including thingslike your networking. Meet the /mnt and /media subdirectoriesYou may or may not have any subdirectories in /mediaor /mntby default(and you may not have both of these directories at the same time). Typically, however, you do have the following: The /mnt/floppyor /media/floppydirectory is used for adding afloppy disk to your filesystem instead of the word floppy, you mightsee fd0instead. 217Chapter 11: Checking Out the Linux Filesystem17_

is the majority of your Linux filesystem.Because you re (Web design conference)

Monday, October 29th, 2007

is the majority of your Linux filesystem.Because you re running your own Linuxmachine, you need to be familiar with how it s put together especially thesections that are dangerous to mess with! Meet the root directoryEverything in the Linux filesystem is relative to the rootdirectory,which isreferred to as /and is the file-system base, a doorway into all your files don t confuse this with the rootuser, which is the system administrator. Therootdirectory contains a mostly predictable set of subdirectories. Each dis- tribution varies slightly, but certain standards exist to which they all con- form. The standards keep us all sane. If you re interested in these standards, go to www.pathname.com/fhsandlook at the latest version of the rules. Rather than flood you with everything at once, I start by talking about thebase directories, meaning the items you find in /. Table 11-1 lists what youmight find in this base location. (This list can vary some from distribution to distribution.) An asterisk (*) at the end of a description indicates that you shouldn t mess with this directory unless you have a really goodreasonbecause it contains files that are very importantto the functioning of yoursystem. Table 11-1Standard / Contents in LinuxDirectoryContains/binEssential commands that everyone needs to use at any time* /bootThe information that boots the machine, including your kernel* /devThe device drivers for all the hardware that your system needsto interface with* /etcThe configuration files for your system* /homeThe home directories for each of your users/libThe libraries, or code that many programs (and the kernel) use* /mediaA spot where you add temporary media, such as floppy disksand CD-ROMs; not all distributions have this directory/mntAnother spot where you add temporary media, such as floppydisks and CD-ROMs, along with networked drives and otheritems you aren t permanently adding to your filesystem216Part III:Getting Up to Speed with Linux

Chapter 11Checking Out the Linux FilesystemIn This Chapter (Web and email hosting)

Monday, October 29th, 2007

Chapter 11Checking Out the Linux FilesystemIn This Chapter Discovering the rootdirectory and subdirectories Discerning partitions from directories Adding removable media to the filesystem Caring for your filesystem Accessing shared files on Windows computersI have an existential map. It has You are here written all over it. Steven WrightOne of the most frustrating things about learning a new operating system can be figuring out where it keeps files. Rather than keep allimportant system files in a single directory, such as the C:Windowsdirec- tory in Microsoft Windows, Linux follows the lead of its Unix cousins andspreads things out a bit more. Although the Linux and Windows setupsinvolve different methods, they are both logical, though it may not feel that way until you understand where to look. Another issue you come across is adding new media hard drives, floppydisks, CD-ROMs, DVD-ROMs, zip disks, and more to the existing filesystem. In this chapter, I focus on how the filesystem is organized and other handytopics, such as how to access data on a floppy disk. (In Chapter 10, you canfind hints on how to do this when looking through the file managers.) Introducing the Linux FilesystemLinux may be all by itself on your hard drive, or maybe it s sharing your hard drive with another operating system, such as Microsoft Windows. Allthe hard drive space you allocated for Linux during the installation process

Table 10-1 (continued) (Sri lanka web server) LabelTypeDescriptioncCharacter deviceThe item is a

Sunday, October 28th, 2007

Table 10-1 (continued) LabelTypeDescriptioncCharacter deviceThe item is a driver(control program) fora piece of hardware that transmits data, such as a modem. dDirectoryThe item is a container for files, alsoreferred to as a folderin some operatingsystems lingo. In addition to this, you find lots more different file types out there in theLinux world. By types, I m not referring to extensions, such as .exeor .doc. Linux sees everything within its file system even directories and hardwarelike your monitor as files. As a result, assigning a type to a file is merely aLinux machine s way of keeping track of what s what. The main thing Windows users in particular want to know when they move toLinux is how to recognize programs. Rather than looking for files with partic- ular extensions (like .exe) programs have (or need to have) an executablepermissionset so the system knows they are allowed to run. You can view orset this permission for a file by going to the Nautilus or Konqueror sectionand looking up how to do so. 214Part III:Getting Up to Speed with Linux

Free web hosts - triad s permissions to allow the otherfolks (those who

Saturday, October 27th, 2007

triad s permissions to allow the otherfolks (those who aren t the file s owneror in the specified group) to read and write to the file. But this method is apretty sloppy way of doing things because the whole idea of permissions is toreduce access, not to give everyone access. Instead, remember to change thefile s owner to the user tom. You do this with the chown(change owner) com- mand. For example, by typing chown tom comments, root changes the own- ership over to tom. Then tomcan work with this file and even change itspermissions to something he prefers. Hanging out in groupsGroups are more interesting to work with than owners. You use groups toallow the root user to assign to multiple users the ability to share certain filesystem areas. For example, in many versions of Linux, all users are added to a group named users(SuSE does this, for example).Then, rather than a longformat file listing such as the one shown in earlier in this chapter, you maysee the following: total 20drwx—— 2 dee users 4096 Jul 29 07:48 . drwxr-xr-x 5 root root 4096 Jul 27 11:57 .. -rw-r–r– 1 dee users 24 Jul 27 06:50 .bash_logout-rw-r–r– 1 dee users 230 Jul 27 06:50 .bash_profile-rw-r–r– 1 dee users 124 Jul 27 06:50 .bashrc-rw-rw-r– 1 dee users 0 Jul 29 07:48 lsfileIn other distributions (such as Fedora) a unique group is created for everyuser, which is why the earlier listings showed the owner and group items asidentical (dee dee). Comprehending file typesThe first letter in any long format file listing tells you which type of file you redealing with. In Table 10-1, I list the types you re likely to run into. Table 10-1Linux File TypesLabelTypeDescription-Regular fileThe item is an everyday file, such as atext file or program. bBlock deviceThe item is a driver(control program) fora storage medium,such as a hard driveor CD-ROM drive. (continued) 213Chapter 10: Manipulating Files and Directories16_

Fedora web server - The three triads are read as follows: The

Saturday, October 27th, 2007

The three triads are read as follows: The first triad consists of the second, third, and fourth characters in thelong format file listing. This triad sets the permissions for the user,orowner,of the file. (Owners are discussed in the Beware of owners sec- tion, later in this chapter.) The second triad consists of the fifth, sixth, and seventh characters inthe long format file listing. This triad sets the permissions for the groupthat is assigned to the file. (Groups are discussed in the Hanging out ingroups section, later in this chapter.) The third triad consists of the eighth, ninth, and tenth characters in thelong format file listing. This triad sets the permissions for other,oreveryone who isn t the file s owner or a member of the owning group. Although each triad is often different from the others, the internal structureof each one is made up in the same way. Focus specifically on how to readone triad before looking at the set of them together. Each triad includes threecharacters: The first character is either an ror a dash. The rstands for read permis- sion. If ris set, the triad allows the entity it stands for (user, group, orother) to view the directory or file s contents. The second character is either a wor a dash. The wstands for writeper- mission. If wis set, the triad allows the entity it stands for to add or edititems to, or in, this directory or file. The third character is either an xor a dash. The xstands for executepermission. If xis set, the triad allows the entity it stands for to run programs contained in this directory or to run the particular program in this file. In all cases, if the dash sits in place of r, w, or x, the triad doesn t allow theentity the read, write, or execute permission. The following sections describe owners and groups in more detail. Beware of ownersYou may have noticed by now that I talk a great deal about owners (users) and groups in Linux. Every file and directory has both of these components: auser from the /etc/passwdfile that s assigned as its owner and a group from/etc/groupassigned as the group. Although an everyday user probably doesn t need to change file ownershipsoften, the root user does so regularly. If you add the file comments, for exam- ple, to /home/tomwhile you re logged on as the superuser(another term forthe administrator, who is the person who owns the root account), root ownsthat file. The user tomcan t do anything with it unless you have set the last212Part III:Getting Up to Speed with Linux

A permissions primerIf you (Web design templates) find yourself scratching your

Friday, October 26th, 2007

A permissions primerIf you find yourself scratching your head when looking at parts of that longformat file listing, don t worry. The Comprehending file types section, laterin this chapter, gives you a feeling for the first letter on each line, but ninemore characters are attached to that item before you get to the next column. This group of nine is the set of permissions(also called a permission set) forthe file or directory. Linux, Unix, and even Mac OS X use permissions as away of providing file and directory security by giving you the means to spec- ify exactly who can look at your files, who can change them, and even whocan run your programs. You need this capability when you have a bunch ofdifferent users on the same machine, networked to the world. Checking out the triadsEach permission set consists of three triads. Each of the triads has the samebasic structure but controls a different aspect of who can use what. Considerthe long format listing for /home/deein the following code: total 20drwx—— 2 dee dee 4096 Jul 29 07:48 . drwxr-xr-x 5 root root 4096 Jul 27 11:57 .. -rw-r–r– 1 dee dee 24 Jul 27 06:50 .bash_logout-rw-r–r– 1 dee dee 230 Jul 27 06:50 .bash_profile-rw-r–r– 1 dee dee 124 Jul 27 06:50 .bashrc-rw-rw-r– 1 dee dee 0 Jul 29 07:48 lsfileThe first character in the permission set refers to the type of file. For a direc- tory, the character is shown as a d, as you see here for the first two items inthe preceding list; files are designated with a dash (-) instead. Each file ordirectory s permission set is a group of nine characters that is, the ninecharacters that follow the first character (for a total of ten). But this group ofnine is really three groups of three, as shown in Figure 10-12. RWERWERWUsersGroupsOthersELegend: R=ReadW=WriteE=ExecuteFigure 10-12: Breakdownof the ninepermissioncharacters. 211Chapter 10: Manipulating Files and Directories16_

Understanding long (Freelance web design) format file listingsRemember those detailed list

Thursday, October 25th, 2007

Understanding long format file listingsRemember those detailed list views in the file managers? They typically con- tain information similar to this ls -laoutput here (see Appendix A for a listof commonly used commands in Linux): drwx—— 2 dee dee 4096 Jul 29 07:48 . drwxr-xr-x 5 root root 4096 Jul 27 11:57 .. -rw-r–r– 1 dee dee 24 Jul 27 06:50 .bash_logout-rw-r–r– 1 dee dee 230 Jul 27 06:50 .bash_profile-rw-r–r– 1 dee dee 124 Jul 27 06:50 .bashrcYou may find some parts of this format easier to understand, at a glance, thanothers. The first item in each listing (the part with the letters and dashes for example, the drwx——in the first line) is the permission setassignedto the item. Briefly, permissions define who can read the file, change it, or runit if it s a program. You can read more about permissions in A permissionsprimer, later in this chapter. The second item in the first line (in this case, 2) is the number of links to the item. A linkis a fake file listing that points to another file, making a kind of short- cut. You use two kinds of links in Linux and Unix: Soft link:This link is like a Windows shortcut in that the link points backto the original file, and anything you do to the link happens to the origi- nal file. Erase the original file, and the link remains, but it becomes unus- able. The link is broken without the original file. Hard link:This link doesn t have a counterpart in the Windows world. A hard link isn t just a shortcut; it s another instance of the file itself. The data in this file is saved in only one place, but you can edit eitherthe original or the link, and the edit is saved for both instances of thefile. Erase the original, and the file still exists as long as the link is there. It s like two doors to the same room! The third item (dee) is the file s owner, and the fourth (dee) is the group depending on which version of Linux you re using, both these items may ormay not be identical. You can find out more about both of these in A permis- sions primer, later in this chapter. The fifth item is the file s size in bytes. Alldirectories show up as 4,096 bytes. Everything else has its own size. You cantell an empty file from the size of 0 bytes. The sixth, seventh, and eighth entries are all related to the last time the filewas changed: the month (Jul), the date (29), and the time in 24-hour format(07:48). Finally, the ninth item is the filename (for example, bash logout, inthe third row). 210Part III:Getting Up to Speed with Linux

Excavating with the (Best web design) Xandros File ManagerXandros offers a

Thursday, October 25th, 2007

Excavating with the Xandros File ManagerXandros offers a custom file manager (see Figure 10-11) that looks to bebased on Konqueror. One method of accessing this file manager is by double-clicking the Home directory on your desktop. This file manager workssimilarly to the other file managers in this chapter. Because I am limited onspace, I ll leave it at that, reminding you that Xandros in particular is designedfor Windows users, so you can expect its file manager to be laid out and func- tion like Windows Explorer. Understanding Filesystem MechanicsChapter 11 focuses on how the filesystem is laid out, but this chapter coverswhat s happening under the hood as far as how to understand what you reseeing in filesystem listings. These features are identical across Linux distrib- utions, as the underpinning of working with Linux remains at least mostly thesame no matter what version of Linux you re using. Figure 10-11: TheXandros filemanager inXandros 2.5.209Chapter 10: Manipulating Files and Directories16_