On Unix-like operating systems, the mt command controls a magnetic tape device.

This page covers the GNU/Linux version of mt.

Description

The default tape device to operate on is taken from the file /usr/include/sys/mtio.h when mt is compiled. It can be overridden by giving a device file name in the environment variable TAPE or by a command line option (see below), that also overrides the environment variable.

  • Description
  • Syntax
  • Exit status
  • Related commands
  • Linux commands help

The device must be a character special file or a remote tape drive. To use a tape drive on another machine as the archive, use a file name that starts with ‘HOSTNAME:’. The hostname can be preceded by a username and an ‘@’ to access the remote tape drive as that user, if you have permission to do so (typically an entry in that user’s ‘~/.rhosts’ file).

The available operations are listed below. Unique abbreviations are accepted. Not all operations are available on all systems, or work on all types of tape drives. Some operations optionally take a repeat count, which can be given after the operation name and defaults to 1.

Syntax

mt [-V] [-f device] [–file=device] [–rsh-command=command] [–version] operation [count]

Operations

Options

Exit status

mt exits with a status of 0 if the operation succeeded, 1 if the operation or device name given was invalid, or 2 if the operation failed.

tar — Create, modify, list the contents of, and extract files from tar archives.tcopy — Copy a magnetic tape.