存档

‘Linux/Unix’ 分类的存档

Linux Directory Structure (File System Structure) Explained with Examples

2011年4月12日 Jarod Lee 没有评论

by Ramesh Natarajan on September 8, 2010

Have you wondered why certain programs are located under /bin, or /sbin, or /usr/bin, or /usr/sbin?

For example, less command is located under /usr/bin directory. Why not /bin, or /sbin, or /usr/sbin? What is the different between all these directories?

In this article, let us review the Linux filesystem structures and understand the meaning of individual high-level directories.

1. / – Root
  • Every single file and directory starts from the root directory.
  • Only root user has write privilege under this directory.
  • Please note that /root is root user’s home directory, which is not same as /.
2. /bin – User Binaries
  • Contains binary executables.
  • Common linux commands you need to use in single-user modes are located under this directory.
  • Commands used by all the users of the system are located here.
  • For example: ps, ls, ping, grep, cp.
3. /sbin – System Binaries
  • Just like /bin, /sbin also contains binary executables.
  • But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
  • For example: iptables, reboot, fdisk, ifconfig, swapon
4. /etc – Configuration Files
  • Contains configuration files required by all programs.
  • This also contains startup and shutdown shell scripts used to start/stop individual programs.
  • For example: /etc/resolv.conf, /etc/logrotate.conf
5. /dev – Device Files
  • Contains device files.
  • These include terminal devices, usb, or any device attached to the system.
  • For example: /dev/tty1, /dev/usbmon0
6. /proc – Process Information
  • Contains information about system process.
  • This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
  • This is a virtual filesystem with text information about system resources. For example: /proc/uptime
7. /var – Variable Files
  • var stands for variable files.
  • Content of the files that are expected to grow can be found under this directory.
  • This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);
8. /tmp – Temporary Files
  • Directory that contains temporary files created by system and users.
  • Files under this directory are deleted when system is rebooted.
9. /usr – User Programs
  • Contains binaries, libraries, documentation, and source-code for second level programs.
  • /usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
  • /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
  • /usr/lib contains libraries for /usr/bin and /usr/sbin
  • /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2
10. /home – Home Directories
  • Home directories for all users to store their personal files.
  • For example: /home/john, /home/nikita
11. /boot – Boot Loader Files
  • Contains boot loader related files.
  • Kernel initrd, vmlinux, grub files are located under /boot
  • For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic
12. /lib – System Libraries
  • Contains library files that supports the binaries located under /bin and /sbin
  • Library filenames are either ld* or lib*.so.*
  • For example: ld-2.11.1.so, libncurses.so.5.7
13. /opt – Optional add-on Applications
  • opt stands for optional.
  • Contains add-on applications from individual vendors.
  • add-on applications should be installed under either /opt/ or /opt/ sub-directory.
14. /mnt – Mount Directory
  • Temporary mount directory where sysadmins can mount filesystems.
15. /media – Removable Media Devices
  • Temporary mount directory for removable devices.
  • For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer
16. /srv – Service Data
  • srv stands for service.
  • Contains server specific services related data.
  • For example, /srv/cvs contains CVS related data.

Best Vim Tips

2010年2月9日 Jarod Lee 没有评论
分类: Linux/Unix, Programming, Windows 标签:

T61安装windows7引导fedora12

2010年2月4日 Jarod Lee 没有评论

使用工具EasyBCD可以很容易的引导你的fedora, 也可以用来生成硬盘安装fedora的引导信息
Note:
如果硬盘安装完你的Fedora,并且不把你的grub信息写到MBR里,而是放到boot目录里,重新启动后可能你的win7也进不去了,不要慌,只要用win7的安装盘,修复你的系统的startup信息即可, 然后使用EasyBCD生成fedora的引导信息,然后重新启动。如果引导时出现找不到mbr文件的话,可以把你的mbr文件的目录修改下,比如直接放到C盘

我的BCD信息:
There are a total of 4 entries listed in the Vista Bootloader.
Bootloader Timeout: 30 seconds.
Default OS: Windows 7

Entry #1

Name: Windows 7
BCD ID: {current}
Drive: C:
Bootloader Path: Windowssystem32winload.exe
Windows Directory: Windows

Entry #2

Name: NeoSmart Linux
BCD ID: {9a4f6d46-0ec2-11df-b7d7-d677b9431b1f}
Drive: C:
Bootloader Path: NSTnst_grub.mbr

Entry #3

Name: grub4dos
BCD ID: {9a4f6d47-0ec2-11df-b7d7-d677b9431b1f}
Drive: C:
Bootloader Path: grldr.mbr

Entry #4

Name: fedora12
BCD ID: {9a4f6d48-0ec2-11df-b7d7-d677b9431b1f}
Drive: C:
Bootloader Path: NSTnst_grub-453B9A387C40DB4FB5FA583E70EE1BC1.mbr

分类: Linux/Unix, Windows 标签:

计算硬盘分区编号

2010年1月31日 Jarod Lee 没有评论

一个硬盘最多只能有四个主分区:

则四个主分区分别表示为

(hd0,0)

(hd0,1)

(hd0,2)

扩展分区

/* 扩展分区算一个主分区*/

逻辑分区1(hd0,4)

逻辑分区2(hd0,5)

逻辑分区3(hd0,6)

为啥(hd0,4)是指D盘,因为一般我们的电脑 C盘为主分区(特殊安装例外),D盘为第一个逻辑分区,逻辑分区是从 4开始的,因为0,1,2,3为主分区所用。

分类: Linux/Unix, Windows 标签: