{"id":10030,"date":"2021-09-20T13:06:14","date_gmt":"2021-09-20T13:06:14","guid":{"rendered":"https:\/\/linuxways.net\/?p=10030"},"modified":"2021-09-20T13:06:14","modified_gmt":"2021-09-20T13:06:14","slug":"pwd-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/pwd-command-in-linux\/","title":{"rendered":"pwd Command in Linux"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>pwd stands for print working directory. This command is very useful and is commonly used in Linux. When used the command will print the full path of the root directory to the current directory.<\/p>\n<p>pwd is the command built into the shell or \/bin\/pwd. You can run the type command to see where pwd is contained:<\/p>\n<pre>$ type -a pwd<\/pre>\n<p>Output: <img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"107\" class=\"wp-image-10031\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-227.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-227.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-227-300x30.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-227-1024x104.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-227-768x78.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<p>Below is the guide on how to use the pwd command in Linux as we go through below.<\/p>\n<h2>The syntax of pwd command<\/h2>\n<p>To find the current directory, run:<\/p>\n<pre>$ pwd<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1056\" height=\"69\" class=\"wp-image-10032\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-228.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-228.png 1056w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-228-300x20.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-228-1024x67.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-228-768x50.png 768w\" sizes=\"auto, (max-width: 1056px) 100vw, 1056px\" \/><\/p>\n<p>You can use another way with PWD environment variable:<\/p>\n<pre>$ echo $PWD<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"73\" class=\"wp-image-10033\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-229.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-229.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-229-300x21.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-229-1024x71.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-229-768x53.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<h2>Options:<\/h2>\n<p><strong>pwd -L<\/strong>: Prints the symlink.<\/p>\n<p><strong>pwd -P<\/strong>: Prints the real path.<\/p>\n<p>By default, if you use the command without option, it will specify <strong>-L<\/strong> option.<\/p>\n<p>To understand more clearly, we will create a directory and symlink to the directory:<\/p>\n<pre>$ sudo mkdir \/usr\/directory<\/pre>\n<pre>$ sudo ln -s \/usr\/directory \/usr\/symlink<\/pre>\n<p>Next, we will navigate to \/usr\/symlink:<\/p>\n<pre>$ cd \/usr\/symlink<\/pre>\n<p>And now, we will try to use pwd command with <strong>-L <\/strong>option:<\/p>\n<pre>$ pwd -L<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1058\" height=\"66\" class=\"wp-image-10034\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-230.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-230.png 1058w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-230-300x19.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-230-1024x64.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-230-768x48.png 768w\" sizes=\"auto, (max-width: 1058px) 100vw, 1058px\" \/><\/p>\n<p>If you use pwd command with <strong>-P <\/strong>option:<\/p>\n<pre>$ pwd -P<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1059\" height=\"63\" class=\"wp-image-10035\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-231.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-231.png 1059w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-231-300x18.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-231-1024x61.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-231-768x46.png 768w\" sizes=\"auto, (max-width: 1059px) 100vw, 1059px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>You\u2019ve already gone through the details of how to use the pwd command in Linux.<\/p>\n<p>Thanks for reading.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction pwd stands for print working directory. This command is very useful and is commonly used in Linux. When used the command will print the full path of&hellip;<\/p>","protected":false},"author":1,"featured_media":10298,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[534],"class_list":["post-10030","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-pwd-command"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10030"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10030\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10298"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}