• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

binwalk Command Examples in Linux

by admin

binwalk is a command-line tool in Linux that is used to analyze and extract the contents of binary files. It is commonly used to reverse engineer firmware images or other types of binary files to discover hidden or encoded data, such as bootloaders, kernel images, or filesystems.

To use binwalk, you will need to have the binwalk package installed on your Linux system. You can install binwalk using the package manager for your specific distribution of Linux. For example, on an Ubuntu system, you can use the apt command to install binwalk:

$ sudo apt install binwalk

Once binwalk is installed, you can use it to analyze a binary file by running the binwalk command followed by the name of the file. binwalk will scan the file and attempt to identify any known data structures or patterns that it contains.

binwalk supports a variety of command-line options that allow you to customize the analysis and extraction process, such as the signature database to use, the output format, or the extraction options. You can use these options to fine-tune the analysis and extraction to suit your needs.

For example, to extract all the files contained in a firmware image called example.bin, you could use the following command:

# binwalk -e example.bin

To display the results of the analysis in a different output format, such as JSON, you could use the following command:

# binwalk --output=json example.bin

For more information on using binwalk, you can consult the binwalk documentation or use the binwalk –help command to view a list of available options and usage examples.

binwalk Command Examples

1. Scan a binary file:

# binwalk path/to/binary

2. Extract files from a binary, specifying the output directory:

# binwalk --extract --directory output_directory path/to/binary

3. Recursively extract files from a binary limiting the recursion depth to 2:

# binwalk --extract --matryoshka --depth 2 path/to/binary

4. Extract files from a binary with the specified file signature:

# binwalk --dd 'png image:png' path/to/binary

5. Analyze the entropy of a binary, saving the plot with the same name as the binary and `.png` extension appended:

# binwalk --entropy --save path/to/binary

6. Combine entropy, signature and opcodes analysis in a single command:

# binwalk --entropy --signature --opcodes path/to/binary

Filed Under: Linux

Some more articles you might also be interested in …

  1. “You must wait longer to change your password” – error while changing password in CentOS/RHEL
  2. How to exclude a file/directory from auditd rules
  3. extundelete Command Examples in Linux
  4. CentOS / RHEL LVM : Backing Up Volume Group Metadata
  5. How to fix the “Firefox already running” problem on Linux
  6. light Command Examples in Linux
  7. CentOS / RHEL 6,7 : Why the files in /tmp directory gets deleted periodically
  8. legit: command not found
  9. gsettings Command Examples in Linux
  10. lvs Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright