📄 linux-partition.html
字号:
</TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/lib</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>HINT: <B>Don't ever delete stuff in here or change permissions unless you really know what you're doing.</B></FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Files in the /lib directory are "chunks" of programs that are shared and needed by other programs in order to run.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>This is a LIBRARY of functions that programs can use.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Many of the library files in this directory wrapper the actual interface to the operating system that all the programs on the system use... say, to Open a File. <BR><BR><A HREF="file:/lib">Click here to see your own /lib directory</A></FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/etc</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>Configuration files, scripts, etc., - pardon the pun, go under this directory.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Relative to partitions, you'll want to peek at fstab, mtab... Heck, check out *tab, anything ending in tab.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Often, *tab files have man pages, so you can type "man <something>tab" and read about what that file is doing here.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Another excellent thing to know is that the system's knowledge of users and passwords is stored in the /etc directory in a file called passwd.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Take a peek at that, definitely, also the file called group or groups.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Also, anything relative to configuring networking, the scripts that run when you startup and shutdown your system, and so on, all the good config files go in /etc.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>Look in the rc.d directory under /etc. There, you'll find all the startup scripts your system runs when it is booting up, configuring networking, mounting partitions, etc.,</FONT></P> <UL> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/etc">Click here to see your own /etc directory</A> </FONT> </P> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/etc/passwd">Click here to TRY and see your passwd file</A> </FONT> </P> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/etc/fstab">Click here to see your fstab file</A> </FONT> </P> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/etc/mtab">Click here to see your mtab file</A> </FONT> </P> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/etc/rc.d">Click here to see your /etc/rc.d directory</A> </FONT> </P> </UL> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/dev</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>This is my favorite directory. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>It is perhaps best to say that /dev is a directory but the files in it are not really files... Anyway, these are your DEVICES, printer, scanner, serial ports, modems, hard disk drives ! </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>Your hard disk drive is probably known as "/dev/hda" and your partitions are known as "/dev/hda1" "/dev/hda2" etc., That's for IDE drives. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>SCSI drives are known as "/dev/sda", like that. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>Somewhere there's a doc that talks about all the files in /dev... </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>Here is a couple of examples that are insightful as to how Linux itself uses this directory... </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>You can copy a file to /dev/lp0 and it will print instead of making a file /dev/lp0. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>You can "setserial /dev/ttyS2 irq 5" and this will set your COM3 to IRQ 5... </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>You can "mknod" to create a device file in this directory if it doesn't already exist by default. This assumes the Kernel knows what the device is even if there isn't already a stub for it in this directory... </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>When you rebuild the Linux kernel you will enable and disable various types of devices, this may require you to use <B>mknod</B><SPAN STYLE="font-weight: medium"> before the devices actually work.</SPAN></FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/root</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>When you create a user in Linux usually their HOME DIRECTORY is created under /home. This directory is the HOME directory of the <TT><B>root</B></TT> user, the user than can do anything.</FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/usr</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>Under this directory go things, files, programs, that are either created by users for use by other users, or for things useful to users. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>When you see <B>RTFM</B> in an email message, it means that you should go to <B>/usr/doc</B> and <B>READ THE FREAKING MANUAL</B>, which is to be found here in the form of lots of little documents, subdirectories, HTML files, etc., </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>ALSO, if you feel ready for it and want to rebuild your Linux kernel, the source code you will need to compile is almost always to be found under /usr/src/linux. Change directories with cd to /usr/src and then do "ls -al linux".</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>You will see usually that this is a symbolic link to some big huge long directory name that indicates the kernel source version. If you don't see any of this stuff it means you have not installed the kernel source and you will not be able to play with it until you do.</FONT></P> <UL> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/usr">Click here to see your own /usr directory</A> </FONT> </P> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/usr/doc">Click here to see /usr/doc directory</A> </FONT> </P> <LI><P ALIGN=LEFT><FONT SIZE=4><A HREF="file:/usr/src/linux">Click here to TRY and see your Linux Kernel Source tree</A> </FONT> </P> </UL> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/home</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>Here is the first good example candidate for a partition !</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>User's home directories... Who knows how much crap users are going to create. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>If all you have is one big partition for everything and it fills up, your system will crash. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>If the part of your directory tree that fills up is itself a partition, then that part of your directory tree fills up and crashes and not your whole machine.</FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/boot</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>After you build a kernel, it's image is placed here. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>Also, when you install Linux a backup copy of the original boot record goes here, say, if you had first installed Windows 98.</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>You can put it back the original Master Boot Record with the <B>lilo</B> command. - see "man lilo" for details... If you want your Windows to come back to life, for example, after having seemingly ruined it.</FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/mnt</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>That looks like short for MOUNT !</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>What do you bet there are subdirectories under /mnt that are completely empty ? </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>These are complimentary default Mount Points for things like your floppy disk, CD ROM drive, etc., </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>An example of how this works: Go to the /mnt directory, "cd /mnt", then type "ls". </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>Put in a CD ROM, then type "mount cdrom".</FONT></P> <P ALIGN=LEFT><FONT SIZE=4>You can now "cd /mnt/cdrom" and use "ls" to see the contents of your CD ROM. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>If you then type cd /mnt, and umount cdrom you will note that the directory /mnt/cdorm is now empty.<BR><BR><A HREF="file:/mnt">Click here to see your own /mnt directory</A></FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/opt</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>The recent trend in standardizing Unix directory tree structures suggests that third party applications go in /opt, things like Apache, Netscape Server, Oracle, etc., </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>Although on Redhat, you'll likely find Apache located under "/etc/httpd"</FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/proc</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>This is truly a directory that's not a directory. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>This is a pseudo file system. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>All files you find here are stubs for accessing the kernel's data as it runs. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>If you view the contents of a file in here you'll see live data come out of the kernel, and not the static contents of a file. </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>Don't play with /proc, don't make a partition for it... Unless you're a guru, just ignore this.</FONT></P> </TD> </TR> <TR> <TD WIDTH=16%> <P><BR> </P> </TD> <TD WIDTH=84% VALIGN=TOP></TD> </TR> <TR> <TD WIDTH=16% VALIGN=TOP> <P><TT><B>/var</B></TT></P> </TD> <TD WIDTH=84% BGCOLOR="#e2e2e2"> <P ALIGN=LEFT><FONT SIZE=4>Variable Stuff goes in /var, log files, MAIL MESSAGES, your Email Inbox, temporary holdings of incoming and outgoing mail... </FONT> </P> <P ALIGN=LEFT><FONT SIZE=4>This part of the directory tree usually ends up growing and growing... and will eventually fill up if you
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -