Linux versions of common DOS/Windows commands

Linux versions of common DOS/Windows commands

Most experienced support techs can drop to a command prompt and execute commands and utilities with confidence. However, if you're starting to support Linux desktops on your network, you may quickly find yourself lost when you open a Linux terminal session. Here is a list of common DOS/Windows commands that you probably use on a daily basis and their Linux counterparts:

 

What you want to do

How you did it in
DOS

How you do it in Linux

Copy a file

copy path1\filename1 path2\filename2

cp path1/filename1 path2/filename2

Copy subdirectory

xcopy path1\. path2 /s

cp -R path1 path2

Delete a file

del filename

rm filename

Move a file

move path1\filename1 path2

mv path1/filename1
path2

Rename a file

ren filename1 filename2

mv filename1 filename2

List a directory

dir

ls

Change directory

cd \path

cd /path

Make directory

md path

md path

Delete a subdirectory

deltree \path1

rm -R path

List text file contents

type filename

cat filename

Edit a file

edit filename

pico filename

or

vi filename

Format floppy

format a:

fdformat /fd0H1440

Check for disk errors

chkdsk drive -or- scandisk drive

fsck /device

Change file attribute

attrib +- attribute filename

chmod mode filename

Clear screen

cls

clear

Display environment variables

set

env

Set environment variable

set variable=value

env variable=value

Set time

time time

date MMDDHHSS

Close command prompt

exit

exit