Absolute path and Relative path

See this ariticle on my own blog https://dyingdown.github.io/2020/01/29/Absolute-path-Relative-path/

There are two ways to represents a directory, Absolute path and Relative path.

pathstartstart sign
Absoluteroot directory/
Relativecurrent directory~

For example, when I open the terminal at first time, the default directory is /home/user

I want to see the folder “name1” under /user/names

cd /home/user/names/name1  // Absolute

or type

cd names/name1

Now we are at name1, and we want to go to name2 at /user/names/name2

cd ../names2

represents the previous one directory of the current directory.

If I’m at names2, then “…” is names.

pwd  // to check your current directory
cd ~  // goes back to /home/user

to return the last directory(the one that your last command affect on)

cd -

It will also show it’s physical path. Like ~/Yao/Study/Blog

Or you can use

cd $OLDPWD

It’s the same to cd -.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值