中文字幕亚洲第一精品|精品国产免费一区二区|久久婷婷五月六月综合版|中文字幕熟妇久久久人妻|久久综合精品国产一区无码|国产成人精品永久免费视频|午夜亚洲国产精品理论片a级|久久精品一区二区三区无码护土

 訪問手機(jī)版  

Linux常用命令|Linux培訓(xùn)學(xué)習(xí)|考試認(rèn)證|工資待遇與招聘,認(rèn)準(zhǔn)超級(jí)網(wǎng)工!

招聘|合作 登陸|注冊(cè)

網(wǎng)絡(luò)工程師培訓(xùn)

當(dāng)前位置:網(wǎng)絡(luò)工程師 > 技術(shù)課程 > linux > 熱點(diǎn)關(guān)注 > linux常用命令

linux每日命令(2):cd命令

時(shí)間:2019-10-16

linux 關(guān)機(jī)命令_linux命令_linux命令

cd   [目錄名]

切換當(dāng)前目錄至 [目錄名]

命令:

cd  / 

說明:進(jìn)入系統(tǒng)根目錄,上面命令執(zhí)行完后拿ls命令看一下linux命令,當(dāng)前目錄已經(jīng)到系統(tǒng)根目錄了

輸出:

hc@hc-virtual-machine:~$ pwd
/home/hc
hc@hc-virtual-machine:~$ cd /
hc@hc-virtual-machine:/$ ls
bin    dev   initrd.img      lib64       mnt   root  snap      sys  var
boot   etc   initrd.img.old  lost+found  opt   run   srv       tmp  vmlinuz
cdrom  home  lib             media       proc  sbin  swapfile  usr

pwd的作用是查詢當(dāng)前所在目錄

linux命令_linux 關(guān)機(jī)命令_linux命令

命令:

cd  ..

輸出:

hc@hc-virtual-machine:~/PycharmProjects$ pwd
/home/hc/PycharmProjects
hc@hc-virtual-machine:~/PycharmProjects$ cd ..
hc@hc-virtual-machine:~$ pwd
/home/hc

命令:

cd  ../..

輸出:

hc@hc-virtual-machine:~/PycharmProjects$ pwd
/home/hc/PycharmProjects
hc@hc-virtual-machine:~/PycharmProjects$ cd ../..
hc@hc-virtual-machine:/home$ pwd
/home

linux 關(guān)機(jī)命令_linux命令_linux命令

“當(dāng)前用戶主目錄”和“系統(tǒng)根目錄”是兩個(gè)不同的概念。進(jìn)入當(dāng)前用戶主目錄有兩個(gè)方法。

命令1:

cd

直接輸入cd,然后回車

輸出:

hc@hc-virtual-machine:~/PycharmProjects/my_test$ pwd
/home/hc/PycharmProjects/my_test
hc@hc-virtual-machine:~/PycharmProjects/my_test$ cd 
hc@hc-virtual-machine:~$ pwd
/home/hc

上面的命令是我在非root用戶下操作的linux命令,現(xiàn)在我切換到root用戶下再操作一遍

hc@hc-virtual-machine:~/PycharmProjects/my_test$ sudo su
root@hc-virtual-machine:/home/hc/PycharmProjects/my_test# pwd
/home/hc/PycharmProjects/my_test
root@hc-virtual-machine:/home/hc/PycharmProjects/my_test# cd 
root@hc-virtual-machine:~# pwd
/root

linux 關(guān)機(jī)命令_linux命令_linux命令

命令2:

cd ~

輸出

hc@hc-virtual-machine:~/PycharmProjects/my_test$ pwd
/home/hc/PycharmProjects/my_test
hc@hc-virtual-machine:~/PycharmProjects/my_test$ cd ~
hc@hc-virtual-machine:~$ pwd
/home/hc

命令