1.权限:
我们的Linux是不区分文件拓展名的 比如test.sh 我们吧名字改为test 只要有执行权限
也是能执行的 我们为了我们自己的方便 给他加上了 拓展名
2.文件
我们的文件系统容许最大的文件名字为256字节 也就是最大128个中文
所有的命令都是有执行文件的这些文件都是二进制文件 我们是看不了的
他们都是有执行权限的 拿掉x就无法执行
3.unamre 和 lsb_release
第一个命令能看到内核版本 和架构
第二个命令能看到详细信息 比如 centos7.6 这些信息
不过需要安装 yum -y install redhat_lsb
4. 查找命令
1)file
查看文件格式信息 也可以查看压缩方式
[root@ds ~]# file /usr/bin/passwd
/usr/bin/passwd: setuid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=1e5
735bf7b317e60bcb907f1989951f6abd50e8d, stripped
2)which
查找脚本文件 是通过PATH的路径来查找的 (只能查找脚本文件)
查找history cd 命令会找不到 因为这都是bash内置的命令
[root@ds ~]# file /usr/bin/passwd
/usr/bin/passwd: setuid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=1e5
735bf7b317e60bcb907f1989951f6abd50e8d, stripped
3)whereis
查找速度很快 因为只会去查看几个特定的目录
你可以使用 whereis -l 来查看呢几个特定的目录
[root@ds ~]# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
[root@ds ~]# whereis -l
4)locate
locate -l 5 passwd
搜索含有passwd的 只取出前5个
这个命令的包名字是 mlocate
使用要安装 yum -y install mlocate
[root@ds ~]# locate -l 5 passwd
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
#报错是因为没有建立数据库
[root@ds ~]# updatedb
[root@ds ~]# locate -l 5 passwd
/etc/passwd
/etc/passwd-
/etc/pam.d/passwd
/etc/security/opasswd
/usr/bin/gpasswd
他自己建立的有自己的数据库 所以搜索速度很快
默认的数据库一天更新一次
你新建立的文件夹 找不到的原因就是 他没有写入数据库中
你自己要手动更新
自己手动 更新要使用 updatedb 命令
find
参数太多了 以后再写笔记
我们这里介绍两个特殊的参数
find /usr/bin -perm 0755
find /usr/bin -perm /7000
第一个查找权限为 0755的文件包含755 也会被查找出来 你的权限是0777也会别查找出来
第二个是包含的的关系 你查找权限为0755的文件如果一个文件的权限为 600 也会背
以为这个文件中含有rwx中的元素
我们一般使用这个选项来查找 含有特殊权限的
7000 就是只要含有suid sgit sbit中的一个就直接列出 用于查找特殊文件
还有一个额外操作
find /usr/bin/ /usr/sbin/ -perm /7000 -exec ls -l {} \;
这个就是吧前边的结果使用 ls -l 列出
各个参数的意义
{} 这个代表的是find找到的结果 结果会被放到 {} 中
-exec 一直到 \ 是关键词 代表的是进行的额外操作 就是ls -l
; 因为;在bash 环境中有特殊的意义所以需要 转义符来进行转义
当然也可以使用 传参的命令 xargs
find /usr/bin/ /usr/sbin/ -perm /7000 | xargs ls -l
还有一点 find支持通配符