[Linux Learning] Essential Linux Commands (1) – Detailed explanation of the cd command

Linux essential commands (1) – Detailed explanation of the cd command

Detailed explanation of cd command

The cd command is mainly used for directory switching. For example,
when no parameters are added, it switches to the user's home directory by default;
~ Enters the user's home directory;
- Returns to the directory before entering this directory;
!$ uses the parameters of the previous command as cd parameters. ;
cd /home switches to the /home directory;
cd /root means switching to the /root directory;
cd .../ switches to the previous directory;
cd ./ switches to the current directory.
Among them, . and ... can be understood as relative paths.
For example, cd ./test means taking the current directory as a reference, indicating relative to the current,
while cd /home/test means a complete path, understood as an absolute path.

[root@nie ~]# cd /etc/sysconfig/network-scripts
[root@nie network-scripts]# cd
[root@nie ~]# cd /home
[root@nie home]# cd /root
[root@nie ~]# cd /
[root@nie /]# cd usr/local/sbin
[root@nie sbin]# cd ./
[root@nie sbin]# cd ../
[root@nie local]# cd ~
[root@nie ~]# cd -
/usr/local
[root@nie local]# cd !$
cd ..

Guess you like

Origin blog.csdn.net/weixin_43757336/article/details/130893163