03-文件目录操作.pptxVIP

  • 2
  • 0
  • 约6.85千字
  • 约 40页
  • 2023-12-16 发布于湖北
  • 举报

目录和文件操作

目录操作pwd∶显示目前的目录cd∶变换目录mkdir∶建立一个新的目录rmdir∶删除一个空的目录

pwdpwd命令显示当前所处目录[root@RHLinuxroot]#pwd/root

cdcd用于切换目录.代表此层目录..代表上一层目录-代表前一个工作目录~代表『目前使用者身份』所在的家目~account代表account这个使用者的家目录[root@RHLinuxstudent]#cd/home/student[root@RHLinuxstudent]#cd..[root@RHLinuxstudent]#cd-[root@RHLinuxstudent]#cd~

mkdirmkdir创建目录[root@linuxtmp]#mkdirtest[root@linuxtmp]#mkdirtest1/test2/test3/test4mkdir:cannotcreatedirectory`test1/test2/test3/test4:Nosuchfileordirectory[root@linuxtmp]#mkdir-ptest1/test2/test3/test4[root@linuxtmp]#

rmdirrmdir(删除『空』的目录)[student@RHLinuxstudent]$cdtest1/test2/test3[student@RHLinuxtest3]$rmdirtest4[student@RHLinuxtest3]$

lsls用于显示当前目录下的文件和目录列出本目录下一般文件[root@RHLinux/]#lsbin devhome lib miscopt roottmpvarbootetcinitrdlost+foundmnt procsbinusr列出/root下一般文件[root@RHLinux/]#ls/rootanaconda-ks.cfginstall.loginstall.log.syslog

ls-a选项:列出全部文件,包括隐藏文件。-l选项:详细列表,包括时间、文件权限等。-h选项:将大小以易读的方式显示出来[teacher@RHLinuxteacher]$ls-alhtotal28Kdrwx------2teacherteacher 4.0KNov416:23.drwxr-xr-x3root root 4.0KOct2710:11..-rw-------1teacherteacher74Nov314:33.bash_history-rw-r--r--1teacherteacher24Oct2710:11.bash_logout-rw-r--r--1teacherteacher191Oct2710:11.bash_profile-rw-r--r--1teacherteacher124Oct2710:11.bashrc-rw-r--r--1teacherteacher49Nov416:23.vimrc

ls-r:将排序结果反向输出;-R:连同子目录内容一起列出来;-S:以文件容量大小排序!-t:依时间排序--color={never,tty,…}:颜色显示 --time={atime,ctime}:输出access时间或改变权限属性时间 (ctime)而非内容变更时间(modificationtime)

ls[student@RHLinuxstudent]$ls-al总用量282studentstudent 40965月1413:17.4root root 40965月1320:15..drwx------drwxr-xr-x-rw--------rw-r--r--1studentstudent1studentstudent17335月1413:16.bash_history245月1210:32.bash_logout-rw-r--r--1studentstudent1915月1210:32.bash_profile-rw-r--r--1studentstudent1245月1210:32.bashrc-rw-------1studentstudent6415月1211:47.viminfo文件类型和文件访问权限链接数量文件所有者组所有者文件大小(以字节为单位)最后修改的日期和时间文件名

lsdrwxr-xr-x文件类型本人访问权限其他用户组访问权限本

文档评论(0)

1亿VIP精品文档

相关文档