Hacking is something that I've been fond of ever since I discovered the internet back in 1999. At that time, my first - somewhat technical - hacking attempt involved cloning the Yahoo! Mail page, changing the form method from POST to GET, setting it as start page at computers from internet cafés and later coming back and checking the browser history.

Recently, after 7 years of working as a web developer I decided it was time for a sabbatical. I started exploring new things and ended up trying bug bounties. I enjoyed the thrill of it and decided web security was something worth digging deeper into. So here it is.

Trivia: Securist was the name given to agents of the secret police of the Socialist Republic of Romania.


Cat tail! More or less


I’ve been using cat for ages to display contents of files. I used it very rarely to actually concatenate files together. A few years ago, it was revealed that cat interprets escaped sequences. If you’ve been doing any kind of security work, you know how that can turn bad. I’ve already been using tail -f to follow logs, since I started doing web development. I always had the problem that I wanted to scroll back but, as new items were added, it would automatically scroll me back to the end of the file. At one point I stumbled upon a good alternative, namely using less +F. I loved that you can switch between examine (^C) and follow mode (⇧F).

head, tail & more also interpret escaped sequences. Good news is that you can ditch head and use less in combination with it’s LINES option.

env LINES=10 less file.txt

Here’s a cool use case for less let’s say you have a directory of text files and you quickly want to skim through them.

ls | xargs less --prompt=%x --squeeze-blank-lines

You can navigate with :n to the next file and use --prompt to see the name of the next file which less will open. Prompts are cool, you can use them to display line number, percentage of how much you read from the file, percentage of how many of the files you went through.

man also uses less so learning it’s tricks is a great way to speed up navigating the UNIX documentation.

When using less to read documentation to can jump to a certain chapter by using the --pattern option.

less --help | less --pattern=MOVING

The above will display theless docs starting with the section on “MOVING.”

And finally, as I found out from Gary Bernhardt, using less is also great for doing pretty pagination.

echo long_file.txt | less -FXRS

Let’s break this apart:

  • -F tells less not to page if it doesn’t have more than one page.
  • -X doesn’t clear the screen after exiting.
  • -R is for passing color codes through.
  • And finally -S which chops long lines.
back to blog