文件操作-cd
发布时间:2020-12-14 01:59:19 所属栏目:Linux 来源:网络整理
导读:cd命令是linux实际使用当中另一个非常重要的命令,本文就为大家介绍下Linux中cd命令的用法。 cd命令 Linux cd命令用于切换当前工作目录至 dirName(目录参数)。 其中 dirName 表示法可为绝对路径或相对路径。若目录名称省略,则变换至使用者的 home 目录 (也
cd命令是linux实际使用当中另一个非常重要的命令,本文就为大家介绍下Linux中cd命令的用法。 cd命令Linux cd命令用于切换当前工作目录至 dirName(目录参数)。 其中 dirName 表示法可为绝对路径或相对路径。若目录名称省略,则变换至使用者的 home 目录 (也就是刚 login 时所在的目录)。 另外,"~" 也表示为 home 目录 的意思,"." 则是表示目前所在的目录,".." 则表示目前目录位置的上一层目录。 一、Linux cd命令语法cd [dirName] dirName:要切换的目标目录。 二、Linux cd命令实例跳入test目录: [[email?protected]/root/linuxdaxue.com]#cd testDir/ [[email?protected]/root/linuxdaxue.com/testDir]#ls file1 file2 file3 跳至上层目录: [[email?protected]/root/linuxdaxue.com/testDir]#cd .. [[email?protected]/root/linuxdaxue.com]#ls testDir 跳至上上层目录: [[email?protected]/root/linuxdaxue.com/testDir]#cd ../../ [[email?protected]/root]#ls 跳入用户主目录: [[email?protected]/root/linuxdaxue.com/testDir]#ls file1 file2 file3 [[email?protected]/root/linuxdaxue.com/testDir]#cd ~/ [[email?protected]/root]#pwd /root 使用绝对路径: [[email?protected]/root]#cd /root/linuxdaxue.com/testDir [[email?protected]/root/linuxdaxue.com/testDir]#ls file1 file2 file3 使用环境变量: [[email?protected]/root]#cd $TEST_PATH [[email?protected]/root/linuxdaxue.com/testDir]#ls file1 file2 file3 跳入上次使用目录: [[email?protected]/root]#pwd /root [[email?protected]/root]#cd - /root/linuxdaxue.com/testDir [[email?protected]/root/linuxdaxue.com/testDir]# cd命令比较简单,主要用来切换工作目录,希望大家能熟练掌握。 转载自 https://www.cnblogs.com/waitig/p/5880719.html 更多Linux命令详情可看 https://www.linuxdaxue.com/linux-commands-manual (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- linux – 如果Perl试图在正在上传的文件上调用move(),会发生
- IBM3500恢复步骤实例
- linux – 中断mdadm –grow操作是否安全?
- linux – 我可以使用tar将特定文件夹解压缩到另一个文件夹吗
- linux – SSSD安装目录为空
- 在Linux中安装Android Studio到/ opt(将1.9 GB?/ Android/S
- Linux / Unix Command: bunzip2--reference
- Chef:部署一个禁用root ssh访问的服务器?
- 用于记录IO统计信息的Linux实用程序(随机/顺序,块大小,读/写
- linux – 如何用sed删除“]之后的一行中的所有字符?