<<

Appendix B. A Comparison of Common DOS and Commands

Many Linux commands typed a prompt are similar to the commands you would in MS- DOS. In fact, some commands are identical. This appendix provides common commands used at the MS-DOS prompt in Windows(tm) and their counterparts in Linux. Basic examples of how the are used at the Linux shell prompt are also provided. Note that these commands usually have a number of options. To learn about each command, read its associated (for example, type man at the shell prompt to read about the ls command).

Command’s MS-DOS Linux Basic Linux Example Purpose Copies files cp thisfile.txt /home/thisdirectory Moves files mv thisfile.txt /home/thisdirectory Lists files ls ls Clears screen clear Closes prompt exit exit window Displays or sets date date date date Deletes files rm thisfile.txt "Echoes" output on echo echo this message the screen

Edits files with edit pico(a) pico thisfile.txt simple text editor Compares the diff file1 file2 contents of files Finds a string of grep this word or phrase text in a file thisfile.txt Formats a diskette a: (if mke2fs or /sbin/mke2fs /dev/fd0 diskette is in A:) mformat(b) (/dev/fd0 is the Linux equivalent of A:)

Displays command command /? man(c) man command Creates a mkdir mkdir directory

View a file more (d) less thisfile.txt Renames a file mv mv thisfile.txt thatfile.txt() 148 Appendix B. A Comparison of Common DOS and Linux Commands

Command’s MS-DOS Linux Basic Linux Example Purpose Displays your chdir pwd location in the file system Changes directories pathname cd pathname cd /directory/directory with a specified (absolute path) Changes directories cd .. cd .. cd .. with a relative path

Displays the time date date Shows amount of mem free free RAM and use Notes: a. Pico is a simple text editor; other editors you can use in place of Pico include and . b. This formats a disk for the DOS filesystem. c. You can also use for some commands. d. The more pager can also be used to page through a file a screen at a time. e. The mv command can both move a file and, if you want to rename a file in the same directory, you "move" that file to the same directory with a new name, as in this example. Table B-1. Similar Commands