Get the highlights in your inbox every week.
How to navigate FreeDOS with CD and DIR | Opensource.com
How to navigate FreeDOS with CD and DIR
Armed with just two commands DIR and CD, you can navigate your FreeDOS system from the command line.
FreeDOS is an open source DOS-compatible operating system that you can use to play classic DOS games, run legacy business software, or develop embedded systems. Any program that works on MS-DOS should also run on FreeDOS.
But if you've never used DOS, you might be confused about how to navigate the system. FreeDOS is primarily a command-line interface; there is no default graphical user interface (GUI) in FreeDOS. You need to type every command at the command line.
Two commands that help you find your way around FreeDOS:
DIR. I've written those commands in all uppercase, but DOS is actually case insensitive, so you can type your commands using either uppercase or lowercase letters. DOS doesn't care.
Let's start with the
DIR command. This command name is short for directory and is similar to the
ls command on Linux systems. You can run
DIR anywhere on your system to see what files you have. Just type the command
DIR to get a list of files and directories:
DIRis very utilitarian. At the top,
DIRprints the "volume name" of the current drive. Then
DIRshows all the files and directories. In the screenshot, you can see the directory listing of the FreeDOS 1.3 RC4 LiveCD. It contains several directories, including the
FREEDOSdirectory which contains all of the core FreeDOS programs and utilities. You can also see several files, starting with the
COMMAND.COMshell, which is similar to Bash on Linux—except much simpler. The FreeDOS kernel itself is the
KERNEL.SYSfile further down the list.
At the top level of any drive, before you go into a directory, you are at the root directory. DOS uses the
\ ("back slash") character to separate directories in a path, which is slightly different from the
/ ("slash") character in Linux systems.
To navigate into a directory, you can use the
CD command. Like
cd on Linux, this stands for change directory. The
CD command sets the new working directory to wherever you want to go. For example, you might go into the
GAMES directory and use
DIR to list its contents:
You can also specify a path to
CD, to jump to a specific directory elsewhere on your system. If I wanted to change to the
FREEDOS directory, I could simply specify the full path relative to the root directory. In this case, that's the
\FREEDOS directory. From there, I can run another
DIR command to see the files and directories stored there:
Like Linux, DOS also uses
.. to represent a relative path. The
. directory is the current directory, and
.. is the directory that's one level before it, or the parent directory. Using
.. allows you to "back up" one directory with the
CD command, so you don't need to specify a full path.
From the first
DIR screenshot, we can see the root directory also contains a
DEVEL directory. If we're already in the
\FREEDOS directory, we can navigate to
DEVEL by "backing up" one directory level, and "going into" the
..\DEVEL directory via a relative path:
Armed with just two commands
CD, you can navigate your FreeDOS system from the command line. Try it on your FreeDOS system to locate files and execute programs.