
[root@localhost ~]# bin
bash: bin: command not found <-- 沒有找到
[root@localhost ~]# /usr/bin
bash: /usr/bin: is a directory <-- 是一個文件
[root@localhost ~]# pwd <-- 顯示當(dāng)前所在的工作路徑
/root
[root@localhost ~]# cd /root/Desktop
[root@localhost Desktop]# pwd
/root/Desktop
可以看到,通過使用絕對路徑,我們成功地改變了當(dāng)前工作路徑。但除此之外,使用相對路徑的方式會更簡單。因為目前處于 /root 的位置,而 Desktop 就位于當(dāng)前目錄下,所以:注意,這里所使用的 pwd 和 cd 命令,目前只需知道它們的功能即可,具體用法會在后續(xù)文章中作詳細(xì)講解。
[root@localhost ~]# pwd <-- 顯示當(dāng)前所在的工作路徑
/root
[root@localhost ~]# cd ./Desktop
[root@localhost Desktop]# pwd
/root/Desktop
#使用絕對路徑
[root@localhost ~]# pwd <-- 顯示當(dāng)前所在的工作路徑
/root
[root@localhost ~]# cd /usr
[root@localhost ~]# pwd
/usr
#使用相對路徑
[root@localhost ~]# pwd <-- 顯示當(dāng)前所在的工作路徑
/root
[root@localhost ~]# cd ../usr <-- 相對 root,usr 位于其父目錄 /,因此這里要用到 ..
[root@localhost ~]# pwd
/usr
新聞熱點
疑難解答
圖片精選