Grub2 File Manager – List devices and files

Grub2 File Manager helps you browse the list of devices and files, it also supports reading text files, opening ISO files and partition images.

Grub2 File Manager

From the Grub2 main menu, press d for quick access to the File Manager menu.

Grub2 File Manager

Here is the Grub2 script I wrote for AIO Boot. You can use it if you install Grub2 without using AIO Boot.


function FileManager {
	submenu "... ${1}" "$1" {
		regexp -s subdir ".*\/(.*)" "$2"
		if [ -n "$subdir" ]; then
			regexp -s dir "(.*)\/.*" "$2"
			FileManager "$dir"
		else configfile ${prefix}/FileManager.cfg; fi
	for file in $1/*; do
		regexp -s subdir ".*\/(.*)" "$file"
		if test -d "$file"; then
			submenu "${subdir}..." "$file" {
				FileManager "${2}"
		elif test -f "$file"; then
			regexp -s ext ".*\.(.*)" "$file"
			tr -D -s ext "$ext"
			if [ "$ext" == "iso" ] -o [ "$ext" == "partimg" ] -o [ "$ext" == "img" ] -o [ "$ext" == "ufs" ] -o [ "$ext" == "hfs" ]; then
				submenu "${subdir}" "$file" "$1" {
					regexp -s device '\((.*)\).*' "$2"
					if ! test -e (loop1); then loop=loop1;
					elif ! test -e (loop2); then loop=loop2; 
					elif ! test -e (loop3); then loop=loop3; 
					elif ! test -e (loop4); then loop=loop4;
					elif ! test -e (loop5); then loop=loop5;
					else loop=loop1; fi
					if test -e ($loop); then loopback -d $loop; fi
					loopback $loop "$2"
					if probe -f $loop; then FileManager ($loop); else loopback -d $loop; fi
				menuentry "${subdir}" "$file" {
					cat "${2}"
					echo -n "Press ESC to return to the menu "
					sleep -i -v 60
	menuentry "${backcfg} [${press} B]" --hotkey=b {
		configfile ${prefix}/Main.cfg
echo "Scanning list of partitions on this computer. Please wait..."
for dev in (*); do
	regexp -s device '\((.*)\)' $dev
	if ! searchindevice "$device" "on" "on"; then continue; fi
	probe -f -s fstype $device
	if [ -z "$fstype" ] -o [ "$fstype" == "procfs" ]; then continue; fi
	probe -s vollabel -l $device
	probe -s voluuid -u $device
	if [ -z "$vollabel" ]; then set vollabel="No Name"; fi
	submenu "${device} - ${vollabel} - ${fstype} - ${voluuid}" $device {
		FileManager "(${2})"
	unset vollabel
	unset voluuid
	unset fstype
menuentry "Return to the Main menu" {
	configfile ${prefix}/grub.cfg


submenu "File Manager" {
	configfile ${prefix}/FileManager.cfg


You can use the ls command to list devices and files. Press c to enter commands.

List the device list, including hard disk, floppy disk, CD/DVD…

ls -l

List the folders and files on the root device:

ls -l /
ls -l /AIO
ls -l /EFI

List folders and files on another device (eg hd1,msdos1):

ls -l (hd1,msdos1)/
ls -l (hd1,msdos1)/AIO
ls -l (hd1,msdos1)/EFI

Use the cat command to read the text file:

cat --dos /autorun.inf
cat (hd1,msdos1)/myfile.txt
cat /etc/fstab

Use the loopback command for filesystem files. For example, the partition image file (PartIMG) and ISO (iso9660).

loopback loop0 /AIO/Files/PartIMG/PartIMG_ROOT.img
ls -l (loop0)/
loopback -d loop0
loopback loop1 /ubuntu.iso
ls -l (loop1)/
loopback -d loop1

The Grub2 File Manager also uses the cat and loopback commands to open the files.

Share this...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on RedditShare on TumblrShare on VKBuffer this pageDigg thisEmail this to someoneFlattr the authorPrint this pageShare on StumbleUponShare on Yummly