https://andrewbaker.ninja/wp-content/themes/twentysixteen/fonts/merriweather-plus-montserrat-plus-inconsolata.css

👁0views
Linux: Quick guide to the CD command – for windows dudes :)

CloudScale SEO — AI Article Summary
What it isThis article explains essential Linux CD (change directory) command shortcuts and navigation techniques, specifically written for Windows users transitioning to Linux through tools like WSL2 and Docker.
Why it mattersThese shortcuts save significant time when navigating Linux file systems, especially for Windows developers who need to efficiently move between directories and exchange files between Windows and Linux environments.
Key takeawayMaster pushd/popd commands and symbolic links to dramatically speed up directory navigation and file transfers between Windows and Linux.

Ok, so I am a windows dude and only after docker and K8 came along did I start to get all they hype around Linux. To be fair, Linux is special and I have been blown away with the engineering effort behind this OS (and also glad to leave my book of Daniel Appleman win32 api on the shelf for a few years!).

What surprises me with Linux is the number of shortcuts and so before I forget them I am going to document a few of my favorites (the context here is that I use WSL2 a lot and these are my favorite navigation commands).

Exchanging files between Linux and Windows:

This is a bit of a pain, so I just create a symbolic link to a windows root directory in my linux home directory so that I can easily copy files back an forth.

cd ~
ln -s /mnt/c/ mywindowsroot
cd mywindowsroot
ls
# copy everything from my windows root folder into my wsl linux directory
cp mywindowsroot/<em>.</em> .

Show Previous Directory

<code>cd --</code>

Switch back to your previous directory

Move to Home Directory

cd ~
or just use
cd

Pushing and Popping Directories

Pushd and popd are Linux commands in bash and certain other shell which saves current working directory location to memory or brings to the directory from memory and changes to this directory, respectively. This is very handy when your jumping around but don’t want to create symbolic links.

# Push the current directory onto the stack (you can also enter an absolute directory here, like pushd /var/www)
pushd .
# Go to the home dir
cd
ls
# Now move back to this directory
popd
ls

Leave a Reply

Your email address will not be published. Required fields are marked *