我对一切皆文件的理解,linux下不存在具体的文件类型或后缀名.exe .db .config,这种后缀能够理解为人为的为了分别文件的类型而设置的,而在linux中系统不考虑文件类型,会直接运行。linux
举个例子,咱们在/app下建立一个内容为 echo ‘hello world’ 的hello.txt文件而后按照windows下的扩展名更改扩展名windows
看看会发生什么app
[root@localhost app]# echo "echo hello world">hello.txt [root@localhost app]# ls hello.txt [root@localhost app]# cat hello.txt echo hello world [root@localhost app]# chmod 777 hello.txt [root@localhost app]# ./hello.txt hello world
咱们尝试将txt格式转换为.sh而后运行发现结果同样多是巧合spa
[root@localhost app]# mv hello.txt hello.sh [root@localhost app]# ./hello.sh hello world
咱们再尝试将.sh格式转换为.mp3而后运行发现结果同样code
此次由于咱们都知道MP3是音乐媒体格式按照windows的逻辑确定会报错blog
但在linux下运行没有报错或显示内容ip
[root@localhost app]# mv hello.sh hello.mp3 [root@localhost app]# ./hello.mp3 hello world
一样的将MP3转换png也是同样的pip
[root@localhost app]# mv hello.mp3 hello.png [root@localhost app]# ./hello.png hello world
咱们用大胆的想法去删除它的扩展名入门
结果发现仍是正常的运行了class
[root@localhost app]# mv hello.png hello [root@localhost app]# ./hello hello world
最后我用打错了的方式随意起名
发现也没有任何影响
[root@localhost app]# mv hello hel.fdshfujahjk213sda.sad [root@localhost app]# ./hel.fdshfujahjk213sda.sad hello world
咱们能够得出结论,linux下不存在扩展名,只存在文件名,所谓的扩展名只是
人们为了区分文件而自行加上的字符
• -:普通文件 *
• d: 目录文件 *
• b: 块设备
• c: 字符设备
• l: 符号连接文件 *
• p: 管道文件pipe
• s: 套接字文件sock
绝对路径:从根出发一直到目标
相对路径:相对父目录
.为当前路径
..为上级路径即父路径