in Linux, use the pwd command to view the full path to the current working directory. Simply put, you will have a current working directory every time you operate in a terminal.
When unsure of the current location, PWD is used to determine the exact location of the current directory within the file system.
1. Command format:
PWD [Options]
2. Command function:
View the full path to the current working directory
3. Common parameters:
Normally without any parameters
If the directory is a link:
Format:pwd-p shows the actual path, not thelinkpath.
4. Common examples:
Example 1: Viewing the full path of the default working directory with the PWD command
Command :
Pwd
Output :
[[email protected] ~]# cd/opt/soft/[[email protected] soft]# Pwd/opt/soft[[email protected] soft]#
example three : When a directory connection is linked, Pwd-p displays the actual path, not the connection path; pwd shows the connection path
Command :
Pwd-p
Output :
[Email protected] soft]# CD/ETC/INIT.D [[email protected] init.d]# pwd/etc/init.d[[email protected] init.d]# pwd-p/etc/ Rc.d/init.d[[email protected] init.d]#
The popular understanding is that INIT.D is a hyperlink to deepen the impression
Example 4:/bin/pwd
Command :
/bin/pwd [ options ]
Options:
-L directory connection link, output connection path
-P Output Physical path
Output :
[[email protected] init.d]#/bin/pwd/etc/rc.d/init.d[[email protected] init.d]#/bin/pwd--help[[email protected] init.d]#/bin/pwd-p/etc/rc.d/init.d[[email protected] init.d]#/bin/pwd-l/etc/init.d[[email protected] init.d]#
instance five: The current directory is deleted , and the PWD command still displays that directory
Output :
[[email protected] init.d]# cd/opt/soft[[email protected] soft]# mkdir removed[[email protected] soft]# CD Removed/[[emai L protected] removed]# Pwd/opt/soft/removed[[email protected] removed]# rm. /removed-rf[[email protected] removed]# pwd/opt/soft/removed[[email protected] removed]#/bin/pwd/bin/pwd:couldn ' t Find directory entry in ":" with matching I-node[[email protected] removed]# CD [[email protected] ~]# Pwd/root[[email PR Otected] ~]#
One Linux command per day (3): pwd command