FreeDOS for Linux users
If you've tried FreeDOS, you might have been stymied by the command line. The DOS commands are slightly different from how you might use the Linux command line, so getting around on the command line requires learning a few new commands.
But it doesn't have to be an "all new" experience for Linux users. We've always included some standard Unix commands in FreeDOS, in addition to the DOS commands that are already similar to Linux. So if you're already familiar with the Linux command line, try these commands to help ease into FreeDOS:
cd command to change directory in the FreeDOS filesystem. The usage is basically the same on FreeDOS as it is on Linux. To change into a subdirectory called
cd apps. To go back to the previous directory, type
The only difference is that on FreeDOS, the directory separator is
\ ("back slash") instead of
/ ("forward slash") that you use on Linux. For example, let's say you were in the
\devel directory, and you wanted to move to the
\fdos directory. Both of those are at the same "level" relative to the root directory. So you could type
cd ..\fdos to "back up" one directory level (with
..) and then "go into" the
To change to a new directory, you could instead give the full path with the leading back slash. This is handy if you are already deep into another path, and just want to switch immediately to the new location. For example, to change to the
\temp directory, you can type
In FreeDOS, like most DOS systems, you can see your current path as part of the DOS prompt. On Linux, your prompt is probably something like
$. On FreeDOS, the prompt lists the current drive, the current path within that drive, then
> as the prompt (taking the place of
$ on Linux).
Listing and Displaying Files
On Linux, the standard command to list files in the current directory is the
ls command. On FreeDOS, it's a different command:
dir. But you can get the similar behavior as
ls by creating an alias.
To create an alias to another command, use the built-in
alias command. For example, use this command to define an alias for
ls that will display a directory listing in a similar way to using
ls on Linux:
The command option format is slightly different on FreeDOS than on Linux. On Linux, you start options with a hypen character (
-). But on FreeDOS, options start with a forward slash (
/alias command above uses the slash character - those are options to
/one option tells
dir to order (o) in a certain way: sort any files and directories by name (n) and then by extension (e). Using
/w says to use a "wide" directory listing,
/b uses a "bare" display without the other information
dir usually provides, and
dir to display files and directories in lowercase.
Note that the command line options for the FreeDOS
dir command are quite different from the options to Linux
ls, so you can't use this
ls alias exactly like you would on Linux. For example, typing
ls -l with this alias on FreeDOS will result in a "File not found" error, because the underlying FreeDOS
dir command will be unable to find a file called
-l. But for basic "see what files I have on my system," this
ls alias is good enough to help Linux users get started with FreeDOS.
Similarly, you can create an alias for the FreeDOS
type command, to act like the Linux
cat command. Both programs display the contents of a text file. While
type doesn't support the command line options you might use under Linux, the basic usage to display a single file will be the same.
Other Unix-like Commands
FreeDOS includes a selection of other common Unix-like commands, so Linux users will feel more at home. To use these Linux commands on FreeDOS, you may need to install the "Unix-like" package set from the FDIMPLES package manager.
Not all of the Unix-like utilities work exactly like their Linux counterparts. That's why we call them "Unix-like." You might want to check the compatibility if you're using some esoteric command line options, but typical usage should be fine. Start with these common Unix-like commands on FreeDOS:
cal is the standard Unix calendar program. For example, to display the calendar for the current month, just type
cal. To view a specific month, give the month and year as arguments:
View your disk usage with the
du command. This is a simple version of the Linux disk usage command, and doesn't support any command line options other than a path.
head command displays the first few lines of a file. For example, this is a handy way to determine if a file contains the correct data.
To view an entire file, use the
more command, the default file viewer on FreeDOS. This displays a file one screenful at a time, then prints a prompt to press a key before displaying the next screenful of information. The
more command is a very simple file viewer; for a more full-featured viewer like you might use on Linux, try the
less provides the ability to scroll "backwards" through a file, in case you missed something. You can also search for specific text.
If you have a lot of directories in your program path variable (
PATH) and aren't sure where a certain program is running from, you can use the
which command. This scans the program path variable, and prints the full location of the program you are looking for.
FreeDOS 1.3 RC4 includes other Unix-like commands that you might use in other, more specific situations. These include
bc as the arbitrary precision numeric processing language,
sed for stream editing,
xgrep to search a text file using regular expressions,
md5sum to generate an MD5 signature of a file,
nro for simple typesetting using nroff macros,
sleep to pause the system for a few seconds,
tee to save a copy of a command line stream,
touch to modify a file's time stamp,
trch to translate single characters (like Linux
uptime to report how long your FreeDOS system has been running.