how to use parted get partition_type

I want to use GNU parted for disk partition, but I also hope to get the partition type id by parted. :confused:I can get it from fdisk -l, but I don't know how the parted can get it. The print of the "parted print" only include fstype flags and so on, I hope some help. Thank you.
My English is not so good, I feel so sorry. :stuck_out_tongue:

parted mashes partition types and partition flags all together into one 'flag' variable. This may be because parted can edit several partition types, while fdisk is mostly just for MSDOS-type partition systems. If you want to see that kind of low-level detail in the system, use fdisk.

(parted) help toggle                                                      
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition
        NUMBER

	NUMBER is the partition number used by Linux.  On MS-DOS disk labels,
        the primary partitions number from 1 to 4, logical partitions from 5
        onwards.
        FLAG is one of: boot, root, swap, hidden, raid, lvm, lba, hp-service,
        palo, prep, msftres, bios_grub, atvrecv, diag
1 Like

Thank you very much for your help. I have resolved this question, the parted analyze the partition type value from MBR or EBR or others, put the value into serval intuitive message by itself, I can acconting the "Type","File system" and "Flags" to get the message I need. I don't know it's right or wrong what I say, thank you again :slight_smile: