logo
  • Home
  • About
  • Training
  • Programming
  • CS
  • IT
  • IS
  • ECE
  • EEE
  • EE
  • Civil
  • Mechanical
  • Chemical
  • Metallurgy
  • Instrumentation
  • Aeronautical
  • Aerospace
  • Biotechnology
  • Agriculture
  • MCA
  • BCA
  • Internship
  • Contact

Questions & Answers

C Interview Questions
C++ Questions
Linux MCQs
C# Quiz
Java MCQs
JavaScript MCQs
SAN Questions
PHP Questions
Python Quiz

Computer Science Questions

Operating System Quiz
Computer Architecture MCQs
Software Architecture MCQs
Software Engineering MCQs
Artificial Intelligence MCQs
LISP Programming MCQs
Database Management MCQs
Computer Network MCQs
Microprocessor MCQs

C Programming Examples

Simple C Programs
C - Arrays
C - Matrix
C - Strings
C - Bitwise Operations
C - Linked Lists
C - Stacks & Queues
C - Searching & Sorting
C - Trees
C - Strings
C - File Handling
C - Mathematical Functions
C - Puzzles & Games
C Programs - Recursion
C Programs - No Recursion

Java Algorithms

Java - Numerical Problems
Java - Combinatorial Problems
Java - Graph Problems
Java - Hard Graph Problems
Java - Computation Geometry
Java - Sets & Strings
Java - Data-Structures
Java - Collection API Problems

C++ Algorithms

C++ - Numerical Problems
C++ - Combinatorial Problems
C++ - Graph Problems
C++ - Hard Graph Problems
C++ - Computation Geometry
C++ - Sets & Strings
C++ - Data-Structures
C++ - STL Library

C Algorithms

C - Numerical Problems
C - Combinatorial Problems
C - Graph Problems
C - Hard Graph Problems
C - Computation Geometry
C - Sets & Strings
C - Data-Structures

« Prev Page
Next Page »

“pwd” Command Usage Examples in Linux

Posted on January 31, 2014 by Manish

This tutorial explains Linux “pwd” command, options and its usage with examples.

pwd- print working directory.

DESCRIPTION

The pwd command is considered as one of the most frequently used commands on Linux, AIX, HP-UX, *BSD, and other UNIX like operating systems along with the ls, and cd commands. It can be used for the following purposes under Apple OS X or UNIX or Linux operating systems:

1. Find the full path to the current directory.
2. Store the full path to the current directory in the shell variable.
3. Verify the absolute path.
4. Verify the physical path i.e exclude symbolic links.

SYNOPSIS

pwd [OPTION]…

OPTIONS :

-L, –logical
use PWD from environment, even if it contains symlinks.
-P, –physical
avoid all symlinks.

EXAMPLES

1. Simple usage of pwd(self explanatory)

$ pwd
/usr/local/bin
$ cd ..
$ pwd
/usr/local

2. To display the logical current working directory, enter

$ pwd -L

The -L option cause pwd to use $PWD from environment, even if it contains symlinks. If the contents of the environment variable PWD provide an absolute name of the current directory with no . or .. components, but possibly with symbolic links, then output those contents.

3. Display the physical current working directory (all symbolic links resolved)

For example, ~/bin/ is symbolic link:

$ pwd
$ ls -l ~/bin/

Sample outputs:

lrwxrwxrwx 1 abc abc 35 May 13  2012 /home/abc/bin -> /home/abc/realdata/scripts/utils/

cd to ~/bin/ and verify the current working directory with pwd:

$ cd ~/bin/
$ pwd

Sample output:

/home/abc/bin

To see actual physical current working directory and avoid avoid all symlink called /home/abc/bin, enter:

$ pwd -P

Sample outputs:

/home/abc/realdata/scripts/utils

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.
« Prev Page - “env” Command Usage Examples in Linux
» Next Page - “basename” Command Usage Examples in Linux
« “env” Command Usage Examples in Linux
“traceroute” Command Usage Examples in Linux »

Deep Dive @ Sanfoundry:

  1. C# Programming Examples on LINQ
  2. C Programming Examples on Puzzles & Games
  3. C# Programming Examples
  4. C Programming Examples on Hard Graph Problems & Algorithms
  5. C# Programming Examples on Functions
  6. C# Programming Examples on Threads
  7. C# Programming Examples on Files
  8. C Programming Examples on File Handling
  9. Linux Questions and Answers
  10. Linux Command Tutorials with Examples and Explanations
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer and SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage & Cluster Administration, Advanced C Programming, SAN Storage Technologies, SCSI Internals and Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him below:
LinkedIn | Facebook | Twitter | Google+

Best Careers

Developer Tracks
SAN Developer
Linux Kernel Developer
Linux Driver Developer
Linux Network Developer

Live Training Photos
Mentoring
Software Productivity
GDB Assignment
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all Top Companies in India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree, Cognizant and Startups.

Best Trainings

SAN I - Technology
SAN II - Admin
Linux Fundamentals
Advanced C Training
Linux-C Debugging
System Programming
Network Programming
Linux Threads
Kernel Programming
Kernel Debugging
Linux Device Drivers

Best Reference Books

Computer Science Books
Algorithm & Programming Books
Electronics Engineering Books
Electrical Engineering Books
Chemical Engineering Books
Civil Engineering Books
Mechanical Engineering Books
Industrial Engineering Books
Instrumentation Engg Books
Metallurgical Engineering Books
All Stream Best Books

Questions and Answers

1000 C Questions & Answers
1000 C++ Questions & Answers
1000 C# Questions & Answers
1000 Java Questions & Answers
1000 Linux Questions & Answers
1000 Python Questions
1000 PHP Questions & Answers
1000 Hadoop Questions
Cloud Computing Questions
Computer Science Questions
All Stream Questions & Answers

India Internships

Computer Science Internships
Instrumentation Internships
Electronics Internships
Electrical Internships
Mechanical Internships
Industrial Internships
Systems Internships
Chemical Internships
Civil Internships
IT Internships
All Stream Internships

About Sanfoundry

About Us
Copyright
TOS & Privacy
Jobs
Bangalore Training
Online Training
SAN Training
Developers Track
Mentoring Sessions
Contact Us
Sitemap
© 2011 Sanfoundry