sed as a superman, the unix stream editorHi all! Here's the next cheat sheet I've created - cheat sheet of sed, the Superman of stream editing. It has come handy 101 times for me because sed is not what I use daily and after some time of not using the sed commands tend to fade away from my mind and I have to review them quickly. This cheat sheet is ideal for that.

You can't really be a good hacker if you don't know this tool. I always love to think of various situations where knowing many, many different tools makes you the ultimate guru.
Suppose you had a situation where you were on a box which had some problems and the only tool available to you was sed, and you had to fix a configuration file problem really quickly or bad, bad things would happen. If you never knew sed, you'd be in deep trouble because it can't be learned from the man page, because it only lists all the commands and you have no understanding how the commands work.

When I first learned sed, I remember the joy when I understood how it worked, that it operated on input stream, output stream, pattern space and hold buffer. Once you know this, the rest can be understood from the man page, but before that, I doubt it.

If you want to learn the sed editor I recommend this wonderful tutorial and these books.

This sed cheat sheet contains:

  • command line summary
  • command description, if they take single address or pattern, or a range of addresses, and what they modify (input stream, output stream, pattern space or hold buffer)
  • command line argument summary
  • extensions
  • short summary of adderss range format

Download Sed Stream Editor Cheat Sheet

PDF document: sed.stream.editor.cheat.sheet.pdf

Plain text (.txt): sed.stream.editor.cheat.sheet.txt

MS Word (.doc): sed.stream.editor.cheat.sheet.doc

If you notice any inaccuracies, mistakes or see that I have left something out, please let me know. See you next time!