• Home
  • Store
  • Blog
  • Contact
  • Home
  • Store
  • Blog
  • Contact
  • #linux
  • |
  • #commandline
  • |
  • #softwareengineering
  • |
  • #embeddedsystems
  • |
  • #compilers
  • ...
  • View All >>

Intro To 'cd' Command In Linux

2023-04-25 - By Robert Elder

     I use the 'cd' command to change the current working directory. Whenever I use the 'cd' command, the output from running the 'pwd' command changes:

pwd

     Outputs:

/home/robert/important
cd my-favourite-directory
pwd

     Now outputs:

/home/robert/important/my-favourite-directory

     I can also see that the value of the shell variable 'PWD' changes as well:

echo $PWD

     Outputs:

/home/robert/important/my-favourite-directory

     I can provide an absolute path to the 'cd' command like this:

cd /home/robert/important/my-other-directory
pwd

     Outputs:

/home/robert/important/my-other-directory

     I can also provide a path that's relative to my current working directory. This command will move up one directory:

cd ..
pwd

     Outputs:

/home/robert/important

     And this command will move up two directories:

cd ../..
pwd

     Outputs:

/home

     And that's why the 'cd' command is my favorite Linux command.

A Surprisingly Common Mistake Involving Wildcards & The Find Command
Published 2020-01-21
$1.00 CAD
Terminal Block Mining Simulation Game
A Guide to Recording 660FPS Video On A $6 Raspberry Pi Camera
Published 2019-08-01
The Most Confusing Grep Mistakes I've Ever Made
Published 2020-11-02
Use The 'tail' Command To Monitor Everything
Published 2021-04-08
An Overview of How to Do Everything with Raspberry Pi Cameras
Published 2019-05-28
An Introduction To Data Science On The Linux Command Line
Published 2019-10-16
Using A Piece Of Paper As A Display Terminal - ed Vs. vim
Published 2020-10-05
Join My Mailing List

Privacy Policy
Why Bother Subscribing?
  • Free Software/Engineering Content. I publish all of my educational content publicly for free so everybody can make use of it.  Why bother signing up for a paid 'course', when you can just sign up for this email list?
  • Read about cool new products that I'm building. How do I make money? Glad you asked!  You'll get some emails with examples of things that I sell.  You might even get some business ideas of your own :)
  • People actually like this email list. I know that sounds crazy, because who actually subscribes to email lists these days, right?  Well, some do, and if you end up not liking it, I give you permission to unsubscribe and mark it as spam.
© 2025 Robert Elder Software Inc.
Privacy Policy      Store Policies      Terms of Use