You may want to specify how many columns should be shown instead of what xxd gets you by default (10). So let's say I want to get the hex dump of the last 3 lines, then, I will be using the following: xxd -s -0x30 Sample.txt Specify the column length To get the hex dump of the last n number of the lines, you will have to execute the xxd command in the following manner: xxd -s - Filename So let's say you want to start the hex dumping from the 5th line, which means you need to trim down the first 4 lines: xxd -s 0x40 Sample.txtĪnd as you can see, it trimmed the first 4 lines and gave me the hex dump starting from the 5th line.īut if you want to get the hex dump of the last few lines, you can do that too! To do so, you will have to use the -s flag and append how many initial lines you want to skip: xxd -s Filename The xxd command allows you to trim down lines from your output. Sure, you can use different options to tweak the default behavior of the xdd command. To create a hex dump of the Sample.txt file, I will be using the following command: xxd Sample.txt To make things easy to understand, I will be using the file named Sample.txt throughout the tutorial, which contains the following: Which Linux distro is your daily driver? Once you are done with the installation, you have to follow the given command syntax to use the xxd command: xxd The xxd utility is not pre-installed in most Linux distributions but can easily be installed with the default package manager.įor Ubuntu/Debian base: sudo apt install xxdįor Fedora/RHEL base: sudo dnf install vim-commonįor Arch-based distros: sudo pacman -S xxd How to use the XXD command in Linux It can also do the opposite and convert hex to normal characters.Īnd in this tutorial, I will walk you through different examples of how to use the xxd command in Linux. Like any other normal command, it takes data from the standard input or file and gives hexadecimal output. Want a Hexadecimal dump (a hexadecimal view) of your data? The xxd command can do that for you.
0 Comments
Leave a Reply. |