linux displays current path

Release: 2019-10-23 17:51:50
Original
6917 people have browsed it

linux displays current path

View the current path command: pwd

The pwd command can display 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. The execution method is:

# pwd 
/home/samlee
Copy after login

The first line is the command to run. , the content of the second line is the information displayed after running the pwd command, that is, the path of the current working directory of the user is displayed as /home/samlee.

Tip:

You should always use the pwd command. The directory structure of Linux is very complex. A small branch may have more than a dozen levels of directories, just like a forest. Therefore, Linux does not write the full path in the prompt like Windows does, which is too long.

Using cd to drill around in the directory, it is easy to lose track of where you are. It is a bit dangerous to execute commands at this time. For example, if you want to delete a file, you may not know the current directory. Useful files with the same name will be deleted by mistake and are not so easy to recover.

There are many other situations where you need to use pwd, especially when performing an operation such as "rm -rf" to directly delete a directory. You need to use pwd to confirm. Maybe every dozen commands are executed. Will enter once.

The above is the detailed content of linux displays current path. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template