How to use and generate SSH keys
I’ve covered how to create them here, but you should know how to create distrubute, and change ssh keys. This will make it easier to discuss access to production servers with your ops team, and likely make it easier when you use things like Github.
How to use |
If you’ve used unix for sometime, you might be familar wih this. The pipe or | can be used to send the output from one process to another. Here’s a good example of its usage:
How to use tar
Tar is one of those basic unix commands that you need to know. Its the universal archiving tool for *nix systems(similar to Zip for windows). You should know how to create an archive and expand an archive. I’m only covering this with compression enabled, if you don’t have gzip, or don’t want it ommit the z option.
The file command
File is magic. It will look at a file and give you its best guess as to what it is. Usage is:
The strings command
Ever want to read the strings from a binary file? The strings command will do this for you. Just run “strings ” and you’ll get a dump of all the strings from that file. This is particularly useful when looking for strings in old PCAP files, or if a binary file has been tampered with.
How to use grep
Grep can be used to extract a lines of text from a file or stream matching a particular pattern. This is a really rich command, and should have a whole article dedicated to it. Here are some very simple use cases.
To match a pattern:
To pull all lines not matching a pattern:
How to count lines in a file
The wc commands will count the lines, words, and bytes in a file. The default options will return all three, if you ony want to count the lines in a file, use the -l option that will output only the lines in a file. Here is an example:
Count the unique occurrences of something
It might seem like its out of the reach of bash, but you can do this with a simple one liner. You just need to type:
This counts all the unique line occurrences, and then sorts them numerically.
Following the output of a file with tail
Tail is a very useful command; it will output the last 10 lines of a file by default. But sometimes you need to want to continiously watch a file. Fortunately tail can solve this for you. The -f option will print new lines as they’re added. Example:
I’ll follow this up a week from now, with more linux for devs. Hopefully you found this useful.