Comparision b/w dos and unix-line interfaces

Comparison of DOS and Unix command-line interfaces

Function

DOS (5 or greater)

Unix (BSD 4.3 & System V.3)

Directory listing: names only

dir /w

ls
ls -a ("a" for all, including hidden files)

Directory listing: names, sizes, dates

dir

ls -al ("l" for long)
ls -a -l

Ditto, sorted by date of file

dir /od

ls -alt ("t" for time)

Ditto, pausing between screens

dir /p /od
dir /od | more

ls -alt | more (BSD)
ls -alt | pg (V.3)

Display contents of a file

type file

cat file

Ditto, pausing between screens

more <>

more file (BSD)
pg file (V.3)

Print a file on the default printer

print file
copy file prn:

lpr file (BSD)
lp file (V.3)
print file (AIX)

Edit a file in full-screen mode

edit file

vi file (#1 editor)
emacs file (#2)
pico file (easiest)

Create a directory

mkdir dir
md dir

mkdir dir

Change current directory

cd dir
cd dir\sub

cd dir
cd dir/sub

Change to parent directory

cd ..
cd..

cd ..

Change to root directory

cd \
cd\

cd /

Change to HOME directory
(where you start when you login)

(NOT APPLICABLE)

cd
cd /u/userid
(Some systems instead use: "cd /home/userid")

Display name of current directory

cd

pwd

Display directory, and subdirectories

dir /s
tree /f

ls -R
find . -print

Ditto, but not the files

tree

find . -type d -print

Erase a file

erase file
del file

rm file

Erase an empty directory

rmdir dir

rmdir dir

Erase a directory, files and subdirs.

erase dir/*.*
erase dir/sub/*.*

rm -r dir ("r" for recursive)

Make a file read-only (so it can't be deleted)

attrib +r file

chmod a-w file

Make a copy of a file with new name

copy file newfile

cp file newfile

Copy a directory & subdirectories

xcopy dir newdir /s

cp -r dir newdir

Move a file to another directory

1ST: copy file dir
2ND: erase file
move file dir (DOS6+ on the same drive)

mv file dir

Move a directory to another directory

1ST: xcopy dir newdir /s
2ND: (Erase dir as above)
or use move on DOS6+

mv -r dir newdir

Rename a file

rename file newname

mv file newname

Rename a directory

mv dir newname