Logo

SudoVersity

SudoMistress
Sep 22, 2023

Linux Review: Working with Files

I’ve been going back and trying to refresh knowledge about security and Linux that I don’t use nearly as often as I used to do. To do this, I’ve been enjoying participating in rooms found over at TryHackMe (this link is a referral link in case you want to try it out. We do get a reward.).

A while ago I completed their Fundamentals of Linux rooms and got a badge! 🎉

IMAGE

Image Credit: SudoMistress

Working with Files

I’m very used to using the cat command to view the contents of a file when working in a terminal. The latest room I am taking, NIS - Linux Part I, there is a section dedicated to working with files that covers that command and several others.

  • cat can be used to output, append, and create contents of a file.
  • tac like cat but prints in reverse and is less powerful.
  • head used to view the start a file.
  • tail used to get the ending content of a file. I use tail -f file.log when working on a server to see the log file as it gets new entries on the fly.
  • xxd generates a hex dump of the file’s contents and shows you the contents on the right.
  • base64 converts the file’s contents to base64 and can be used to convert it back. base64 bob.txt | base64 --decode

Good things to remember.