Menu

Extract single file from command line from device on Linux

mdadm
2024-03-17
2024-03-18
  • mdadm

    mdadm - 2024-03-17

    I know how to view directories and files on device by command run as root: "7zz l /dev/sda | less", but how to extract from command line single file or directory containing file(s) from device with filesystem supported by 7-zip (like ext4) but which can not mounted on Linux?

     
  • Igor Pavlov

    Igor Pavlov - 2024-03-18

    I don't understand that question.
    Extracting command:

    7z x /dev/sda folder/file
    
     

    Last edit: Igor Pavlov 2024-03-18
  • mdadm

    mdadm - 2024-03-18

    Nevermind: I found solution what I was looking for:

    7z l /dev/sdb1 | less
    7z e /dev/sdb1 '-ir!dir/file'
    7z e /dev/sdb1 '-ir!dir/*'

    /dev/sdb1 is not mounted! I wonder if it works for APFS, but I won't check - I don't have disk with that fs.

    Update:
    Ok, this also works and is simplier:

    7z e /dev/sdb1 'dir/file'
    7z e /dev/sdb1 'dir/*'

    Thanks Igor for your effort!

     

    Last edit: mdadm 2024-03-18

Log in to post a comment.