Using pwd command to print current working directory on Linux shell - Basic Linux Command.

 

Step by step using Linux pwd command to print current working directory on you Linux shell.

 

Pwd is the basic command that can be useful to find out where you are in the linux system ( your current directory path), this simple example the step to use Linux pwd command on the bash shell command prompt to print current working directory on Linux fedora core system.

 

Linux command name: pwd

 

Command Description:

The Linux 'pwd' (Print the current working directory) command is used to display the directory that you are currently in or your working directory.

Command type:

Bourne Shell Builtins command.

 

[root@linux fedora]# type pwd

pwd is a shell builtin

 

How to know where I’m now on the system?

 

To find out where are you (current directory path) on your shell command key in the 'pwd' command on your shell prompt as an example below:

 

[root@linux fedora]# pwd

/root/hack/fedora

 

The pwd command above display that the user is currently in the /root/hack/fedora/ directory.

 

[root@linux fedora]# /bin/pwd --version

pwd (GNU coreutils) 5.2.1

Written by Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

The ‘/bin/pwd –version’ command above display the version of pwd command.

 

The following are some of the flags and arguments that can be used for the pwd bash buitlin command:

-P pwd prints the physical directory, without any symbolic links.

-L pwd follow symbolic links.

 

The following are some of the flags and arguments that can be used for the pwd command:

--help display help and exit

--version output version information and exit

 

Get help on Bash builtin pwd command.

 

[root@linux fedora]# help -s pwd

pwd: pwd [-PL]

[root@linux fedora]# help pwd

pwd: pwd [-PL]

Print the current working directory. With the -P option, pwd prints

the physical directory, without any symbolic links; the -L option

makes pwd follow symbolic links.

[root@linux fedora]# info bash

`pwd'

pwd [-LP]

Print the absolute pathname of the current working directory. If

the `-P' option is supplied, the pathname printed will not contain

symbolic links. If the `-L' option is supplied, the pathname

printed may contain symbolic links. The return status is zero

unless an error is encountered while determining the name of the

current directory or an invalid option is supplied.

 

NOTE : open the on-line manuals in the "Info format" by execute ‘info bash’ command then scroll down to the “* Builtin Index:: Index of Bash builtin commands.” Hit Enter key, then look for “* pwd: (Bourne Shell Builtins.) on (line 163) “ hit Enter key again.

 

Getting help on External pwd command.

 

[root@linux fedora]# whereis pwd

pwd: /bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.gz /usr/share/man/mann/pwd.n.gz /usr/share/man/man1p/pwd.1p.gz

 

The ‘whereis’ command above is used to locate the binary, source, and manual page files for a pwd command

 

[root@linux fedora]# man pwd

 

NAME

pwd - print name of current/working directory

SYNOPSIS

pwd [OPTION]

DESCRIPTION

NOTE: your shell may have its own version of pwd which will supercede

the version described here. Please refer to your shellâs documentation

for details about the options it supports.

Print the full filename of the current working directory.

--help display this help and exit

--version

output version information and exit

AUTHOR

Written by Jim Meyering.

REPORTING BUGS

Report bugs to <bug-coreutils@gnu.org>.

COPYRIGHT

Copyright © 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is

NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR

PURPOSE.

SEE ALSO

The full documentation for pwd is maintained as a Texinfo manual. If

the info and pwd programs are properly installed at your site, the com-

mand

info coreutils pwd

should give you access to the complete manual.

[root@linux fedora]# info pwd

[root@linux fedora]# info coreutils pwd

19.1 `pwd': Print working directory

`pwd' prints the fully resolved name of the current directory. That

is, all components of the printed name will be actual directory

names--none will be symbolic links.

Because most shells have a built-in command by the same name, using

the unadorned command name in a script or interactively may get you

different functionality than that described here.

The only options are a lone `--help' or `--version'. *Note Common

options::.

An exit status of zero indicates success, and a nonzero value

indicates failure.

 

The ‘info pwd’ and ‘info coreutils pwd’ command above, display the same help output for 'pwd' command.

 

Need help or need more information use:

# info pwd

# info coreutils pwd

# man pwd

# help pwd

 

Keywords: pwd, pwd command, using pwd command, linux pwd command, print current working directory, current working directory, working directory, use pwd, working directory.

 

aaaaaaaaaaa