Linuxips
  • Home
  • Linux
  • Debian
  • Ubuntu
  • Fedora
  • Arch Linux
No Result
View All Result
Linuxips
  • Home
  • Linux
  • Debian
  • Ubuntu
  • Fedora
  • Arch Linux
No Result
View All Result
Linuxips
No Result
View All Result
Home Commands

pwd command in Linux

admin by admin
November 6, 2022
Reading Time: 3 mins read
0
pwd Command in Linux

In this article, we will show you about pwd command in Linux. How to find out your current working directory using the pwd command. The pwd command is also known as the print working directory. This command shows the current working directory where you are in. This command shows you the full path of your current directory. The syntax for pwd command:

Contents hide
1 What is the Current Working Directory
2 Syntax
2.1 Flags
3 How to Find your Current Working Directory
4 The pwd command can accept only two arguments:
5 Conclusion

What is the Current Working Directory

The current working directory is the directory where the user is currently working in. Each time you interact with your command prompt, you are working within a directory.

Syntax

  • pwd -L: Prints the symbolic path.
  • pwd -P: Prints the actual path.

The pwd command writes to standard output the full path name of your current directory (from the root directory). All directories are separated by a / (slash). The root directory is represented by the first /, and the last directory name is your current directory.

Flags

-L
Displays the value of the PWD environment variable if the PWD environment variable contains an absolute path name of the current directory that does not contain the file names. (dot) or .. (dot-dot). Otherwise, the -L flag behaves the same as the -P flag.
-P
Displays the absolute path name of the current directory. The absolute path name displayed with the -P flag does not contain file names that, in the context of the path name, refer to files of type symbolic link.

The pwd command stands for print working directory. It is one of the most basic and frequently used commands in Linux. When invoked the command 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 in your terminal:

$ pwd

The output will look something like this:

/home/linuxips

What the pwd does is print the PWD environment variable.

You will get the same output if you type:

$ echo $PWD
/home/linuxips

The pwd command can accept only two arguments:

  1. -L (–logical) – Do not resolve symlinks.
  2. -P (–physical) – Display the physical directory, without any symbolic links.

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

To better illustrate how the -P option works, let’s create a directory and symlink pointing to the directory:

mkdir /tmp/directory
ln -s /tmp/directory /tmp/symlink

Now if you navigate to the /tmp/symlink directory and you type pwd in your terminal.

Conclusion

So this is the pwd Command in Linux. The current working directory is the directory from which you invoke commands in your terminal.

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

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

Related Linux Tutorials:

  • How to Install Cisco Packet Tracer on Ubuntu.
  • How to install Tweak Tool on Ubuntu 21.04.
  • ZSH to BASH | How to Install ZSH on Ubuntu.
  • How to Install Ubuntu.
  • mkdir Command in Linux
  • ls Command in Linux
  • Whoami Command in Linux
ShareTweetSendShareShare
Previous Post

How to Install Gnome Tweak Tool on Arch Linux

Next Post

How to Install ZSH on Ubuntu 22.04 LTS | Bash to ZSH

admin

admin

Linuxips is a Linux blog that publishes articles and tutorials about server operations, installations, new techniques and Linux security.

Related Posts

Install ZSH on Arch Linux
Arch Linux

How to Install ZSH on Arch Linux

January 6, 2024
How To Use AppImage in Linux
Linux

How To Use AppImage in Linux [Complete Guide]

April 2, 2023
How To Install uGet Download Manager On Ubuntu
Linux

How To Install uGet Download Manager On Ubuntu

March 8, 2023
Linux Files and Directories
Linux

Linux Files and Directories

March 3, 2023
How to Create Files With Passwords in Linux
Linux

How to Create Files With Passwords in Linux

February 27, 2023
Whoami Command in Linux
Commands

Whoami Command in Linux

September 1, 2022

Leave a Reply Cancel reply

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

No Result
View All Result

You might also like

Install ZSH on Arch Linux

How to Install ZSH on Arch Linux

January 6, 2024
How to Install ZSH on Kali Linux 2024.1

How to Install ZSH on Kali Linux

January 5, 2024
How To Use AppImage in Linux

How To Use AppImage in Linux [Complete Guide]

April 2, 2023
How To Install uGet Download Manager On Ubuntu

How To Install uGet Download Manager On Ubuntu

March 8, 2023
How to Install ZSH on Ubuntu 22.10

How to Install ZSH on Ubuntu 22.10

March 7, 2023
Linux Files and Directories

Linux Files and Directories

March 3, 2023

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

  • Home
  • Web Stories
  • Privacy Policy
  • Contact Us
  • Disclaimer
No Result
View All Result
  • Home
  • Linux
  • Debian
  • Ubuntu
  • Fedora
  • Arch Linux

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