Site Menu
LINUX CLASSES - DOS

How Do I Access DOS Files With Linux?

MTOOLS: Accessing DOS Files

Do you need to list the files on a DOS-formatted floppy disk while running Linux? Do you need to copy a file from a DOS disk to your Linux file system, or vice versa? You can use the MTOOLS commands to do these and lots of other DOS-like things with Linux. The MTOOLS package is a set of Linux commands that mimic the DOS commands DIR, COPY, TYPE, DEL, RENAME, and a few others. They're called the MTOOLS because they all start with the letter m, and they work much like their DOS counterparts.

Here's a list of the MTOOLS commands and what they do:

matttrib Modify the attributes of a file.
mcd
Change the current directory.
mcopy
Copy a file.
mdel
Delete a file.
mdir
List the files in the directory.
mformat
Format a disk.
mlabel
Change the disk label.
mmd
Make a new directory.
mrd
Remove a directory.
mren
Rename a file.
mtype
Display the contents of a file.

Okay, pop a DOS disk in the machine and let's try some examples.

Here we see the mdir command in action, listing the files on a disk:

$ mdir A:
Volume in drive A has no label
Volume Serial Number is 1205-1049
Directory of A:\

COMMAND COM 54,645 05-31-94 6:22a
FORMAT COM 22,974 05-31-94 6:22a
SYS COM 9,432 05-31-94 6:22a
MOUSE COM 28,949 04-02-93 4:39p
EDIT COM 413 05-31-94 6:22a
FDISK EXE 29,336 01-01-97 12:39a
6 file(s) 145,749 bytes
1,311,915 bytes free

Now let's copy a file from Linux to the disk, and vice versa:

$ mcopy A:pandavu.tgz /tmp
$ mcopy /tmp/kornmeal.txt A:

The mcopy command figures out in which direction to perform the file transfer by looking for the A: in either the source or the target file name. If you have two floppy drives, you can use B: when referring to the second floppy drive.

Here's an example showing the use of the mdel command to delete a file on the disk:

$ mdel mouse.com

Note that we didn't prefix the name of the file to be deleted with A: this time. All of the MTOOLS commands (except mcopy) assume that you're working with the A drive, so you can omit the A: if you like, but I recommend that you don't, just for safety's sake.

Previous Lesson: Encryption
Next Lesson: Accesing DOS Partitions

[ RETURN TO INDEX ]


   

Comments - most recent first
(Please feel free to answer questions posted by others!)

sumon poddar     (22 Jan 2011, 04:11)
How can i learn linux easily and improve my knowledge.
Justin     (22 Dec 2010, 16:05)
Use winscp to connect to your linux box from windows and drag the files over. Or if you are on a samba domain you can simply put them in your home drive from windows and move them from there.
Raju     (08 Sep 2010, 01:49)
Hi
How do i transfer a file fron windows to linux.The two PCs are connected to lan.one with Windows and other with Linux.
Sounds like MTOOLS package is not installed on your machine. Look for it online in RPM format, and install.
Shivendra     (08 Sep 2010, 01:47)
Hi
How do i transfer a file fron windows to linux.The two PCs are connected to lan.one with Windows and other with Linux.
Ravi     (23 Aug 2010, 02:24)
Hi
How do i transfer a file fron windows to linux.The two PCs are connected to lan.one with Windows and other with Linux.
sivabalan     (12 Jul 2010, 00:24)
hai i want to study LINUX programming for my project
Bob Rankin     (06 Mar 2010, 07:01)
Sounds like MTOOLS package is not installed on your machine. Look for it online in RPM format, and install.
sanjiv saini     (06 Mar 2010, 01:09)
Hi
Please make examples more clearer. mcopy command doesn't work on my system.
Thanx

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
*Name:
Email:
Notify me about new comments on this page
Hide my email
*Text:
 
 


Ask Bob Rankin - Free Tech Support


Copyright by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.