A lightweight Bash script to mount USB partitions via udisksctl
, open them in
yazi
, and unmount them afterward – safe, clean, and user-friendly.
- Lists only removable
/dev/sdX
partitions (ignores NVMe/system drives) - Interactive selection menu with manual quit option
- Warns if a partition is already mounted
- Cleanly extracts the mount path using Bash
- Automatically unmounts after closing
yazi
- Zero dependencies beyond
udisksctl
,lsblk
, andyazi
-
Clone or copy the script:
git clone https://github.com/splixx05/zsh-yazi-mount.git "$ZSH/custom/plugins/zsh-yazi-mount"
-
Activate the plugin in your /.zshrc under "plugins" like so:
plugins=(git ... zsh-mnt ...)
or run the installation script from anywhere:
./install.sh
- Usage in terminal:
For USB type this
$ :usb
For Mobilephone type this
$ :phone
- Browse the mounted device with yazi – once you quit yazi, the device will be automatically unmounted.
- bash/zsh
- Oh-My-Zsh
- yazi
- udisksctl
- lsblk
- noto-fonts-emoji (or something similar for icons)
Make sure your user has permission to use udisksctl (usually no sudo required for mounting USB devices).
- Only shows /dev/sdX devices (ignores NVMe system drives)
- Does not force mount anything
- Checks if device is already mounted before attempting to mount/unmount
- Lets the user abort at any time with q
-
Remove the plugin folder:
rm -rf ~/.oh-my-zsh/custom/plugins/zsh-yazi-mount
-
Remove zsh-yazi-mount from the plugins=(...) line in your ~/.zshrc.
-
Restart your terminal or run:
source ~/.zshrc
Optional: If you no longer need the additional software (udisksctl, lsblk, noto-fonts-emoji), you can uninstall them using your package manager.