Get around with CD and DIR
Use these two commands to navigate DOS on the command line.
New users often ask, "I installed FreeDOS, but how do I use it?"
If you haven't used DOS before, the blinking C:\> DOS prompt can seem a little
unfriendly.
And maybe scary. This gentle introduction to FreeDOS should get you started and
how to get around and how to look at files.
The prompt
First, let's look at the empty prompt and what it means.
C:>
DOS is a disk operating system created when personal computers ran from floppy disks. Even when computers supported hard drives, it was common in the 1980s and 1990s to switch frequently between the different drives. For example, you might make a backup copy of your most important files to a floppy disk.
DOS referenced each drive by a letter.
Early PCs could have only two floppy drives, which were assigned as the
A: and B: drives.
The first partition on the first hard drive was the C: drive, and so on for
other drives.
The C: in the prompt means you are using the first partition on the first hard
drive.
Starting with PC-DOS 2.0 in 1983, DOS also supported directories and
subdirectories, much like the directories and subdirectories on Linux
filesystems.
But unlike Linux, DOS directory names are delimited by \ instead of /.
Putting that together with the drive letter, the C:\ in the prompt means
you are in the top, or root, directory of the C: drive.
The > is the literal prompt where you type your DOS commands, like the $ prompt
on many Linux shells.
The part before the > tells you the current working directory, and you type
commands at the > prompt.
Getting around
The basics of navigating through directories in DOS are just two commands:
CD and DIR.
DIR
When you want to see the contents of the current directory, use the DIR
command.
Since DOS commands are not case-sensitive, you could also type dir.
By default, DOS displays the details of every file and subdirectory, including
the name, extension, size, and last modified date and time.
C:\>dir
Volume in drive C is FREEDOS2024
Volume Serial Number is 0F5A-150D
Directory of C:\
APPS <DIR> 10-01-2024 9:05a
DEVEL <DIR> 10-01-2024 8:44a
FREEDOS <DIR> 10-01-2024 1:37p
COMMAND COM 85,480 07-10-2021 7:28p
FDAUTO BAT 2,562 10-01-2024 9:06a
FDCONFIG SYS 947 10-01-2024 1:38p
KERNEL SYS 46,256 10-01-2024 5:40a
4 file(s) 135,245 bytes
3 dir(s) 194,658,304 bytes free
If you don't want the extra details about individual file sizes, you can
display a "wide" directory by using the /w option with the DIR command.
C:\>dir /w
Volume in drive C is FREEDOS2024
Volume Serial Number is 0F5A-150D
Directory of C:\
[APPS] [DEVEL] [FREEDOS] COMMAND.COM FDAUTO.BAT
FDCONFIG.SYS KERNEL.SYS
4 file(s) 135,245 bytes
3 dir(s) 194,658,304 bytes free
You can look inside a specific subdirectory by passing the pathname as a
parameter to DIR.
Note that DOS names are case-insensitive.
DOS will usually display files and directories in all uppercase, but you can
equally reference them in lowercase.
C:\>dir freedos
Volume in drive C is FREEDOS2024
Volume Serial Number is 0F5A-150D
Directory of C:\FREEDOS
. <DIR> 10-01-2024 1:37p
.. <DIR> 10-01-2024 1:37p
APPINFO <DIR> 10-01-2024 1:37p
BIN <DIR> 10-01-2024 1:37p
CPI <DIR> 10-01-2024 1:37p
DOC <DIR> 10-01-2024 1:37p
HELP <DIR> 10-01-2024 1:37p
LINKS <DIR> 10-01-2024 8:45a
NLS <DIR> 10-01-2024 1:37p
PACKAGES <DIR> 10-01-2024 1:37p
TEMP <DIR> 10-01-2024 1:37p
BOOT BSS 512 10-01-2024 1:38p
BOOT MBR 512 10-01-2024 1:38p
VERSION FDI 53 10-01-2024 1:38p
3 file(s) 1,077 bytes
11 dir(s) 194,658,304 bytes free
CD
Once you can see the contents of a directory, you can "move into" any other
directory.
On DOS, you change your working directory with the CHDIR command, also
abbreviated as CD.
You can change into a subdirectory with a command like CD CHOICE or into a new
path with CD \FREEDOS\DOS\CHOICE
C:\FREEDOS>cd doc
C:\FREEDOS\DOC>cd choice
C:\FREEDOS\DOC\CHOICE>dir
Volume in drive C is FREEDOS2024
Volume Serial Number is 0F5A-150D
Directory of C:\FREEDOS\DOC\CHOICE
. <DIR> 10-01-2024 1:37p
.. <DIR> 10-01-2024 1:37p
BUGS 186 07-15-2003 7:24a
INSTALL 394 04-16-2002 4:39p
NEWS 2,826 07-15-2003 7:29a
README 426 04-16-2002 4:38p
4 file(s) 3,832 bytes
2 dir(s) 194,658,304 bytes free
DOS uses . to represent the current directory, and .. for the parent directory
(one level "up" from the current directory).
You can combine these. For example, CD .. changes to the parent directory, and
CD ..\.. moves you two levels "up" from the current directory.
You can use CD - to jump back to your previous working directory.
That is handy after you change into a new path to do one thing and want to go
back to your previous work.
C:\FREEDOS\DOC\CHOICE>cd \
C:\>cd -
C:\FREEDOS\DOC\CHOICE>cd ..
C:\FREEDOS\DOC>cd ..\..
C:\>dir
Volume in drive C is FREEDOS2024
Volume Serial Number is 0F5A-150D
Directory of C:\
APPS <DIR> 10-01-2024 9:05a
DEVEL <DIR> 10-01-2024 8:44a
FREEDOS <DIR> 10-01-2024 1:37p
COMMAND COM 85,480 07-10-2021 7:28p
FDAUTO BAT 2,562 10-01-2024 9:06a
FDCONFIG SYS 947 10-01-2024 1:38p
KERNEL SYS 46,256 10-01-2024 5:40a
4 file(s) 135,245 bytes
3 dir(s) 194,658,304 bytes free
Drive letters
Remember that DOS assigns the first partition on the first hard drive as the C: drive, and so on for other drive letters. On modern systems, people rarely divide a hard drive with multiple DOS partitions; they simply use the whole disk, or as much of it as they can assign to DOS. Today, C: is usually the first hard drive, and D: is usually another hard drive or the CD-ROM drive. Other network drives can be mapped to other letters, such as E: or Z: or however you want to organize them.
Changing drives is easy under DOS. Just type the drive letter followed by a
colon (:) on the command line, and DOS will change to that working drive.
For example:
C:\>D:
D:\>dir /w
Volume in drive D is DATA
Volume Serial Number is 373B-1700
Directory of D:\
[123] [ABILITY] [ASEASY] [DOCS] [GALAXY]
[GAMES] [QUATTRO] [SRC] [TC] [TEMP]
[VC] [WORD] [WS400]
0 file(s) 0 bytes
13 dir(s) 438,648,832 bytes free
Be careful that you don't try to change to a drive that doesn't exist. DOS may set the working drive, but if you try to do anything there you'll get the somewhat infamous "Abort, Retry, Fail" DOS error message.
Other commands to try
With the CD and DIR commands, you have the basics of DOS navigation.
These commands allow you to find your way around DOS directories and see what
other subdirectories and files exist.
Once you are comfortable with basic navigation, you might also try these other
basic DOS commands:
MKDIRorMDto create new directoriesRMDIRorRDto remove directoriesTREEto view a list of directories and subdirectories in a tree-like formatTYPEandMOREto display file contentsRENAMEorRENto rename filesDELorERASEto delete filesEDITto edit filesCLSto clear the screen
In FreeDOS, you can use the /? parameter to get brief instructions to
use each command.
Or you can type HELP to use an interactive help system.
This is adapted from [A gentle introduction to FreeDOS][https://opensource.com/article/18/4/gentle-introduction-freedos] by Jim Hall.