During my Cyber Security study, I am using Kali operating system to learn Linux and commands I need to use. I am maintaining this list as reference to help me document my research and things I have learned.
1. How can I search for files from a terminal?
- Run sudo updatedb
- I am searching for files that have wallpaper in the filename with extension of .png
- locate *wallpaper*.png
2. How to locate a file behind a symbolic link?
readlink -f /usr/share/wallpapers/KaliSmallLogo/contents/images/1600x1200.png /usr/share/backgrounds/kali/kali-small-logo-4x3.png
3. How to read magic files and file header?
Two commands can be used. xxd with a parameter to the file and with a pipe to head to see first 10 lines. Also file can be used to have more readable information.
xxd /var/lib/inetsim/http/fakefiles/sample.jpg | head 00000000: ffd8 ffe0 0010 4a46 4946 0001 0101 0048 ......JFIF.....H 00000010: 0048 0000 ffe1 0016 4578 6966 0000 4d4d .H......Exif..MM 00000020: 002a 0000 0008 0000 0000 0000 fffe 0017 .*.............. file /var/lib/inetsim/http/fakefiles/sample.jpg /var/lib/inetsim/http/fakefiles/sample.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=0], comment: "Created with The GIMP", baseline, precision 8, 200x150, components 3