Linux的文件系统,根文件系统(rootfs):root filesystem、LSB, FHS: (FileSystem Heirache Standard)
[[email protected] ~]# ls / bin data etc lib lost+found mnt proc sbin srv tmp var boot dev home lib64 media opt root selinux sys usr
- /boot
引导文件存放目录,内核文件(vmlinuz)、引导加载器(bootloader, grub)都存放于此目录
- /bin
供所有用户使用的基本命令;不能关联至独立分区,OS启动即会用到的程序。
- /sbin
管理类的基本命令;不能关联至独立分区,OS启动即会用到的程序。
- /lib
基本共享库文件,以及内核模块文件(/lib/modules)。
[[email protected] ~]# ls /lib
alsa cpp crda firmware kbd modules security terminfo udev
- /lib64
专用于x86_64系统上的辅助共享库文件存放位置。
[[email protected] ~]# ls /lib64/
dbus-1 libk5crypto.so.3.1
device-mapper libkeyutils.so.1
ld-2.12.so libkeyutils.so.1.3
ld-linux-x86-64.so.2 libkrb5.so.3
- /etc
系统配置文件目录(纯文本文件)
[[email protected] ~]# ls /etc/ abrt hosts.allow protocols acpi hosts.deny pulse adjtime hp quotagrpadmins aliases httpd quotatab aliases.db init rc alsa init.d rc0.d alternatives inittab rc1.d anacrontab inputrc rc2.d asound.conf iproute2 rc3.d at.deny issue rc4.d audisp issue.net rc5.d audit kdump-adv-conf rc6.d avahi kdump.conf rc.d bash_completion.d krb5.conf rc.local bashrc ld.so.cache rc.sysinit blkid ld.so.conf readahead.conf bluetooth ld.so.conf.d redhat-release bonobo-activation libaudit.conf resolv.conf centos-release libreport rpc chkconfig.d libuser.conf rpm ConsoleKit localtime rsyslog.conf cron.d login.defs rsyslog.d cron.daily logrotate.conf rwtab cron.deny logrotate.d rwtab.d cron.hourly lvm samba cron.monthly magic sane.d crontab mailcap sasl2 cron.weekly mail.rc scl crypttab makedev.d securetty csh.cshrc man.config security csh.login mime.types selinux cups mke2fs.conf services dbus-1 modprobe.d sestatus.conf default motd setuptool.d depmod.d mtab sgml dhcp mtools.conf shadow DIR_COLORS my.cnf shadow- DIR_COLORS.256color nanorc shells DIR_COLORS.lightbgcolor NetworkManager skel dnsmasq.conf networks smartd.conf dnsmasq.d nsswitch.conf snmp dracut.conf ntp sos.conf dracut.conf.d ntp.conf sound drirc obex-data-server ssh enscript.cfg openldap ssl environment opt statetab ethers PackageKit statetab.d event.d pam.d sudo.conf exports pango sudoers favicon.png passwd sudoers.d festival passwd- sudo-ldap.conf filesystems passwd.OLD sysconfig fonts pbm2ppa.conf sysctl.conf foomatic pcmcia system-release fprintd.conf pinforc system-release-cpe fstab pkcs11 terminfo gai.conf pki tpvmlp.conf gconf plymouth udev gcrypt pm updatedb.conf gdm pm-utils-hd-apm-restore.conf vimrc ghostscript pnm2ppa.conf virc gnome-vfs-2.0 polkit-1 vmware-tools gnupg popt.d warnquota.conf group portreserve wgetrc group- postfix wpa_supplicant grub.conf ppp X11 gshadow prelink.cache xdg gshadow- prelink.conf xinetd.d gtk-2.0 prelink.conf.d xml hal printcap yum host.conf profile yum.conf hosts profile.d yum.repos.d
7./home/
普通用户家目录
[[email protected] ~]# ls /home/ hadoop zhangshan
8./root
管理员的家目录
9./media
便携式移动设备挂载点cdrom、usb
[[email protected] ~]# ll /media/ total 0
10./mnt
临时文件系统挂载点;
[[email protected] ~]# ll /mnt total 4 drwxr-xr-x. 2 root root 4096 Jan 27 2015 hgfs
11./dev
设备文件及特殊文件存储位置
b: block device,随机访问
c: character device,线性访问
[[email protected] ~]# ll /dev/ total 0 crw-rw---- 1 root video 10, 175 Jul 2 21:05 agpgart drwxr-xr-x 2 root root 620 Jul 2 21:05 block drwxr-xr-x 2 root root 80 Jul 2 21:05 bsg crw------- 1 root root 10, 234 Jul 2 21:05 btrfs-control drwxr-xr-x 3 root root 60 Jul 2 21:05 bus lrwxrwxrwx 1 root root 3 Jul 2 21:05 cdrom -> sr0 lrwxrwxrwx 1 root root 3 Jul 2 21:05 cdrw -> sr0 drwxr-xr-x 2 root root 2960 Jul 2 21:06 char crw------- 1 root root 5, 1 Jul 2 21:05 console lrwxrwxrwx 1 root root 11 Jul 2 21:05 core -> /proc/kcore drwxr-xr-x 3 root root 80 Jul 2 21:05 cpu crw-rw---- 1 root root 10, 61 Jul 2 21:05 cpu_dma_latency crw-rw---- 1 root root 10, 62 Jul 2 21:05 crash drwxr-xr-x 4 root root 80 Jul 2 21:05 disk crw-rw----+ 1 root audio 14, 9 Jul 2 21:05 dmmidi lrwxrwxrwx 1 root root 3 Jul 2 21:05 dvd -> sr0 lrwxrwxrwx 1 root root 3 Jul 2 21:05 dvdrw -> sr0 lrwxrwxrwx 1 root root 3 Jul 2 21:05 fb -> fb0 crw-rw---- 1 root root 29, 0 Jul 2 21:05 fb0 lrwxrwxrwx 1 root root 13 Jul 2 21:05 fd -> /proc/self/fd crw-rw-rw- 1 root root 1, 7 Jul 2 21:05 full crw-rw-rw- 1 root root 10, 229 Jul 2 21:05 fuse crw-rw---- 1 root root 249, 0 Jul 2 21:05 hidraw0 crw-rw---- 1 root root 10, 228 Jul 2 21:05 hpet drwxr-xr-x 2 root root 40 Jul 2 21:05 hugepages crw------- 1 root root 229, 0 Jul 2 21:05 hvc0 drwxr-xr-x 4 root root 260 Jul 2 21:05 input crw-rw---- 1 root root 1, 11 Jul 2 21:05 kmsg srw-rw-rw- 1 root root 0 Jul 2 21:06 log brw-rw---- 1 root disk 7, 0 Jul 2 21:05 loop0 brw-rw---- 1 root disk 7, 1 Jul 2 21:05 loop1 brw-rw---- 1 root disk 7, 2 Jul 2 21:05 loop2 brw-rw---- 1 root disk 7, 3 Jul 2 21:05 loop3 brw-rw---- 1 root disk 7, 4 Jul 2 21:05 loop4 brw-rw---- 1 root disk 7, 5 Jul 2 21:05 loop5 brw-rw---- 1 root disk 7, 6 Jul 2 21:05 loop6 brw-rw---- 1 root disk 7, 7 Jul 2 21:05 loop7 crw-rw---- 1 root lp 6, 0 Jul 2 21:06 lp0 crw-rw---- 1 root lp 6, 1 Jul 2 21:05 lp1 crw-rw---- 1 root lp 6, 2 Jul 2 21:05 lp2 crw-rw---- 1 root lp 6, 3 Jul 2 21:05 lp3 lrwxrwxrwx 1 root root 13 Jul 2 21:05 MAKEDEV -> /sbin/MAKEDEV drwxr-xr-x 2 root root 60 Jul 2 21:05 mapper crw-rw---- 1 root root 10, 227 Jul 2 21:05 mcelog crw-r----- 1 root kmem 1, 1 Jul 2 21:05 mem crw-rw----+ 1 root audio 14, 2 Jul 2 21:05 midi drwxr-xr-x 2 root root 60 Jul 2 21:05 net crw-rw---- 1 root root 10, 60 Jul 2 21:05 network_latency crw-rw---- 1 root root 10, 59 Jul 2 21:05 network_throughput crw-rw-rw- 1 root root 1, 3 Jul 2 21:05 null crw-r----- 1 root kmem 10, 144 Jul 2 21:05 nvram crw-rw---- 1 root root 1, 12 Jul 2 21:05 oldmem crw-rw---- 1 root lp 99, 0 Jul 2 21:05 parport0 crw-r----- 1 root kmem 1, 4 Jul 2 21:05 port crw------- 1 root root 108, 0 Jul 2 21:05 ppp crw-rw-rw- 1 root tty 5, 2 Jul 2 21:52 ptmx drwxr-xr-x 2 root root 0 Jul 2 21:05 pts brw-rw---- 1 root disk 1, 0 Jul 2 21:05 ram0 brw-rw---- 1 root disk 1, 1 Jul 2 21:05 ram1 brw-rw---- 1 root disk 1, 10 Jul 2 21:05 ram10 brw-rw---- 1 root disk 1, 11 Jul 2 21:05 ram11 brw-rw---- 1 root disk 1, 12 Jul 2 21:05 ram12 brw-rw---- 1 root disk 1, 13 Jul 2 21:05 ram13 brw-rw---- 1 root disk 1, 14 Jul 2 21:05 ram14 brw-rw---- 1 root disk 1, 15 Jul 2 21:05 ram15 brw-rw---- 1 root disk 1, 2 Jul 2 21:05 ram2 brw-rw---- 1 root disk 1, 3 Jul 2 21:05 ram3 brw-rw---- 1 root disk 1, 4 Jul 2 21:05 ram4 brw-rw---- 1 root disk 1, 5 Jul 2 21:05 ram5 brw-rw---- 1 root disk 1, 6 Jul 2 21:05 ram6 brw-rw---- 1 root disk 1, 7 Jul 2 21:05 ram7 brw-rw---- 1 root disk 1, 8 Jul 2 21:05 ram8 brw-rw---- 1 root disk 1, 9 Jul 2 21:05 ram9 crw-rw-rw- 1 root root 1, 8 Jul 2 21:05 random drwxr-xr-x 2 root root 60 Jul 2 21:05 raw lrwxrwxrwx 1 root root 4 Jul 2 21:05 root -> sda2 lrwxrwxrwx 1 root root 4 Jul 2 21:05 rtc -> rtc0 crw-rw---- 1 root root 254, 0 Jul 2 21:05 rtc0 lrwxrwxrwx 1 root root 3 Jul 2 21:05 scd0 -> sr0 brw-rw---- 1 root disk 8, 0 Jul 2 21:05 sda brw-rw---- 1 root disk 8, 1 Jul 2 21:05 sda1 brw-rw---- 1 root disk 8, 2 Jul 2 21:05 sda2 brw-rw---- 1 root disk 8, 3 Jul 2 21:05 sda3 crw-rw---- 1 root cdrom 21, 0 Jul 2 21:05 sg0 crw-rw---- 1 root disk 21, 1 Jul 2 21:05 sg1 drwxrwxrwt 2 root root 120 Jul 2 21:12 shm crw-rw---- 1 root root 10, 231 Jul 2 21:05 snapshot drwxr-xr-x 3 root root 200 Jul 2 21:05 snd brw-rw----+ 1 root cdrom 11, 0 Jul 2 21:05 sr0 lrwxrwxrwx 1 root root 15 Jul 2 21:05 stderr -> /proc/self/fd/2 lrwxrwxrwx 1 root root 15 Jul 2 21:05 stdin -> /proc/self/fd/0 lrwxrwxrwx 1 root root 15 Jul 2 21:05 stdout -> /proc/self/fd/1 lrwxrwxrwx 1 root root 4 Jul 2 21:05 systty -> tty0 crw-rw-rw- 1 root tty 5, 0 Jul 2 21:05 tty crw--w---- 1 root tty 4, 0 Jul 2 21:05 tty0 crw--w---- 1 root tty 4, 1 Jul 2 21:06 tty1 crw--w---- 1 root tty 4, 10 Jul 2 21:05 tty10 crw--w---- 1 root tty 4, 11 Jul 2 21:05 tty11 crw--w---- 1 root tty 4, 12 Jul 2 21:05 tty12 crw--w---- 1 root tty 4, 13 Jul 2 21:05 tty13 crw--w---- 1 root tty 4, 14 Jul 2 21:05 tty14 crw--w---- 1 root tty 4, 15 Jul 2 21:05 tty15 crw--w---- 1 root tty 4, 16 Jul 2 21:05 tty16 crw--w---- 1 root tty 4, 17 Jul 2 21:05 tty17 crw--w---- 1 root tty 4, 18 Jul 2 21:05 tty18 crw--w---- 1 root tty 4, 19 Jul 2 21:05 tty19 crw--w---- 1 root tty 4, 2 Jul 2 21:08 tty2 crw--w---- 1 root tty 4, 20 Jul 2 21:05 tty20 crw--w---- 1 root tty 4, 21 Jul 2 21:05 tty21 crw--w---- 1 root tty 4, 22 Jul 2 21:05 tty22 crw--w---- 1 root tty 4, 23 Jul 2 21:05 tty23 crw--w---- 1 root tty 4, 24 Jul 2 21:05 tty24 crw--w---- 1 root tty 4, 25 Jul 2 21:05 tty25 crw--w---- 1 root tty 4, 26 Jul 2 21:05 tty26 crw--w---- 1 root tty 4, 27 Jul 2 21:05 tty27 crw--w---- 1 root tty 4, 28 Jul 2 21:05 tty28 crw--w---- 1 root tty 4, 29 Jul 2 21:05 tty29 crw------- 1 root root 4, 3 Jul 2 21:06 tty3 crw--w---- 1 root tty 4, 30 Jul 2 21:05 tty30 crw--w---- 1 root tty 4, 31 Jul 2 21:05 tty31 crw--w---- 1 root tty 4, 32 Jul 2 21:05 tty32 crw--w---- 1 root tty 4, 33 Jul 2 21:05 tty33 crw--w---- 1 root tty 4, 34 Jul 2 21:05 tty34 crw--w---- 1 root tty 4, 35 Jul 2 21:05 tty35 crw--w---- 1 root tty 4, 36 Jul 2 21:05 tty36 crw--w---- 1 root tty 4, 37 Jul 2 21:05 tty37 crw--w---- 1 root tty 4, 38 Jul 2 21:05 tty38 crw--w---- 1 root tty 4, 39 Jul 2 21:05 tty39 crw------- 1 root root 4, 4 Jul 2 21:06 tty4 crw--w---- 1 root tty 4, 40 Jul 2 21:05 tty40 crw--w---- 1 root tty 4, 41 Jul 2 21:05 tty41 crw--w---- 1 root tty 4, 42 Jul 2 21:05 tty42 crw--w---- 1 root tty 4, 43 Jul 2 21:05 tty43 crw--w---- 1 root tty 4, 44 Jul 2 21:05 tty44 crw--w---- 1 root tty 4, 45 Jul 2 21:05 tty45 crw--w---- 1 root tty 4, 46 Jul 2 21:05 tty46 crw--w---- 1 root tty 4, 47 Jul 2 21:05 tty47 crw--w---- 1 root tty 4, 48 Jul 2 21:05 tty48 crw--w---- 1 root tty 4, 49 Jul 2 21:05 tty49 crw------- 1 root root 4, 5 Jul 2 21:06 tty5 crw--w---- 1 root tty 4, 50 Jul 2 21:05 tty50 crw--w---- 1 root tty 4, 51 Jul 2 21:05 tty51 crw--w---- 1 root tty 4, 52 Jul 2 21:05 tty52 crw--w---- 1 root tty 4, 53 Jul 2 21:05 tty53 crw--w---- 1 root tty 4, 54 Jul 2 21:05 tty54 crw--w---- 1 root tty 4, 55 Jul 2 21:05 tty55 crw--w---- 1 root tty 4, 56 Jul 2 21:05 tty56 crw--w---- 1 root tty 4, 57 Jul 2 21:05 tty57 crw--w---- 1 root tty 4, 58 Jul 2 21:05 tty58 crw--w---- 1 root tty 4, 59 Jul 2 21:05 tty59 crw------- 1 root root 4, 6 Jul 2 21:06 tty6 crw--w---- 1 root tty 4, 60 Jul 2 21:05 tty60 crw--w---- 1 root tty 4, 61 Jul 2 21:05 tty61 crw--w---- 1 root tty 4, 62 Jul 2 21:05 tty62 crw--w---- 1 root tty 4, 63 Jul 2 21:05 tty63 crw--w---- 1 root tty 4, 7 Jul 2 21:05 tty7 crw--w---- 1 root tty 4, 8 Jul 2 21:05 tty8 crw--w---- 1 root tty 4, 9 Jul 2 21:05 tty9 crw-rw---- 1 root dialout 4, 64 Jul 2 21:52 ttyS0 crw-rw---- 1 root dialout 4, 65 Jul 2 21:05 ttyS1 crw-rw---- 1 root dialout 4, 66 Jul 2 21:05 ttyS2 crw-rw---- 1 root dialout 4, 67 Jul 2 21:05 ttyS3 crw-r----- 1 root root 10, 223 Jul 2 21:05 uinput crw-rw-rw- 1 root root 1, 9 Jul 2 21:05 urandom crw-rw---- 1 root root 250, 0 Jul 2 21:05 usbmon0 crw-rw---- 1 root root 250, 1 Jul 2 21:05 usbmon1 crw-rw---- 1 root root 250, 2 Jul 2 21:05 usbmon2 crw-rw---- 1 vcsa tty 7, 0 Jul 2 21:05 vcs crw-rw---- 1 vcsa tty 7, 1 Jul 2 21:05 vcs1 crw-rw---- 1 vcsa tty 7, 2 Jul 2 21:06 vcs2 crw-rw---- 1 vcsa tty 7, 3 Jul 2 21:06 vcs3 crw-rw---- 1 vcsa tty 7, 4 Jul 2 21:06 vcs4 crw-rw---- 1 vcsa tty 7, 5 Jul 2 21:06 vcs5 crw-rw---- 1 vcsa tty 7, 6 Jul 2 21:06 vcs6 crw-rw---- 1 vcsa tty 7, 128 Jul 2 21:05 vcsa crw-rw---- 1 vcsa tty 7, 129 Jul 2 21:05 vcsa1 crw-rw---- 1 vcsa tty 7, 130 Jul 2 21:06 vcsa2 crw-rw---- 1 vcsa tty 7, 131 Jul 2 21:06 vcsa3 crw-rw---- 1 vcsa tty 7, 132 Jul 2 21:06 vcsa4 crw-rw---- 1 vcsa tty 7, 133 Jul 2 21:06 vcsa5 crw-rw---- 1 vcsa tty 7, 134 Jul 2 21:06 vcsa6 crw-rw---- 1 root root 10, 63 Jul 2 21:05 vga_arbiter crw------- 1 root root 10, 57 Jul 2 21:05 vmci crw-rw-rw- 1 root root 10, 56 Jul 2 21:05 vsock crw-rw-rw- 1 root root 1, 5 Jul 2 21:05 zero
12./opt
第三方应用程序的安装位置
[[email protected] ~]# ll /opt/ total 442512 drwxr-xr-x 2 hadoop hadoop 4096 Jan 31 2015 conf drwxr-xr-x 15 hadoop hadoop 4096 Jan 30 2015 hadoop drwxr-xr-x 24 hadoop hadoop 4096 Jan 31 2015 hbase -rw-r--r-- 1 root root 93090286 Jul 6 2014 hbase-0.96.1.1-cdh5.0.2.tar.gz -rwxr-xr-x 1 root root 126699745 Jan 29 2015 jdk-7u75-linux-x64.rpm -rw-r--r-- 1 root root 507 Jun 9 2014 README drwxrwxr-x 9 hadoop hadoop 4096 Mar 18 2014 scala -rw-r--r-- 1 root root 29937534 Feb 1 2015 scala-2.10.4.tgz drwxrwxr-x 27 hadoop hadoop 4096 Feb 1 2015 spark -rw-r--r-- 1 root root 176185960 Feb 1 2015 spark-0.9.1-bin-hadoop2.tgz -rw-r--r-- 1 root root 27179604 Jan 29 2015 zookeeper-3.4.5-cdh5.0.2.tar.gz
13./srv
系统上运行的服务用到的数据。
[[email protected] ~]# ll /srv total 0
14./tmp
临时文件存储位置
[[email protected] ~]# ll /tmp/ total 56 drwx------ 2 root root 4096 Jul 2 21:07 keyring-yH0NhR drwx------ 2 gdm gdm 4096 Jul 2 21:07 orbit-gdm drwx------ 2 root root 4096 Jul 2 21:07 orbit-root drwx------ 2 hadoop hadoop 4096 Jan 30 2015 pulse-2nPNQpo4lJFS drwx------. 2 root root 4096 Jul 2 21:07 pulse-ckxa76ZxpqLO drwx------. 2 gdm gdm 4096 Jul 2 21:07 pulse-QIXd2NkmmvjA drwx------ 2 root root 4096 Jun 26 03:52 virtual-root.1bRsB1 drwx------ 2 root root 4096 Jun 30 06:16 virtual-root.bmCycC drwx------ 2 root root 4096 Jun 26 03:43 virtual-root.EVR104 drwx------ 2 root root 4096 Jun 26 03:59 virtual-root.olYvZu drwx------ 2 root root 4096 Jul 2 21:07 virtual-root.uvwUVm drwxrwxrwt. 2 root root 4096 Jan 27 2015 VMwareDnD drwxr-xr-x. 2 root root 4096 Jul 2 21:06 vmware-root drwx------. 2 root root 4096 Jul 2 21:07 vmware-root-1857817695
15./usr
shared, read-only data
[[email protected] ~]# ll /usr/ total 136 dr-xr-xr-x. 2 root root 36864 Jun 26 04:20 bin drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc drwxr-xr-x. 2 root root 4096 Sep 23 2011 games drwxr-xr-x. 32 root root 4096 Jan 27 2015 include drwxr-xr-x 3 root root 4096 Jan 29 2015 java dr-xr-xr-x. 14 root root 4096 Jan 27 2015 lib dr-xr-xr-x. 91 root root 36864 Jan 27 2015 lib64 drwxr-xr-x. 22 root root 12288 Jan 27 2015 libexec drwxr-xr-x. 14 root root 4096 May 23 2015 local dr-xr-xr-x. 2 root root 12288 Jan 27 2015 sbin drwxr-xr-x. 172 root root 4096 Jan 27 2015 share drwxr-xr-x. 4 root root 4096 Jan 27 2015 src lrwxrwxrwx. 1 root root 10 Jan 27 2015 tmp -> ../var/tmp
bin: 保证系统拥有完整功能而提供的应用程序;
sbin:
lib:
lib64:
include: C程序的头文件(header files);
share:结构化独立的数据,例如doc, man等;
local:第三方应用程序的安装位置;
bin, sbin, lib, lib64, etc, share
[[email protected] ~]# ll /usr/local/ total 208032 drwxr-xr-x. 2 root root 4096 Sep 23 2011 bin drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc drwxr-xr-x. 2 root root 4096 Sep 23 2011 games drwxr-xr-x 12 20000 20000 4096 May 23 2015 hadoop-2.6.0 -rw-r--r-- 1 root root 195257604 Nov 30 2014 hadoop-2.6.0.tar.gz drwxr-xr-x. 2 root root 4096 Sep 23 2011 include drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib64 drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin drwxr-xr-x. 5 root root 4096 Jan 27 2015 share drwxr-xr-x. 2 root root 4096 Sep 23 2011 src -rwxr--r-- 1 root root 367 May 23 2015 start-hadoop.sh -rwxr--r-- 1 root root 361 May 23 2015 stop-hadoop.sh drwxr-xr-x 11 1000 1000 4096 May 22 2015 zookeeper-3.4.6 -rw-r--r-- 1 root root 17699306 Mar 22 2015 zookeeper-3.4.6.tar.gz
16./var
cache: 应用程序缓存数据目录;
lib: 应用程序状态信息数据;
local:专用于为/usr/local下的应用程序存储可变数据;
lock: 锁文件
log: 日志目录及文件;
opt: 专用于为/opt下的应用程序存储可变数据;
run: 运行中的进程相关的数据;通常用于存储进程的pid文件;
spool: 应用程序数据池;
tmp: 保存系统两次重启之间产生的临时数据;
[[email protected] ~]# ll /var total 76 drwxr-xr-x. 2 root root 4096 Jan 27 2015 account drwxr-xr-x. 13 root root 4096 Jan 27 2015 cache drwxr-xr-x. 2 root root 4096 Jun 26 03:50 crash drwxr-xr-x. 3 root root 4096 Jan 27 2015 db drwxr-xr-x. 3 root root 4096 Jan 27 2015 empty drwxr-xr-x. 2 root root 4096 Sep 23 2011 games drwxrwx--T. 2 root gdm 4096 Oct 15 2014 gdm drwxr-xr-x. 33 root root 4096 Jan 27 2015 lib drwxr-xr-x. 2 root root 4096 Sep 23 2011 local drwxrwxr-x. 5 root lock 4096 Jul 2 22:14 lock drwxr-xr-x. 12 root root 4096 Jul 2 21:06 log lrwxrwxrwx. 1 root root 10 Jan 27 2015 mail -> spool/mail drwxr-xr-x. 2 root root 4096 Sep 23 2011 nis drwxr-xr-x. 2 root root 4096 Sep 23 2011 opt drwxr-xr-x. 2 root root 4096 Sep 23 2011 preserve drwxr-xr-x. 29 root root 4096 Jul 2 21:18 run drwxr-xr-x. 13 root root 4096 Jan 27 2015 spool drwxrwxrwt. 2 root root 4096 Jun 26 04:06 tmp drwxr-xr-x. 6 root root 4096 Jan 27 2015 www drwxr-xr-x. 2 root root 4096 Sep 23 2011 yp
[[email protected] ~]# ls /var/log/ anaconda.ifcfg.log cron-20150918 messages secure-20160626 anaconda.log cron-20160626 messages-20150521 spice-vdagent.log anaconda.program.log cups messages-20150524 spooler anaconda.storage.log dmesg messages-20150918 spooler-20150521 anaconda.syslog dmesg.old messages-20160626 spooler-20150524 anaconda.xlog dracut.log ntpstats spooler-20150918 anaconda.yum.log dracut.log-20160626 pm-powersave.log spooler-20160626 audit gdm ppp tallylog boot.log httpd prelink vmware-tools-upgrader.log btmp lastlog sa wpa_supplicant.log btmp-20160701 maillog samba wtmp ConsoleKit maillog-20150521 secure Xorg.0.log cron maillog-20150524 secure-20150521 Xorg.0.log.old cron-20150521 maillog-20150918 secure-20150524 yum.log cron-20150524 maillog-20160626 secure-20150918 yum.log-20160626
[[email protected] ~]# ll /var/run/ total 180 drwxr-xr-x. 2 root root 4096 Jul 2 21:06 abrt -rw-r--r-- 1 root root 5 Jul 2 21:06 abrtd.pid -rw-r--r-- 1 root root 5 Jul 2 21:06 acpid.pid srw-rw-rw- 1 root root 0 Jul 2 21:06 acpid.socket -rw-r--r-- 1 root root 5 Jul 2 21:06 atd.pid -rw-r--r-- 1 root root 5 Jul 2 21:06 auditd.pid drwxr-xr-x. 2 root root 4096 Jan 31 2015 console drwxr-xr-x. 2 root root 4096 Jul 2 21:08 ConsoleKit -rw-r--r-- 1 root root 5 Jul 2 21:06 console-kit-daemon.pid -rw-r--r-- 1 root root 5 Jul 2 21:06 crond.pid ---------- 1 root root 0 Jul 2 21:06 cron.reboot drwxr-xr-x. 3 root lp 4096 Jul 2 21:06 cups -rw-r--r-- 1 root root 5 Jul 2 21:06 cupsd.pid drwxr-xr-x. 2 root root 4096 Jul 2 21:06 dbus -rw-r--r-- 1 root root 5 Jul 2 21:06 dhclient-eth2.pid drwxr-xr-x. 2 root root 4096 Oct 15 2014 faillock drwx--x--x. 4 root gdm 4096 Jul 2 21:07 gdm -rw-r--r-- 1 root root 5 Jul 2 21:06 gdm.pid drwx------. 2 haldaemon haldaemon 4096 Oct 15 2014 hald -rw-r--r-- 1 root root 5 Jul 2 21:06 haldaemon.pid drwx--x---. 2 root apache 4096 Oct 16 2014 httpd drwx------. 2 root root 4096 Oct 15 2014 lvm drwx------. 2 root root 4096 Oct 16 2014 mdadm -rw-r--r-- 1 root root 5 Jul 2 21:06 messagebus.pid drwxrwxr-x. 2 root root 4096 Oct 16 2014 netreport drwxr-xr-x. 2 root root 4096 Sep 14 2014 net-snmp drwxr-xr-x. 2 root root 4096 Jul 2 21:06 NetworkManager -rw-r--r-- 1 root root 377 Jul 2 21:06 nm-dhclient-eth2.conf drwxr-xr-x. 2 root root 4096 Aug 11 2014 plymouth drwxr-xr-x. 5 root root 4096 Jan 27 2015 pm-utils drwxr-xr-x. 2 root root 4096 Jul 2 21:06 portreserve drwxr-xr-x. 2 root root 4096 Aug 22 2010 ppp drwxr-xr-x. 2 root root 4096 Oct 14 2014 saslauthd drwxr-xr-x. 2 root root 4096 Oct 15 2014 sepermit drwxr-xr-x. 2 root root 4096 Oct 15 2014 setrans drwxr-xr-x. 2 root root 4096 Oct 15 2014 spice-vdagentd -rw-r--r-- 1 root root 5 Jul 2 21:06 sshd.pid -rw------- 1 root root 5 Jul 2 21:06 syslogd.pid -rw-r--r-- 1 root root 11 Jul 2 21:06 tpvmlpd.pid -rw-r--r-- 1 root root 11 Jul 2 21:06 tpvmlpd.stat drwxr-xr-x. 2 root root 4096 Jul 2 21:06 udev-configure-printer drwx------. 2 root root 4096 Mar 13 2014 udisks -rw-rw-r-- 1 root utmp 3840 Jul 2 21:08 utmp dr-xr-xr-x 3 root root 4096 Jul 2 22:18 vmblock-fuse -rw-r--r-- 1 root root 5 Jul 2 21:05 vmtoolsd.pid drwxr-xr-x. 2 root root 4096 Oct 15 2014 winbindd drwxr-xr-x. 2 root root 4096 Feb 4 2013 wpa_supplicant -rw-r--r-- 1 root root 5 Jul 2 21:06 wpa_supplicant.pid
[[email protected] ~]# ll /var/mail/ total 4 -rw-rw----. 1 hadoop mail 0 Jan 27 2015 hadoop -rw-------. 1 root mail 1272 Jan 28 2015 root -rw-rw---- 1 zhangshan mail 0 May 21 2015 zhangshan
17./proc:
用于输出内核与进程信息相关的虚拟文件系统(linux调优)
[[email protected] ~]# ls /proc/ 1 1663 2075 2306 2377 25 43 bus key-users self 10 17 2077 2314 2381 2507 45 cgroups kmsg slabinfo 11 1707 208 2315 2385 2510 46 cmdline kpagecount softirqs 12 1712 2088 2319 2386 2534 47 cpuinfo kpageflags stat 1244 1738 209 232 2389 26 5 crypto loadavg swaps 1264 1788 2091 2327 2394 27 6 devices locks sys 13 18 21 233 2398 279 7 diskstats mdstat sysrq-trigger 14 19 2108 2339 2399 280 738 dma meminfo sysvipc 1423 1984 2178 234 24 29 78 driver misc timer_list 1453 2 2183 2341 2415 2952 79 execdomains modules timer_stats 15 20 22 2343 2418 3 8 fb mounts tty 1585 2008 2233 2351 2424 30 853 filesystems mpt uptime 1596 2009 2247 2352 2441 31 854 fs mtd version 16 2011 2261 2354 2444 310 895 interrupts mtrr vmallocinfo 1601 2023 2265 2356 2445 32 896 iomem net vmstat 1617 2037 2275 2360 2447 33 9 ioports pagetypeinfo zoneinfo 1621 2064 2283 2362 2476 34 941 irq partitions 1624 2069 2284 2366 2491 365 acpi kallsyms sched_debug 1652 2071 2297 2370 2494 4 asound kcore schedstat 1662 2073 23 2375 2495 42 buddyinfo keys scsi
18./sys
用于输出当前系统上硬件设备相关信息的虚拟文件系统。
[[email protected] ~]# ll /sys/ total 0 drwxr-xr-x 2 root root 0 Jul 2 21:05 block drwxr-xr-x 16 root root 0 Jul 2 21:05 bus drwxr-xr-x 44 root root 0 Jul 2 21:06 class drwxr-xr-x 4 root root 0 Jul 2 21:05 dev drwxr-xr-x 11 root root 0 Jul 2 21:05 devices drwxr-xr-x 4 root root 0 Jul 2 21:05 firmware drwxr-xr-x 4 root root 0 Jul 2 21:06 fs drwxr-xr-x 2 root root 0 Jul 2 21:06 hypervisor drwxr-xr-x 5 root root 0 Jul 2 21:05 kernel drwxr-xr-x 100 root root 0 Jul 2 21:06 module drwxr-xr-x 2 root root 0 Jul 2 21:06 power
19./selinux
security enhanced Linux,selinux相关的安全策略等信息的存储位置;
[[email protected] ~]# ll /selinux/ total 0
上面是linux根目录文件系统的组成部分。
下面说一下linux的应用程序的组成部分,如下:
二进制程序:/bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin
库文件:/lib, /lib64, /usr/lib, /usr/lib64, /usr/local/lib, /usr/local/lib64
配置文件:/etc, /etc/DIRECTORY, /usr/local/etc
帮助文件:/usr/share/man, /usr/share/doc, /usr/local/share/man, /usr/local/share/doc
Linux下的文件类型:通过file 查看文件类型
- (f):普通文件;
d: 目录文件;
b: 块设备;
c: 字符设备;
l: 符号链接文件;
p: 管道文件;
s: 套接字文件;socket;
[[email protected] ~]# file zookeeper.out zookeeper.out: ASCII English text, with very long lines
[[email protected] ~]# file test test: directory
系统管理类命令:
关机:
halt, poweroff, shutdown, init 0
重启:
reboot, shutdown, init 6
跟用户登录相关:
who, whoami, w
关机或重启:
halt, poweroff
reboot
-f: 强制,不调用shutdown
-p: 切断电源
shutdown:
shutdown [OPTION]... TIME [MESSAGE]
-r: reboot
-h: halt
-c:cancel
TIME:
now: 立刻
+m: 相对时间表示法,从命令提交开始多久之后;例如 +3;
hh:mm: 绝对时间表示,指明具体时间;
用户登录信息查看命令:
whoami: 显示当前登录有效用户;
[[email protected] ~]# whoami root
who: 系统当前所有的登录会话;
[[email protected] ~]# who root tty2 2016-07-02 21:08 //虚拟终端登录 root tty1 2016-07-02 21:07 (:0) //虚拟终端登录 root pts/0 2016-07-02 21:07 (:0.0) //图形界面 root pts/1 2016-07-02 21:08 (192.168.0.105) //模拟终端登录
w: 系统当前所有的登录会话及所做的操作;
[[email protected] ~]# w 22:57:08 up 1:51, 4 users, load average: 0.00, 0.00, 0.00 USER TTY FROM [email protected] IDLE JCPU PCPU WHAT root tty2 - 21:08 1:48m 0.02s 0.02s -bash root tty1 :0 21:07 1:51m 6.00s 6.00s /usr/bin/Xorg :0 -br -v root pts/0 :0.0 21:07 1:49m 0.03s 0.03s /bin/bash root pts/1 192.168.0.105 21:08 0.00s 0.17s 0.02s w
总结:linux文件系统是学习linux的基础,一定要学好哦!!