[root@localhost /]# node
首先解释下这块, root表明当前登陆用户,localhost表明主机名, ~表明当前主机目录,#表明用户权限 #表示超级用户,$表示普通用户;bash
查询目录中内容命令 ls (list缩写)
ide
格式 ls [选项] [文件或目录]spa
选项:orm
ls -a 显示全部文件,包括隐藏文件crontab
ls -l 显示详细信息it
ls -d 查看目录属性console
ls -h 人性化显示文件大小class
ls -i 显示inode登录
超级用户root默认的当前目录是 root目录
咱们能够用pwd命名(Print Working Directory 打印当前工做目录)看到 /root
咱们打印下当前目录下文件信息:
[root@localhost ~]# ls
anaconda-ks.cfg
只有一个文件
假如咱们要列出全部文件 用 ls -a 把隐藏文件也显示出来
[root@localhost ~]# ls -a
. anaconda-ks.cfg .bash_logout .bashrc .tcshrc
.. .bash_history .bash_profile .cshrc
多了一些文件
咱们也能够看其余目录的文件:
[root@localhost ~]# ls /etc/
adjtime modprobe.d
aliases modules-load.d
aliases.db motd
alternatives mtab
anacrontab my.cnf
asound.conf my.cnf.d
audisp NetworkManager
audit networks
一样也能够看具体某个文件
[root@localhost ~]# ls -l /etc/vconsole.conf
-rw-r--r--. 1 root root 37 6月 10 05:23 /etc/vconsole.conf
咱们用 -l 或者 -la 组合 列出详细信息;
[root@localhost ~]# ls -l
总用量 4
-rw-------. 1 root root 1237 6月 10 05:24 anaconda-ks.cfg
[root@localhost ~]# ls -la
总用量 24
dr-xr-x---. 2 root root 135 6月 11 21:13 .
dr-xr-xr-x. 17 root root 224 6月 10 05:23 ..
-rw-------. 1 root root 1237 6月 10 05:24 anaconda-ks.cfg
-rw-------. 1 root root 0 6月 11 21:13 .bash_history
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
[root@localhost ~]#
这里第一列 好比 dr-xr-xr-x. 表明文件类型以及全部者,所属组以及其余者权限
第一位d表明文件类型 常见的有 - 表明 文件 d表示目录 | 软件连接文件
dr-xr-xr-x( d(第一位表示目录) r-x(第一个三位 全部者 具备读和执行的权限) r-x(第二个三位) r-x(第三个三位) )
后面9位 每3位一个组 分别是 全部者u 所属组g 以及 其余者o的权限
权限分三种 r读 w写 x执行
好比 dr-xr-xr-x 这个目录 全部者 所属组 以及其余者 都有 读和执行权限;
好比 -rw------- 这个文件 全部者有读写权限 所属组以及其余者没有权限;
第二列 那个数字 是 硬连接次数 后面再说;
第三列 root 是 全部者;
第四列 root 是 所属组;
第五列 是文件大小;假如看不惯 可用 ls -lh
[root@localhost ~]# ls -lh
总用量 4.0K
-rw-------. 1 root root 1.3K 6月 10 05:24 anaconda-ks.cfg
第六列的日期是该文件最后一次修改时间;
最后一列 是文件名称;
查看目录属性 要加 -d
[root@localhost ~]# ls -ld /etc/
drwxr-xr-x. 78 root root 8192 6月 13 15:50 /etc/
[root@localhost ~]#
查看文件的inode属性 相似 主键 惟一识别文件的Id 用 -i
[root@localhost ~]# ls -li
总用量 4
33574979 -rw-------. 1 root root 1237 6月 10 05:24 anaconda-ks.cfg
[root@localhost ~]#
33574979 就是inode属性