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 |
Directory listing: names, sizes, dates | dir | ls -al ("l" for long) |
Ditto, sorted by date of file | dir /od | ls -alt ("t" for time) |
Ditto, pausing between screens | dir /p /od | ls -alt | more (BSD) |
Display contents of a file | type file | cat file |
Ditto, pausing between screens | more <> | more file (BSD) |
Print a file on the default printer | print file | lpr file (BSD) |
Edit a file in full-screen mode | edit file | vi file (#1 editor) |
| | |
Create a directory | mkdir dir | mkdir dir |
Change current directory | cd dir | cd dir |
Change to parent directory | cd .. | cd .. |
Change to root directory | cd \ | cd / |
Change to HOME directory | (NOT APPLICABLE) | cd |
Display name of current directory | cd | pwd |
| | |
Display directory, and subdirectories | dir /s | ls -R |
Ditto, but not the files | tree | find . -type d -print |
| | |
Erase a file | erase file | rm file |
| | |
Erase an empty directory | rmdir dir | rmdir dir |
Erase a directory, files and subdirs. | erase dir/*.* | 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 | mv file dir |
Move a directory to another directory | 1ST: xcopy dir newdir /s | mv -r dir newdir |
Rename a file | rename file newname | mv file newname |
Rename a directory | | mv dir newname |