Polecenia Linuksa

Linux pwd Command

Linux pwd Command

The pwd is a helpful command for Linux users who are inexperienced and might get lost in the middle of directories.

The pwd is an abbreviated form of “Print Working Directory,” or we can call the Current Work Directory. It displays the name of the current directory with the root path.

It is the most frequently used built-in shell command by Linux system administrators.

PWD Syntax

The Syntax of pwd Command is:

$ pwd [options]

PWD Commands

Here are a few most commonly used commands of pwd. Let's check how they work in Linux System:

Display Current Directory

As my current working directory is the home directory, so it will print the home directory in the terminal.

To display the current working directory in Linux, use the command:

$ pwd

PWD Flags

The pwd command accepts two flags:

1. pwd -L
The -L flag is used to print symbolic links; in other words, in Linux, it points towards the file or folder where you are currently working in.

Let's check its functionality:

Create a symbolic link in a home directory named Linuxhint and move the present directory to the newly created one.

Now, use the given command to check if it's working:

$ pwd -L

2. pwd -P:
The -P command is used to print the actual path without any symbolic link.

$ pwd -P

pwd Version

The pwd command comes pre-installed. You can check the pwd version through the command-line by given command:

$ /bin/pwd --version

pwd -a

The following command will help you to display the list of all locations having executable name pwd:

$ type -a pwd

pwd Help

When you use the help command, it will show you pwd command options.

To get it, use mentioned command in the terminal:

$ pwd --help

Echo $PWD

To store the path of the current directory, the echo $PWD command is used. It functions the same as the pwd -L command:

$ echo $PWD

PWD and OLDPWD command

To get current and previous directory using one command, type:

$ echo $PWD $OLDPWD

Conclusion

We have seen a brief explanation of the pwd command and its examples. The pwd command is a widely used shell built-in command in Linux systems. It displays the current working directory on which the user is working.

Gry Najlepsze aplikacje do mapowania gamepada dla systemu Linux
Najlepsze aplikacje do mapowania gamepada dla systemu Linux
Jeśli lubisz grać w gry na Linuksie za pomocą gamepada zamiast typowego systemu wprowadzania klawiatury i myszy, jest kilka przydatnych aplikacji dla ...
Gry Przydatne narzędzia dla graczy Linuksa
Przydatne narzędzia dla graczy Linuksa
Jeśli lubisz grać w gry w systemie Linux, prawdopodobnie używałeś aplikacji i narzędzi, takich jak Wine, Lutris i OBS Studio, aby poprawić wrażenia z ...
Gry Zremasterowane gry HD dla Linuksa, które nigdy wcześniej nie zostały wydane na Linuksa
Zremasterowane gry HD dla Linuksa, które nigdy wcześniej nie zostały wydane na Linuksa
Wielu twórców gier i wydawców wymyśla remaster HD starych gier, aby przedłużyć żywotność serii, prosimy fanów o kompatybilność z nowoczesnym sprzętem ...