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.
43 readers like this.
FreeDOS

Opensource.com

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: CD and 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:

DIR listing of the D: drive

 

Image by Jim Hall, CC-BY SA 4.0

The output from DIR is very utilitarian. At the top, DIR prints the "volume name" of the current drive. Then DIR shows 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 FREEDOS directory which contains all of the core FreeDOS programs and utilities. You can also see several files, starting with the COMMAND.COM shell, which is similar to Bash on Linux—except much simpler. The FreeDOS kernel itself is the KERNEL.SYS file 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:

Use CD to change your working directory

Image by Jim Hall, CC-BY SA 4.0

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:

Specify a full path to change to another working directory

Image by Jim Hall, CC-BY SA 4.0

Like Linux, DOS also uses . and .. 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:

Use .. to navigate using a relative path

Image by Jim Hall, CC-BY SA 4.0

Armed with just two commands DIR and CD, you can navigate your FreeDOS system from the command line. Try it on your FreeDOS system to locate files and execute programs.

What to read next
Tags
photo of Jim Hall
Jim Hall is an open source software advocate and developer, best known for usability testing in GNOME and as the founder + project coordinator of FreeDOS.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.