How do I open a .bak file on Linux?

26,372

Solution 1

.bak generally designates that the file is a backup copy of something, but other than that it gives preciously little information as to the actual file type.

Try looking at the output of the file command, which studies the first few bits of the file to see if it recognizes it as a known filetype:

caleburn: ~/ >file image001.jpg 
image001.jpg: JPEG image data, JFIF standard 1.01
caleburn: ~/ >file oops.png 
oops.png: PNG image data, 935 x 546, 16-bit/color RGB, non-interlaced
caleburn: ~/ >file zones.zip 
zones.zip: Zip archive data, at least v2.0 to extract
caleburn: ~/ >file eth2.pcap 
eth2.pcap: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 96)

And so on, and so on. Once you know what type of file linux thinks it is, google should be able to suggest how to access it.

... Alternately, you can ask whoever sent it to you what the original filename was supposed to be and find out that way. :)

Solution 2

A .bak file, as defined at FileInfo.net is a Windows or MacOS backup file. Also according to the site, you should likely open the .bak file with the program that originally created it. Currently, that is dependent on the type of .bak file.

Share:
26,372

Related videos on Youtube

mico
Author by

mico

Web | Mobile | IoT | Networking | Machine Learning

Updated on September 18, 2022

Comments

  • mico
    mico over 1 year

    I have received a file of .bak format, let it be foo.bak. I don't know if it is a MS-DOS file or Linux/Unix file. What I know is that I can't open it because my Linux (Ubuntu) does not give any hint how to open it.

    So, how I open this file?

    Just to omit warnings about not knowing what I am doing:

    Disclaimer: I received my file from a known place, it is not a virus. It is a soft copy of one system I should next work on. I just do not happen to know how to open it.

    • Admin
      Admin almost 13 years
      It is most probably not a Linux backup: substituting .bak with .exe did not solve my problem.
    • Admin
      Admin almost 13 years
      what do you mean by "soft copy of one system"?
    • Admin
      Admin almost 13 years
      I think they mean a backup image of a Windows Operating System
    • Admin
      Admin almost 13 years
      have you any idea (or possibility to find out) with which program this file was initially created?
  • mico
    mico almost 13 years
    file my_file.bakcommand gave just data
  • mico
    mico almost 13 years
    It became clear this is a Windows file. Can this file then be opened in any way at Linux?
  • drjors
    drjors almost 13 years
    To my knowledge, no. Generally speaking, a .bak file needs to be opened with the program that made it. For example, ihatephp.php.bak would need to be opened up by a PHP editor (or notepad/gedit/nano/vim) after removing the .bak part of the file. If the .bak is a Windows System backup, then you cannot open it on linux or ubuntu, as it requires Windows to restore from a backup file that it created.
  • Shadur
    Shadur almost 13 years
    That means that it doesn't recognize it as any kind of filetype it knows about -- and file knows a /lot/ of filetypes. You can try to extract a little more information about it by typing strings foo.bak | less and scrolling through the output to see if any of it makes sense. Beyond that, I reiterate that asking the person who sent it to you is your best bet.
  • mico
    mico almost 13 years
    I now identified the file. It was not a program but it was a "database dump" of the data stored by that program. Thanks to all you guys!
  • mico
    mico almost 13 years
    What also helped me on my task about Windows files: wine helps on running them in Linux :)
  • Michael Mrozek
    Michael Mrozek over 11 years
    It turned out to be a database dump; I'm not sure why you decided it was a tgz file