The ssh_config file.
Working in an environment with hundreds of SSH servers, one appreciates the value a good ssh_config file. I use an ssh_config file to specify specific usernames for certain hosts, as well as specifying a keepalive interval, to prevent my session from timing out.
I use the following options:
Host hostname HostName hostname (can be an IP) User username ServerAliveInterval 60 (sends keepalive every 60 seconds)
For further info check out the good old man ssh_config.
How to zero out a file in Linux
Ever need to quickly clear a file out in Linux? Maybe a log file that is growing out of control? Rather than delete it, try this:
[dacaprice@fedora10 ~]$ > /var/log/messages
Now your messages file is empty, and the file retains its permissions.
Securely delete files in linux
I often use shred in linux, when deleting anything sensitive. Any way I've used it has always been pretty simple and straight forward (ie shred -uvz filename). Today I sold my old cell phone with microSD card on eBay and I wanted to get all of my data off securely. Unfortunately, it seems shred does not know how to handle directories. A little googling found me this:
find -type f -execdir shred -uvz '{}' \;
The find command lists every file in your present working directory and subdirectories and executes the shred command on it. I finished up with an rm -rf * to delete any remaining directories and I was then comfortable sending the card out with the phone.
What is the “total” in ls -l ?
Today I had a bit of a brain fart. I might run 'ls -l' in my terminal 100 times a day and today I'm looking the output and asked what is that "total" actually mean?
[dacaprice@fedora10 ~]$ ls -l
total 54752
drwxrwxr-x 2 dacaprice dacaprice 4096 2009-06-02 22:26 bin
-rwxr-xr-x 1 dacaprice dacaprice 291106 2007-12-13 21:03 a.html
Straight from gnu.org, "for each directory that is listed, preface the files with a line `total blocks', where blocks is the total disk allocation for all files in that directory."