EJECT(1)

โœจ EJECT โœจ (like, the eject(1) girlies' manual)

okay bestie, so this is the eject page from the User Commands corner of the manual, and yes she's a whole vibe. sit down, grab a strawberry, let's go ๐Ÿ“๐Ÿ’…


๐ŸŽ€ NAME ๐ŸŽ€

eject โ€” eject removable media. that's it, that's the girl. she pops the disc out. ๐Ÿ˜Œ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

eject [options] device|mountpoint

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so eject lets removable media pop out under software control โ€” think CD-ROM, floppy disk, tape, JAZ, ZIP, or USB disk. no manual poking, no paperclip moment, we're classy here. ๐Ÿงš

and the way that it's ALSO got range: it can control some multi-disc CD-ROM changers, the auto-eject feature that some devices support, and it can even close the disc tray of some CD-ROM drives. main character behavior honestly ๐Ÿ‘‘

so like, the device corresponding to device or mountpoint gets ejected. if you don't name anything, the default name is /dev/cdrom. periodt. and you can address the device in any of these ways:

  • by device name (e.g., sda)
  • by device path (e.g., /dev/sda)
  • by UUID=uuid tag
  • by LABEL=label tag

there are four different methods of ejecting, depending on whether the device is a CD-ROM, SCSI device, removable floppy, or tape. by default eject just tries all four in order until one of them slays. no cap.

if you specify a device partition, the whole-disk device is used. ikykyk ๐Ÿฆ‹

and if the device (or a device partition) is currently mounted, it gets unmounted before ejecting. the eject is processed on an exclusive open block device file descriptor if --no-unmount or --force are not specified. yes queen, exclusive open, she doesn't share ๐Ÿซถ


โญ OPTIONS โญ

  • -a, --auto on|off โ€” controls the auto-eject mode, supported by some devices. when it's enabled, the drive automatically ejects when the device is closed. set it and forget it bestie.
  • -c, --changerslot slot โ€” with this one you can select a CD slot from an ATAPI/IDE CD-ROM changer. heads up tho: the CD-ROM drive cannot be in use (mounted data CD or playing a music CD) for a change request to work. and also โ€” the first slot of the changer is referred to as 0, not 1. not me getting confused by that ๐Ÿ™ˆ
  • -d, --default โ€” list the default device name. just tells you, no drama.
  • -F, --force โ€” force eject. don't check device type, don't open device with exclusive lock. > careful bestie: the successful result may be a false positive on non hot-pluggable devices. she's lying to you sometimes ๐Ÿ’€
  • -f, --floppy โ€” specifies that the drive should be ejected using a removable floppy disk eject command.
  • -i, --manualeject on|off โ€” controls the locking of the hardware eject button. when enabled, the drive will not eject when the button is pressed. super useful when you're carrying a laptop in a bag or case and you do NOT want it ejecting because someone bumped the button. protecting your peace fr fr โœจ
  • -M, --no-partitions-unmount โ€” tells eject to not try to unmount other partitions on partitioned devices. if another partition is still mounted, the program will not attempt to eject the media. it will attempt to unmount only the device or mountpoint given on the command line. mind your business, basically ๐Ÿ˜Œ
  • -m, --no-unmount โ€” tells eject to not try to unmount at all. if this option is not specified then eject opens the device with the O_EXCL flag to be sure the device is not used (since v2.35). so like, that's the default behavior, don't come for her.
  • -n, --noop โ€” the selected device is displayed but no action is performed. she's just looking. window shopping. ๐Ÿ’…
  • -p, --proc โ€” lets you use /proc/mounts instead of /etc/mtab. it also passes the -n option to umount(8). sharing the love ๐Ÿซถ
  • -q, --tape โ€” specifies that the drive should be ejected using a tape drive offline command.
  • -r, --cdrom โ€” specifies that the drive should be ejected using a CDROM eject command.
  • -s, --scsi โ€” specifies that the drive should be ejected using SCSI commands.
  • -T, --traytoggle โ€” the drive gets a CD-ROM tray close command if it's opened, and a CD-ROM tray eject command if it's closed. it's giving indecisive, it's giving toggle. not all devices support this command, because it uses the above CD-ROM tray close command.
  • -t, --trayclose โ€” the drive is given a CD-ROM tray close command. not all devices support this command. sad but true ๐Ÿ˜ญ
  • -v, --verbose โ€” run in verbose mode; more information is displayed about what the command is doing. she's a talker. we love that for her ๐ŸŒˆ
  • -X, --listspeed โ€” the CD-ROM drive gets probed to detect the available speeds. the output is a list of speeds which can be used as an argument of the -x option. this only works with Linux 2.6.13 or higher โ€” on previous versions solely the maximum speed will be reported. also note that some drives may not correctly report the speed and therefore this option does not work with them. picky little drives ๐ŸŽ€
  • -x, --cdspeed speed โ€” the drive is given a CD-ROM select speed command. the speed argument is a number indicating the desired speed (e.g., 8 for 8X speed), or 0 for maximum data rate. not all devices support this command and you can only specify speeds that the drive is capable of. every time the media is changed this option is cleared. this option can be used alone, or with the -t and -c options. teamwork makes the dream work โœจ
  • -h, --help โ€” display help text and exit. classic.
  • -V, --version โ€” display version and exit. also classic. ๐Ÿ‘‘

๐Ÿฆ‹ EXIT STATUS ๐Ÿฆ‹

  • returns 0 if the operation was successful ๐Ÿ’–
  • returns 1 if the operation failed or the command syntax was not valid ๐Ÿ˜ญ

๐ŸŒˆ NOTES ๐ŸŒˆ

eject only works with devices that support one or more of the four methods of ejecting. that includes most CD-ROM drives (IDE, SCSI, and proprietary), some SCSI tape drives, JAZ drives, ZIP drives (parallel port, SCSI, and IDE versions), and LS120 removable floppies. users have also reported success with floppy drives on Sun SPARC and Apple Macintosh systems. if eject does not work, it is most likely a limitation of the kernel driver for the device and not the eject program itself. don't blame her, blame the kernel bestie ๐Ÿ’€

the -r, -s, -f, and -q options allow controlling which methods are used to eject. more than one method can be specified. if none of these options are specified, it tries all four (this works fine in most cases). she's versatile like that ๐Ÿ’…

eject may not always be able to determine if the device is mounted (e.g., if it has several names). if the device name is a symbolic link, eject will follow the link and use the device that it points to. she's a follower (affectionate) ๐Ÿงš

if eject determines that the device can have multiple partitions, it will attempt to unmount all mounted partitions of the device before ejecting (see also --no-partitions-unmount). if an unmount fails, the program will not attempt to eject the media. no half measures.

you can eject an audio CD ๐ŸŽต some CD-ROM drives will refuse to open the tray if the drive is empty. some devices do not support the tray close command. rude of them, honestly.

if the auto-eject feature is enabled, then the drive will always be ejected after running this command. not all Linux kernel CD-ROM drivers support the auto-eject mode. and there is no way to find out the state of the auto-eject mode. mystery girl energy ๐Ÿ”ฅ

you need appropriate privileges to access the device files. running as root is required to eject some devices (e.g., SCSI devices). so yeah, sudo or nothing ๐Ÿซถ


๐Ÿ’œ AUTHORS ๐Ÿ’œ

  • Jeff Tranter <tranter@pobox.com> โ€” original author
  • Karel Zak <kzak@redhat.com> and Michal Luscon <mluscon@redhat.com> โ€” util-linux version

iconic collab, no notes ๐Ÿ’–


๐ŸŒธ SEE ALSO ๐ŸŒธ

findmnt(8), lsblk(8), mount(8), umount(8)

the whole friend group, they all link up ๐Ÿซถ


๐Ÿ› REPORTING BUGS ๐Ÿ›

for bug reports, use the issue tracker at <https://github.com/util-linux/util-linux/issues>. tell them everything, they'll handle it ๐Ÿ’…


โญ AVAILABILITY โญ

the eject command is part of the util-linux package, which can be downloaded from the Linux Kernel Archive at <https://www.kernel.org/pub/linux/utils/util-linux/>. go get her ๐ŸŒˆ


okay and for the cute sign-off bestie โ€” this whole thing is util-linux 2.42.4, dated 2026-09-21, and that's the eject(1) page, done and dusted ๐Ÿ’…โœจ bye, love you, don't forget to unmount first ๐ŸŽ€

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms