Get back to the root directory of a Windows drive (like c:\)

cd \
Useful to quickly get back to the Windows root directory of the current drive from a sub-directory within that drive. Works also without space between 'cd' and backslash: 'cd\' or 'cd \' have the same effect
Sample Output
C:\Users\...\ALongPath>cd \
C:\>

-34
By: VonC
2009-02-14 21:53:51
cd

These Might Interest You

  • In the Windows cmd.exe window, you can change the directory using cd, but if you need to go to a directory on another drive, you need to type in the drive letter and colon first (e.g. d:). With the /d on cd, you don't need this intermediate step. cd /? Tested on Windows XP Show Sample Output


    -2
    cd /d d:\Windows
    piyo · 2009-02-13 16:06:48 2
  • This will compress the root directory to an external hard drive and split it to parts once it reaches the 4 Gigs file system limit. You can simply restore it with: restore ivf /media/My\ Passport/Fedora10bckup/root_dump_fedora


    2
    dump -0 -M -B 4000000 -f /media/My\ Passport/Fedora10bckup/root_dump_fedora -z2 /
    luqmanux · 2009-07-02 20:25:22 0
  • Overwrites the boot sector. Since this doesn't overwrite any data, you can usually recover by re-creating the partition table exactly the same as before you zeroed it. This can also help sometimes if you install a new drive in a Windows machine which can't read it.


    2
    dd if=/dev/zero of=/dev/fd0 bs=512 count=1
    andrew112358 · 2009-09-09 23:43:22 0
  • wmr - | pv -s $SIZEOFMEM | ssh -p 40004 -c arcfour,blowfish-cbc -C root@savelocation.com "cat - > /forensics/T430-8gb-RAM1.dd" Run above command from Windows Cygwin: On Windows: Install Cygwin, and copy WMR (windows memory reader 1.0) memory diagnostic into cygwin\bin folder, also install cygwins netcat and ssh (openssh). I recommend installing apt-cyg and running " On Linux: Have an SSH Server SIMPLEST FORM: WINDOWS: # wmr - | ssh root@savelocation.com "cat - > /tmp/FileToSave.dd" For more details on how to extract information from memory dump: apt-get install foremost foremost -t all -T -i /forensics/T430-8gb-RAM1.dd For more information: http://www.kossboss.com/memdump-foremost Show Sample Output


    0
    wmr - | pv -s $SIZEOFMEM | ssh -p 40004 -c arcfour,blowfish-cbc -C root@savelocation.com "cat - > /forensics/T430-8gb-RAM1.dd"
    bhbmaster · 2013-05-31 00:04:19 0

What Others Think

LOLWUT?
PyCoder · 483 weeks and 5 days ago
joke? :-)
rizwan · 483 weeks and 5 days ago
it's "cd \" that gets you back to the root directory
nutkin · 483 weeks and 4 days ago
This command is: * correct * helpful, because it's *Windows,* where a lot of us Linux folks actually have a lot to learn. Maybe the $ prompt throws it off a bit though?
thesethings · 483 weeks and 4 days ago
@thesethings thank you for your comment. I do not think I have a choice in '$' prompt. It always is displayed in front of the command you enter. May be the intended platform should be much more apparent for each command .
VonC · 483 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: