综合百科

cdlinux使用教程(linux系统下cd命令怎么用)

Linux cd命令用于切换当前工作目录至 dirName(目录参数)。

其中 dirName 表示法可为绝对路径或相对路径。若目录名称省略,则变换至使用者的 home 目录 (也就是刚 login 时所在的目录)。

另外,"~" 也表示为 home 目录 的意思,"." 则是表示目前所在的目录,".." 则表示目前目录位置的上一层目录。

一、Linux cd命令语法

cd [dirName]

dirName:要切换的目标目录。

二、Linux cd命令实例

跳入test目录:

[root@/root/linuxdaxue.com]#cd testDir/[root@/root/linuxdaxue.com/testDir]#lsfile1 file2 file3

跳至上层目录

[root@/root/linuxdaxue.com/testDir]#cd ..[root@/root/linuxdaxue.com]#lstestDir

跳至上上层目录

[root@/root/linuxdaxue.com/testDir]#cd ../../[root@/root]#ls

跳入用户主目录

[root@/root/linuxdaxue.com/testDir]#lsfile1 file2 file3[root@/root/linuxdaxue.com/testDir]#cd ~/[root@/root]#pwd/root

使用绝对路径

[root@/root]#cd /root/linuxdaxue.com/testDir[root@/root/linuxdaxue.com/testDir]#lsfile1 file2 file3

使用环境变量

[root@/root]#cd $TEST_PATH[root@/root/linuxdaxue.com/testDir]#lsfile1 file2 file3

跳入上次使用目录

[root@/root]#pwd/root[root@/root]#cd -/root/linuxdaxue.com/testDir[root@/root/linuxdaxue.com/testDir]#

cd命令比较简单,主要用来切换工作目录,希望大家能熟练掌握。

相关文章

  • 重大疾病保险的定义?
  • 保险买哪个保险公司比较好?
  • 结构性存款是什么意思?结构性存款的预期收益高吗?
  • 手机银行转账被骗如何追回?
  • 建设银行信用卡账单日当天刷卡什么时候还款?
  • 中国平安险种介绍
  • 博时安盈债券C安全吗?
  • 小树时代怎么样 小树时代可靠吗
  • 股票分红需要持有一年吗?股票持有多久才能分红?
  • 余额宝升级入口在哪?升级后有什么好处?
  • 韩雪 电视剧
  • 李小璐吐槽大会原图:吐槽大会李小璐回应整容传闻
  • 杭州市人才市场电话
  • 陈紫函45岁暴瘦惊人,直播介绍减肥方法
  • 巴黎圣日耳曼vs皇马直播:精彩对决即将上演
  • 安全工程师挂靠价格多少?如何比较合理?
  • 江苏省垃圾大学 江苏省的大学
  • 今年是国庆多少周年
  • 好玩的nds中文游戏有哪些? 推荐几个好玩的nds中文游戏
  • 卡尔刺猬是什么梗 卡尔刺猬的解释