DOS commands for Linux users

An overview of DOS commands for a Linux user.

As seen in Windows XP.


Similar commands. Not exact same ones. There are differences.

Linux DOS
ls DIR
cd CD or CHDIR
pwd CD
clear CLS
cat TYPE
edit Launch editor
echo ECHO
man HELP
diff FC
rmdir RMDIR or RD
mkdir MKDIR or MD
chmod ATTRIB
grep FIND (and FINDSTR ?)
free MEM
more MORE
ping PING
sort SORT
date DATE

Options in DOS start with / as in /a instead of -a in Linux.

Help text of DOS commands is usually obtained using /?, like --help in Linux.

Compare files

With FC command. As in 'File Compare'.

fc file1.txt file2.txt

Or with COMP command which is a bit different from FC.


Launch an editor.

edit [file]

MS-DOS editor in XP.

MS-DOS editor not available in any 64-bit Windows.

Managing directories

Create directory

mkdir [dirs]
md [dirs]

Delete directory

Remove an empty directory.

rmdir [dirs]
rd [dirs]

Or remove entire directory along with all its sub-directories and files with DELTREE:

DELTREE is considered a 'dangerous' command due to the possibility of accidental file deletion.

Changing current directory

CD command.

  1. Go to the parent directory

    cd ..

Run cd without any parameters.



–help option for DOS commands

In DOS, /? fulfills the function of --help in Linux.

cmd /?


HELP <command-name>

Command options

In DOS, options are preceded by a '/' unlike Unix where hyphens are used instead.

Change file permissions

Use ATTRIB command.

For example, the following command makes the file file.txt 'not hidden' and 'not read-only'.

attrib -h -r file.txt

Without any switches, ATTRIB acts something like ls -l in Linux.


Two ways:

These work only when at the beginning of a line.


REM Hello script
:: Another comment
echo "Hello"

If we need comment after a command, we can use command concatenation character (&) like

echo "hello" & REM A comment
echo "world" & ::  Another comment

Find memory usage

MEM command.


and get output like

655360 bytes total conventional memory
655360 bytes available to MS-DOS
633456 largest executable program size

1048576 bytes total contiguous extended memory
      0 bytes available contiguous extended memory
941056 bytes available XMS memory
      MS-DOS resident in High Memory Area


MORE command.

PATH command

Displays search path for executable files.

Like displaying or setting $PATH in Linux.

PAUSE command

Suspends execution and by default, displays a "Press any key to continue . . ." message, till a key is pressed.

Renaming files

Two ways:


Using SET command.

set var=hello
echo %var%

Environment variables

%cd%     : Like $PWD in Linux


Unlike Unix, DOS considers file extension quite important.


REM Like `ls *` in Linux
dir *.*


REM Like `ls *.txt` in Linux
dir *.txt

Question mark


would match ab.swp, 12a.swo, etc.

Date and time

Display current date and prompt for new date value: date

Just display current date: date /t

Likewise with time: time and time /t.


Piping commands

Like in Unix.

For example, the following is like cat file.txt | more in Linux:

type file.txt | more

Input/output redirection

Todo: Todo

Copy entire directory trees

Todo: XCOPY command.

Less oftenly used commands

Change title of DOS window

Change title of command prompt window with TITLE command.

Get DOS version

VER command.

Some 'equivalent' DOS commands

grep -r

dir *.txt /s /b

/s look in all sub-directories and /b keeps output concise.