The Linux pwd command is mainly used to print the working path of the current working directory. If you want to use the pwd command, you should know the usage of the pwd command. The following small series will introduce you to the pwd command in Linux.
not sure when the current location, it will use pwd to determine the exact location of the current directory in the file system.
1. Command format:
pwd [options]
2. Command function:
View the full path of the current working directory <quo;
3. Common parameters:
Normally without any parameters
If the directory is linked:
Format: pwd -P shows the actual path instead of using the link (link )path.
4. Common examples:
Instance 1: Use the pwd command to view the full path of the default working directory
Command:
pwd
Output:
[root@localhost ~]# pwd
/root
[root@localhost ~]#
Instance 2: View the specified folder using the pwd command
Command:
pwd
Output:
[root@localhost ~]# cd /opt/soft/
[root@localhost soft] # pwd
/opt/soft
[root@localhost soft]#
Example 3: When the directory is linked, pwd -P shows the actual path instead of Link path; pwd shows the connection path
Command:
pwd -P
Output:
[root@localhost soft]# Cd /etc/init.d
[root@localhost init.d]# pwd
/etc/init.d
[root@localhost init.d]# Pwd -P
/etc/rc.d/init.d
[root@localhost init.d]#
Example 4: /bin/pwd
Command:
/bin/pwd [options]
Options:
-L When the directory is linked, the output Connection Path
-P Output Physical Path
Output:
[root@localhost init.d]# /bin/pwd
/etc/rc .d/init.d
[root@localhost init.d]# /bin/pwd --help
[root@localhost init.d]# /bin/pwd -P< Br>
/etc/rc.d/init.d
[root@localhost init.d]# /bin/pwd -L
/etc/init.d
[root@localhost init.d]#
Instance 5: The current directory is deleted, and the pwd command still displays that directory
Output:
[ Root@localhost init.d]# cd /opt/soft
[root@localhost soft]# mkdir removed
[root@localhost soft]# cd removed/
[root@localhost removed]# pwd
/opt/soft/removed
[root@localhost removed]# rm . . /removed -rf
[root@localhost removed]# pwd
/opt/soft/removed
[root@localhost removed]# /bin/pwd
/bin/pwd: couldn‘t find directory entry in “. . <quo; with matching i-node
[root@localhost removed]# cd
[root@localhost ~]# pwd
/root
[ Root@localhost ~]#
The above is the usage of the Linux pwd command. When you are not sure about the exact location of the current directory, you can use the pwd command to view the path. Try it out.
In the Linux system operation certificate, Vim is a text editor. When using Vim, it actually display
in Linux jira is a project and transaction tracking tool, which can be used for task tracking, cust
Some users have set up a VPN in their Linux system, but they cant connect to the VPN, and the system
Usually, Linux does not come with rz and sz commands, you need to manually install rz and sz package
How to create and use XFS system in Linux system
What should I do if Linux cannot be full screen under VMWare VM?
Ubuntu system uses Node.js to run Hello world method
How to configure LILO file for Red Flag Linux system
How to turn off recovery mode in Ubuntu 12.04 system
After the Linux boot, the terminal prompts -bash-2.05b$ What should I do?
Linux logical volume creation skills
Linux installation and configuration JDK and Eclipse steps
How does Ubuntu automatically switch between the mouse and the shared clipboard under VirtualBox?
Linux uses the source command method
Security tips teach you how to use SSL to give IIS a lock
Xp Tips to Repair Lost BOOT.ini File
Phone Insider online: Microsoft is preparing to provide previews for Win10 for Phones
The password security problem of the Linux operating system is detailed.
How to set disk quota for Win10 system
Official confirmation! Users of pirated Win7 and Win8.1 can also upgrade Win10
Office2007 serial number (absolutely available key serial number)