赞
踩
目录 |
|
/bin | 存放二进制可执行文件(ls,cat,mkdir等),常用命令一般都在这里。 |
/etc | 存放系统管理和配置文件 |
/home | 存放所有用户文件的根目录,是用户主目录的基点,比如用户user的主目录就是/home/user,可以用~user表示
|
/usr | 用于存放系统应用程序,比较重要的目录/usr/local 本地系统管理员软件安装目录(安装系统级的应用)。这是最庞大的目录,要用到的应用程序和文件几乎都在这个目录。 /usr/x11r6 存放x window的目录 /usr/bin 众多的应用程序 /usr/sbin 超级用户的一些管理程序 /usr/doc linux文档 /usr/include linux下开发和编译应用程序所需要的头文件 /usr/lib 常用的动态链接库和软件包的配置文件 /usr/man 帮助文档 /usr/src 源代码,linux内核的源代码就放在/usr/src/linux里 /usr/local/bin 本地增加的命令 /usr/local/lib 本地增加的库 |
/opt | 额外安装的可选应用程序包所放置的位置。一般情况下,我们可以把tomcat等都安装到这里。 |
/proc | 虚拟文件系统目录,是系统内存的映射。可直接访问这个目录来获取系统信息。 |
/root | 超级用户(系统管理员)的主目录(特权阶级^o^) |
/sbin | 存放二进制可执行文件,只有root才能访问。这里存放的是系统管理员使用的系统级别的管理命令和程序。如ifconfig等。 |
/dev | 用于存放设备文件。 |
/mnt | 系统管理员安装临时文件系统的安装点,系统提供这个目录是让用户临时挂载其他的文件系统。 |
/boot | 存放用于系统引导时使用的各种文件 |
/lib | 存放跟文件系统中的程序运行所需要的共享库及内核模块。共享库又叫动态链接共享库,作用类似windows里的.dll文件,存放了根文件系统程序运行所需的共享文件。 |
/tmp | 用于存放各种临时文件,是公用的临时文件存储点。 |
/var | 用于存放运行时需要改变数据的文件,也是某些大文件的溢出区,比方说各种服务的日志文件(系统启动日志等。)等。 |
/lost+found | 这个目录平时是空的,系统非正常关机而留下“无家可归”的文件(windows下叫什么.chk)就在这里 |
Linux目录和Windows目录有着很大的不同,Linux目录类似一个树,最顶层是其根目录,如下图:
/bin 二进制可执行命令
/dev 设备特殊文件
/etc 系统管理和配置文件
/etc/rc.d 启动的配置文件和脚本
/home 用户主目录的基点,比如用户user的主目录就是/home/user,可以用~user表示
/lib 标准程序设计库,又叫动态链接共享库,作用类似windows里的.dll文件
/sbin 超级管理命令,这里存放的是系统管理员使用的管理程序
/tmp 公共的临时文件存储点
/root 系统管理员的主目录
/mnt 系统提供这个目录是让用户临时挂载其他的文件系统
/lost+found这个目录平时是空的,系统非正常关机而留下“无家可归”的文件(windows下叫什么.chk)就在这里
/proc 虚拟的目录,是系统内存的映射。可直接访问这个目录来获取系统信息。
/var 某些大文件的溢出区,比方说各种服务的日志文件
/usr 最庞大的目录,要用到的应用程序和文件几乎都在这个目录,其中包含:
/usr/x11R6 存放x window的目录
/usr/bin 众多的应用程序
/usr/sbin 超级用户的一些管理程序
/usr/doc linux文档
/usr/include linux下开发和编译应用程序所需要的头文件
/usr/lib 常用的动态链接库和软件包的配置文件
/usr/man 帮助文档
/usr/src 源代码,linux内核的源代码就放在/usr/src/linux里
/usr/local/bin 本地增加的命令
主分区或拓展分区的编号从1开始,到4结束;
逻辑分区编号从5开始
参数 | 作用 |
---|---|
-a | 挂载所有在 /etc/fstab 中定义的文件系统 |
-t | 指定文件系统类型 |
持久挂载需要配置 /etc/fstab 文件
- /dev/fdo /mnt/flopy ext3 noauto 0 0
- /dev/cdrom /mnt/cdrom iso9660 noauto,ro 0 0
- /dev/sdb2 /mnt/cdrom ext4 defaults 0 0
- [root@test4 ~]# fdisk -l
- Disk /dev/sda: 21.4 GB, 21474836480 bytes
- 255 heads, 63 sectors/track, 2610 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
-
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 13 104391 83 Linux
- /dev/sda2 14 2610 20860402+ 8e Linux LVM
- [root@test4 ~]# fdisk /dev/sda //对sda磁盘进行分区
- Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
- Building a new DOS disklabel. Changes will remain in memory only,
- until you decide to write them. After that, of course, the previous
- content won't be recoverable.
- The number of cylinders for this disk is set to 2597.
- There is nothing wrong with that, but this is larger than 1024,
- and could in certain setups cause problems with:
- 1) software that runs at boot time (e.g., old versions of LILO)
- 2) booting and partitioning software from other OSs
- (e.g., DOS FDISK, OS/2 FDISK)
- Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
- Command (m for help): m //输出帮助信息
- Command action
- a toggle a bootable flag //设置启动分区
- b edit bsd disklabel //编辑分区标签
- c toggle the dos compatibility flag
- d delete a partition //删除一个分区
- l list known partition types //列出分区类型
- m print this menu //输出帮助信息
- n add a new partition //建立一个新的分区
- o create a new empty DOS partition table //创建一个新的空白DOS分区表
- p print the partition table //打印分区表
- q quit without saving changes //退出不保存设置
- s create a new empty Sun disklabel
- t change a partition's system id //改变分区的ID
- u change display/entry units //改变显示的单位
- v verify the partition table //检查验证分区表
- w write table to disk and exit //保存分区表
- x extra functionality (experts only)
- Command (m for help):n
- Command action
- e extended //e是扩展分区
- p primary partition (1-4) //p是主分区
- p
- Partition number (1-4): 1 //定义分区数量 --主分区最多只能有四个
- First cylinder (1-2597, default 1): 1
- Last cylinder or +size or +sizeM or +sizeK (1-2597, default 2597): +100M
-
- Command (m for help): w //保存刚才的配置信息。
- The partition table has been altered!
-
- Calling ioctl() to re-read partition table.
-
- WARNING: Re-reading the partition table failed with error 22: 无效的参数.
- The kernel still uses the old table.
- The new table will be used at the next reboot.
- Syncing disks.
-
- [root@test6 ~]# fdisk /dev/sda
-
- The number of cylinders for this disk is set to 2610.
- There is nothing wrong with that, but this is larger than 1024,
- and could in certain setups cause problems with:
- 1) software that runs at boot time (e.g., old versions of LILO)
- 2) booting and partitioning software from other OSs
- (e.g., DOS FDISK, OS/2 FDISK)
-
- Command (m for help): n
- First cylinder (1710-2610, default 1710):
- Using default value 1710
- Last cylinder or +size or +sizeM or +sizeK (1710-2610, default 2610): +100M
-
- Command (m for help): w
- The partition table has been altered!
-
- Calling ioctl() to re-read partition table.
-
- WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
- The kernel still uses the old table.
- The new table will be used at the next reboot.
- Syncing disks.
- [root@test6 ~]# partprobe /dev/sda //对硬盘进行更新
- [root@test6 ~]# fdisk -l
-
- Disk /dev/sda: 21.4 GB, 21474836480 bytes
- heads, 63 sectors/track, 2610 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
-
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 13 104391 83 Linux
- /dev/sda2 14 274 2096482+ 82 Linux swap / Solaris
- /dev/sda3 275 404 1044225 8e Linux LVM
- /dev/sda4 405 2610 17719695 5 Extended
- /dev/sda5 405 1709 10482381 83 Linux
- /dev/sda6 1710 1722 104391 83 Linux
- [root@test6 ~]# mkfs.ext3 /dev/sda6 //需要先进行格式化,才能使用 。mkfs -t ext3 /dev/sda5 (mkfs.ext3 一样效果 -t 指定类型 -b 指定block大小·)
- mke2fs 1.39 (29-May-2006)
- Filesystem label=
- OS type: Linux
- Block size=1024 (log=0)
- Fragment size=1024 (log=0)
- inodes, 104388 blocks
- blocks (5.00%) reserved for the super user
- First data block=1
- Maximum filesystem blocks=67371008
- block groups
- blocks per group, 8192 fragments per group
- inodes per group
- Superblock backups stored on blocks:
- 8193, 24577, 40961, 57345, 73729
-
- Writing inode tables: done
- Creating journal (4096 blocks): done
- Writing superblocks and filesystem accounting information: done
-
- This filesystem will be automatically checked every 23 mounts or
- days, whichever comes first. Use tune2fs -c or -i to override.
-
- [root@test6 ~]# mount /dev/sda6 /mnt/sda7/ //进行挂载使用
- anaconda-ks.cfg install.log install.log.syslog
- [root@test6 ~]# df -h
- 文件系统 容量 已用 可用 已用% 挂载点
- /dev/sda5 9.7G 1.1G 8.1G 12% /
- /dev/sda1 99M 12M 83M 13% /boot
- tmpfs 252M 0 252M 0% /dev/shm
- /dev/hdc 3.9G 3.9G 0 100% /mnt/cdrom
- /dev/sda6 99M 5.6M 89M 6% /mnt/sda7

- [root@test6 ~]# ls -i lstest
- 1179659 lstest
- [root@test6 ~]# ls -id lstest1
- 1179661 lstest1
- [root@test6 ~]# filefrag -v lstest
- Checking lstest
- Filesystem type is: ef53
- Filesystem cylinder groups is approximately 78
- Blocksize of file lstest is 4096
- File size of lstest is 5 (1 blocks)
- First block: 1183744
- Last block: 1183744
- lstest: 1 extent found
参数 | 作用 |
---|---|
-s | 创建“符号链接(软链接)”,不带 -s 参数默认创建的为硬链接 |
-f | 强制创建文件或目录的链接 |
-i | 覆盖前,先询问 |
-v | 显示创建链接的过程 |
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。