• Home
  • Ubuntu
  • Debian
  • Linux
  • Commands
No Result
View All Result
TECH DHEE
  • Home
  • Ubuntu
  • Debian
  • Linux
  • Commands
No Result
View All Result
TECH DHEE
No Result
View All Result
Home Commands

PWD Command in Linux (Current Working Directory)

techdhee by techdhee
February 16, 2023
0 0
0

In this article, we will learn about how to determine your current working directory using the  pwd command. How to use pwd command in Linux.

Contents hide
1 What is the Current Working Directory
2 pwd Command
3 How to Find your Current Working Directory
4 Conclusion

What is the Current Working Directory

The current working directory is where the user currently working that directory is currently working directory. Each time you open the terminal, you are working within a directory.

By default, when you log into your Linux system, your current working directory is set to your home directory. If you want to change the working directory use the  cd command.

For example, to change the current working directory to  /dev  directory you would run the following command in the terminal:

$ cd /dev

PWD Command in Linux

If you have a customized  bash  or  zsh  prompt, the path to the current working directory may be shown in the shell prompt.

pwd Command

The pwdcommand stands for print working directory. It is one of the most basic and frequently used commands in Linux. When we use this command, it prints the complete path of the current working directory.

How to Find your Current Working Directory

To find out what directory you are currently in, type pwd command in your terminal:

$ pwd

PWD Command in Linux

The pwd command can accept four arguments:

  • -L (–logical) – Do not resolve symlinks.
  • -P (–physical) – Avoid all symlinks.
  • –help – Display this help and exit.
  • –version – Output version information and exit.

By default, pwd behaves as if the -L option is specified.

By default, id no option is used, pwd behaves as if the -L option is specified.

How the -P option works, we have to create a directory and symlink pointing to the directory:

$ mkdir /tmp/test$ ln -s /tmp/test /tmp/symlink

PWD Command in Linux

Now if we use the pwd command in the terminal to navigate /tmp/symlink directory

$ pwd

The output will show that your current working directory is /tmp/symlink:

PWD Command in Linux

If you run the same command using the -P option:

$ pwd -P

PWD Command in Linux

Conclusion

The current working directory is the directory where you run the commands in your terminal.

The pwd command is used to display the current working directory.

If you have any questions, feel free to leave a comment.

Related Posts:

  • How to Create a File in Linux
  • Su Command in Linux
  • Nala – An Alternative To APT Package Manager
  • Install Nano Text Editor in Linux
  • Linux File Hierarchy Structure
  • Whoami command in Linux
ShareTweetSendShareSend
Previous Post

Nala – An Alternative To APT Package Manager

Next Post

How to Install GIMP on Ubuntu 22.04 LTS

techdhee

techdhee

Related Posts

How to Install Arch Linux
Linux

How to Install Arch Linux [Step by Step Guide]

August 6, 2023
Terminal Emulators for Linux
Linux

Top 6 Terminal Emulators for Linux

August 5, 2023
add user to sudoers in Debian
Commands

How to Add User to Sudoers in Debian 11

February 27, 2023
Install Nano Text Editor in Linux
Commands

How to Install Nano Text Editor in Linux

February 24, 2023
Commands

Whoami command in Linux

February 23, 2023
Install ZSH on Ubuntu 22.04
Commands

How to Install ZSH on Ubuntu 22.04 LTS

February 22, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You might also like

How-to-Check-Windows-10-is-Genuine-or-Not-Genuine

How to Check Windows 10 is Genuine or Not Genuine

August 6, 2023
How to Install Arch Linux

How to Install Arch Linux [Step by Step Guide]

August 6, 2023
Terminal Emulators for Linux

Top 6 Terminal Emulators for Linux

August 5, 2023
How to Install Tor Browser in Kali Linux 2023.1

How to Install Tor Browser in Kali Linux 2023.1

April 2, 2023

How to install Tweak Tool on Ubuntu 22.04 LTS

March 3, 2023
Install Ngrok on Ubuntu 22.04 LTS

How to Install Ngrok on Ubuntu 22.04 LTS

March 2, 2023

© 2024 tecdhee.com - Tech Tips, Tricks and Tutorials.

  • Home
  • About Us
  • Contact
  • Disclaimer
  • Privacy Policy
No Result
View All Result
  • About Us
  • Contact
  • Disclaimer
  • Home
  • Privacy Policy

© 2024 tecdhee.com - Linux Tips, Tricks and Tutorials.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In