linux文件与目录管理
来源:互联网 发布:阿里云服务器如何重启 编辑:程序博客网 时间:2024/06/06 00:41
目录与路径
相对路径与绝对路径
相对路径:路径的写法从根目录“/”写起,例如:/usr/bin/
绝对路径:路径的写法不从根目录“/”写起,例如:从/usr/bin/到/usr/local可以写cd../local/
目录的相关操作
cd(Change Directory):切换目录
cd .. /cd -:回到当前文件的上层目录cd ~/cd :回到自己的主文件夹,及/root目录
pwd(Print WorkingDirectory):显示当前目录
[root@localhost mail]# pwd/var/mail[root@localhost mail]# pwd –P 大写的P/var/spool/mail-P:显示当前路径,不是使用链接的路径
mkdir:新建一个新的目录(文件)
[root@localhost tmp]# mkdir -p test1/test2/test3/test4 ==》加了-p参数就可以创建多层目录了[root@localhost tmp]# mkdir -m 711 test2==》新建权限为:rwx—x—x的目录[root@localhost tmp]# ls -l总用量 20drwxr-xr-x. 2 root root 4096 5月 5 11:21 711-rw-rw-r--. 1 root root 0 5月 3 16:54 attrtest-rw-r--r--. 1 root root 176 5月 3 2015 bashrcdrwxr-xr-x. 2 root root 4096 5月 5 11:20 testdrwxr-xr-x. 3 root root 4096 5月 5 11:21 test1drwx--x--x. 2 root root 4096 5月 5 11:22 test2-rw-r--r--. 1 root root 0 5月 3 15:54 testtouch-rw-------. 1 root root 0 5月 3 12:49 yum.log
rmdir:删除一个空的目录(文件)
[root@localhost tmp]# rmdir test[root@localhost tmp]# rmdir test1rmdir: 删除 "test1" 失败: 目录非空[root@localhost tmp]# rmdir -p test1/test2/test3/test4/[root@localhost tmp]# ls711 attrtest bashrc test2 testtouch yum.log
$PATH:执行文件路径的变量:
[root@localhost tmp]# echo $PATH/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.7.0_71/bin:/root/bin
1、不同的身份用户默认你的path是不同的,默认能随意执行的命令你也是不同的
2、path是能够修改的,所以一般用户也可以通过修改来改变path来执行某位于/sbin或/usr/bin的命令来查询
3、使用绝对路径或相对路径直接指定某个命令的文件名来执行会更加方便,会比PATH来的正确
4、命令应该放在正确的目录下,执行起来才会更方便
5、本目录(.)最好不要放在PATH中
1 0
- Linux文件与目录管理
- Linux文件与目录管理
- Linux文件与目录管理
- linux文件与目录管理
- Linux文件与目录管理
- Linux 文件与目录管理
- linux文件与目录管理
- linux文件与目录管理
- Linux文件与目录管理
- Linux-文件与目录管理
- Linux文件与目录管理
- Linux文件与目录管理
- Linux文件与目录管理
- Linux 文件与目录管理
- Linux文件与目录管理
- Linux文件与目录管理
- Linux 文件与目录管理
- linux文件与目录管理
- AngularJS服务service用法总结
- html固定在屏幕右下角的信息(提示信息,广告)
- javaSwing教程
- 微服务架构之spring cloud (二)服务注册与发现
- 多线程
- linux文件与目录管理
- Centos 配置 VNCserver问题及解决
- Linux一些重要的头文件
- 仿百度图片实例
- ID3决策树算法(python实现)
- UE4 打包常规步骤
- 关于Java四种引用包括强引用,软引用,弱引用,虚引用。
- Kaldi学习笔记(一)
- MD5加密技术