Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the command for linux to display the current path

Shulou Source: shulou.com Published: 2022-06-02 00:36:18 11月17日 Update

Editor to share with you what the linux shows the current path of the command is, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

View current path command: pwd

The pwd command displays the current path.

This command is relatively simple. If you sometimes forget the current path during the operation, you can use this command to view the path, which is executed as follows:

# pwd / home/samlee

The first behavior runs the command, and the second line contains the information displayed after running the pwd command, that is, the path to the working directory where the user is currently located is / home/samlee.

Tip:

The pwd command should be used frequently. Linux's directory structure is very complex, a small branch may have more than a dozen layers of directories, like a forest, so Linux will not write the full path in the prompt like Windows, that is too long.

Using cd to drill around in the directory, it's easy to forget where you are, but it's a bit dangerous to execute orders at this time. For example, if you want to delete a file and don't know the current directory, you may mistakenly delete useful files with the same name, and it's not so easy to recover.

There are many other situations that require the use of pwd, especially when performing a "rm-rf" operation that directly deletes a directory, which needs to be determined by pwd, which may be entered for every dozen commands executed.

The above is all the contents of linux's command to show what the current path is. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Commands paths directories contents files articles prompts runs complexity danger one line not much information branches can be passed most case location prompt way Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi OPPO Reno Shulou Tech Info Redmi