一、Linux目录结构
设计哲学:
一切皆文件!!!
/ 根目录
/root root用户的家目录/宿主目录
/home 普通用户的家目录/宿主目录
/etc 应用程序的配置文件
/dev 存储设备文件(磁盘、分区)
/boot 内核、启动配置文件
/proc 动态文件,记录包括CPU、内存、网卡、进程的使用情况的文件
/lib64 库文件、保证某应用程序可正常运行
/opt 用户的工作目录,保存下载工具、软件、文档
/tmp 临时目录
二、命令提提示符
调大字体:ctrl+shift+
调小字体:ctrl -
[root@localhost ~] #
root:当前登陆系统的用户名
localhost:默认的主机名
~: 当前目录;~当前用户的家目录
#:管理员 $:普通用户
三、文件目录基本管理指令
1、切换、查看目录
格式:
cd [目录名称]
[root@wtl ~]# cd /etc/sysconfig/
[root@wtl sysconfig]# pwd
[root@wtl ~]# pwd
/root
[root@wtl ~]# cd /etc/
[root@wtl etc]# pwd
/etc
[root@wtl etc]# cd
[root@wtl ~]#
[root@wtl ~]# pwd
/root
[root@wtl ~]# cd /
[root@wtl /]# cd etc/
[root@wtl etc]# pwd
/etc/etc/sysconfig
[root@wtl ~]# pwd
/root
[root@wtl ~]# cd /etc/sysconfig/
[root@wtl sysconfig]# pwd
/etc/sysconfig
[root@wtl sysconfig]# cd
[root@wtl ~]# pwd
/root
[root@wtl ~]# cd /etc/
[root@wtl etc]# cd sysconfig/
[root@wtl sysconfig]# pwd
/etc/sysconfig
[root@wtl ~]# cd /etc/sysconfig/
[root@wtl sysconfig]# pwd
/etc/sysconfig
[root@wtl sysconfig]# cd ..
[root@wtl etc]# pwd
/etc
[root@wtl etc]# cd ..
[root@wtl /]# pwd
/
[root@wtl /]# cd ..
2、查看目录下的文件
ls [选项] [目录名称]
常用选项:
1) -a 查看目录下的所有文件
[root@wtl ~]# ls -a
. anaconda-ks.cfg .bash_logout .bashrc .ssh .viminfo
.. .bash_history .bash_profile .cshrc .tcshrc
2) -l 显示文件的详细信息
[root@wtl ~]# ls -l
total 4
-rw-------. 1 root root 1420 Dec 29 10:24 anaconda-ks.cfg
第一个字符:文件类型
普通文件: -
目录: d
软连接文件:l
块设备文件:b (磁盘、分区)
字符设备摁键:c (键盘、显示器、打印机)
1420 文件大小,单位Bytes字节
Dec 29 10:24 最后一次修改时间
[root@wtl ~]# ls -l /etc/passwd
-rw-r--r--. 1 root root 886 Dec 29 10:23 /etc/passwd
[root@wtl ~]# ls -l /etc/fstab
-rw-r--r--. 1 root root 465 Dec 29 10:17 /etc/fstab
3) -d 查看目录的详细信息
[root@wtl ~]# ls -ld /etc/
drwxr-xr-x. 75 root root 8192 Jan 11 21:26 /etc/
4) -S 按文件大小排序显示
[root@wtl ~]# ls -lhS /tmp/
5) -t 按文件修改时间排序
[root@wtl ~]# ls -lht /tmp/