Let’s start out with something fun. My favorite Linux commands!
nc (or netcat)
This command is great for testing if a port is open on a server. The -t and -u flags indicate if the TCP or UDP protocol should be used. This example tests if port 80 is open to TCP connections on the google.com server.
I find the tree command very useful. It’s such a neat way to get an overview of a directory.
The tree command has a flag -L that allows you specify the max display depth of the directory tree.
shred is a great way to make sure that a file is “destroyed” when you delete it, making recovery much more difficult.
If you ever find yourself hitting the up arrow and re-running commands, then watch might make your life a lot easier.
For instance, let’s say I want to see the current system timestamp.
This will execute the date command every 2 seconds (default interval is 2 seconds). The interval can be changed with -n <seconds>.
Sometimes you just need to run a program or script once, but at a later time. The at command will do this. at will allow you to queue and schedule jobs.
Here’s an example. Let’s reboot a system at 4 in the morning.