How to create a iso image from a folder or single files via terminal commands? Currently i am doing this via Braseros GUI, but i want to do it with a shell script.

  • 1
    man genisoimage says it all as well.
    – poige
    Sep 15 '13 at 19:17

Seems to be pretty straightforward to do with genisoimage, in the package with the same name on Debian:

genisoimage -o output_image.iso directory_name

There are many options to cover different cases, so you should check the man page to see what fits your particular use case.

See also

  • 3
    @klingt.net In my case, I knew there was such a command but couldn't remember its name. So I did apropos iso, found genisoimage then used the search terms "generate iso with genisoimage".
    – Joseph R.
    Sep 15 '13 at 19:46
  • 3
    under unix apropros is a synonym for man -k. The latter being a little easier to remember/spell ;)
    – Drav Sloan
    Sep 15 '13 at 21:37
  • 10
    genisoimage is a dead fork from a mkisofs version from 2004. genisoimage creates filesystem images with defects. This problem can be avoided by using the original software mkisofs instead.
    – schily
    May 31 '16 at 13:16
  • 1
    Even for a OSS-hostile distro like Debian, mkisofs is of course an option as you of course can compile it yourself. If you don't like to compile yourself, never use Debian. Note that genisoimage has approx. 100 Bugs listed in the Debian Bug database since 2004 and creates defective filesystems. xorriso on the other side is in a very early state of development and does not yet support the filesystem features (like e.g. UDF) people need.
    – schily
    Nov 28 '19 at 11:43

Making a CD from a folder can be performed with mkisofs.

mkisofs -lJR -o output_image.iso directory_name

-l : Allow full 31 character filenames.

-J : Generate Joliet directory records in addition to regular iso9660 file names.

-R : Generate System Use Sharing Protocol (SUSP) and Rock Ridge (RR) records using the Rock Ridge protocol

https://linux.die.net/man/8/mkisofs https://en.wikipedia.org/wiki/Rock_Ridge


Take this basic command of:

  mkisofs -o output_image.iso directory_name

One step further, by adding a volume label to the iso, and compressing the iso-image with gzip

  mkisofs -V volume_label -r folder_location | gzip > output-image-comressed.iso.gz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.