Is there a difference between pwd and cd?
Clash Royale CLAN TAG#URR8PPP
Is there a difference between pwd
and cd
(no arguments)? They both print the current directory's path but is there a subtle difference that I'm missing, and if so, when should I use which?
cd-command pwd
add a comment |
Is there a difference between pwd
and cd
(no arguments)? They both print the current directory's path but is there a subtle difference that I'm missing, and if so, when should I use which?
cd-command pwd
add a comment |
Is there a difference between pwd
and cd
(no arguments)? They both print the current directory's path but is there a subtle difference that I'm missing, and if so, when should I use which?
cd-command pwd
Is there a difference between pwd
and cd
(no arguments)? They both print the current directory's path but is there a subtle difference that I'm missing, and if so, when should I use which?
cd-command pwd
cd-command pwd
edited Feb 13 at 11:14
iBug
956928
956928
asked Apr 9 '17 at 5:29
retniktretnikt
114
114
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Yes, they are completely different commands that do different things.
pwd
prints the directory you are currently in. It does nothing else.pwd
does not take any arguments.
cd
without arguments changes your working directory to your home directory. It does not print anything by default.
cd
with an argument will change your working directory to whatever directory you supplied as an argument.
Thanks. I must have misremembered aboutcd
with no arguments. Sorry.
– retnikt
Apr 9 '17 at 6:40
2
pwd
does take a couple of arguments, the options-L
and-P
(for "logical" and "physical"). These flags happen to be supported (with the same meanings) by thecd
command too.
– Kusalananda
Apr 9 '17 at 7:12
add a comment |
cd
changes to your home directory, I think this is a more than subtle difference.
I suggest reading the man
page before asking in a forum.
add a comment |
The command
pwd
shows the current directory, while the command
cd
will change directory to your home directory.
add a comment |
You can also use the below command to find out where the previous command was executed and get on the folder.
cd -
In contrast, pwd only gives you the path of the current working directory.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f357893%2fis-there-a-difference-between-pwd-and-cd%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Yes, they are completely different commands that do different things.
pwd
prints the directory you are currently in. It does nothing else.pwd
does not take any arguments.
cd
without arguments changes your working directory to your home directory. It does not print anything by default.
cd
with an argument will change your working directory to whatever directory you supplied as an argument.
Thanks. I must have misremembered aboutcd
with no arguments. Sorry.
– retnikt
Apr 9 '17 at 6:40
2
pwd
does take a couple of arguments, the options-L
and-P
(for "logical" and "physical"). These flags happen to be supported (with the same meanings) by thecd
command too.
– Kusalananda
Apr 9 '17 at 7:12
add a comment |
Yes, they are completely different commands that do different things.
pwd
prints the directory you are currently in. It does nothing else.pwd
does not take any arguments.
cd
without arguments changes your working directory to your home directory. It does not print anything by default.
cd
with an argument will change your working directory to whatever directory you supplied as an argument.
Thanks. I must have misremembered aboutcd
with no arguments. Sorry.
– retnikt
Apr 9 '17 at 6:40
2
pwd
does take a couple of arguments, the options-L
and-P
(for "logical" and "physical"). These flags happen to be supported (with the same meanings) by thecd
command too.
– Kusalananda
Apr 9 '17 at 7:12
add a comment |
Yes, they are completely different commands that do different things.
pwd
prints the directory you are currently in. It does nothing else.pwd
does not take any arguments.
cd
without arguments changes your working directory to your home directory. It does not print anything by default.
cd
with an argument will change your working directory to whatever directory you supplied as an argument.
Yes, they are completely different commands that do different things.
pwd
prints the directory you are currently in. It does nothing else.pwd
does not take any arguments.
cd
without arguments changes your working directory to your home directory. It does not print anything by default.
cd
with an argument will change your working directory to whatever directory you supplied as an argument.
answered Apr 9 '17 at 5:50
user91656user91656
741
741
Thanks. I must have misremembered aboutcd
with no arguments. Sorry.
– retnikt
Apr 9 '17 at 6:40
2
pwd
does take a couple of arguments, the options-L
and-P
(for "logical" and "physical"). These flags happen to be supported (with the same meanings) by thecd
command too.
– Kusalananda
Apr 9 '17 at 7:12
add a comment |
Thanks. I must have misremembered aboutcd
with no arguments. Sorry.
– retnikt
Apr 9 '17 at 6:40
2
pwd
does take a couple of arguments, the options-L
and-P
(for "logical" and "physical"). These flags happen to be supported (with the same meanings) by thecd
command too.
– Kusalananda
Apr 9 '17 at 7:12
Thanks. I must have misremembered about
cd
with no arguments. Sorry.– retnikt
Apr 9 '17 at 6:40
Thanks. I must have misremembered about
cd
with no arguments. Sorry.– retnikt
Apr 9 '17 at 6:40
2
2
pwd
does take a couple of arguments, the options -L
and -P
(for "logical" and "physical"). These flags happen to be supported (with the same meanings) by the cd
command too.– Kusalananda
Apr 9 '17 at 7:12
pwd
does take a couple of arguments, the options -L
and -P
(for "logical" and "physical"). These flags happen to be supported (with the same meanings) by the cd
command too.– Kusalananda
Apr 9 '17 at 7:12
add a comment |
cd
changes to your home directory, I think this is a more than subtle difference.
I suggest reading the man
page before asking in a forum.
add a comment |
cd
changes to your home directory, I think this is a more than subtle difference.
I suggest reading the man
page before asking in a forum.
add a comment |
cd
changes to your home directory, I think this is a more than subtle difference.
I suggest reading the man
page before asking in a forum.
cd
changes to your home directory, I think this is a more than subtle difference.
I suggest reading the man
page before asking in a forum.
answered Apr 9 '17 at 5:46
PhilipposPhilippos
6,06711647
6,06711647
add a comment |
add a comment |
The command
pwd
shows the current directory, while the command
cd
will change directory to your home directory.
add a comment |
The command
pwd
shows the current directory, while the command
cd
will change directory to your home directory.
add a comment |
The command
pwd
shows the current directory, while the command
cd
will change directory to your home directory.
The command
pwd
shows the current directory, while the command
cd
will change directory to your home directory.
answered Apr 9 '17 at 5:45
Stephen RauchStephen Rauch
3,344101428
3,344101428
add a comment |
add a comment |
You can also use the below command to find out where the previous command was executed and get on the folder.
cd -
In contrast, pwd only gives you the path of the current working directory.
add a comment |
You can also use the below command to find out where the previous command was executed and get on the folder.
cd -
In contrast, pwd only gives you the path of the current working directory.
add a comment |
You can also use the below command to find out where the previous command was executed and get on the folder.
cd -
In contrast, pwd only gives you the path of the current working directory.
You can also use the below command to find out where the previous command was executed and get on the folder.
cd -
In contrast, pwd only gives you the path of the current working directory.
answered Jul 31 '18 at 5:25
Kartik ChopraKartik Chopra
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f357893%2fis-there-a-difference-between-pwd-and-cd%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown