Catch up on stories from the past week (and beyond) at the Slashdot story archive


Forgot your password?
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 Internet speed test! ×

Comment Various useful commands I use daily. (Score 1) 2362

Here's some very handy commands. I use most, if not all, of these on a regular basis.
$ namei -m /var/log/httpd/error.log
f: /var/log/httpd/error.log
drwxr-xr-x /
drwxr-xr-x var
drwxr-xr-x log
drwxr-xr-x httpd
-rw-r--r-- error.log

Substitute a string in a variable in bash.
$ version="6.4.4-5"
$ echo ${version%%-[0-9]*}

Exclude all the .svn files in a find, and look for a pattern in the results.

find $1 -name '.svn' -prune -o -print | xargs grep -l "$2"

Perl oneliner to convert an epoch to the current date/time.

perl -le 'print scalar(localtime("1223234245"))'

I also started doing a lot of work in Ruby last year after hearing about, and deploying at the company I worked for, a configuration management tool called Puppet. Along with Ruby scripting, I've come to love two excellent tools: rake and capistrano. The quick version, rake is a "make" for Ruby. It will execute shell commands and can do all kinds of awesome. Capistrano was originally written to aid in deploying Rails applications on multiple systems, and has also become a sort of glorified "ssh for loop" since it uses Ruby's Net::SSH class.

Comment Re:SSH (Score 1) 2362

Don't set up ssh keys without passphrases unless absolutely necessary*. Use an ssh-agent to store the private keys. There's automated methods for this on every major platform.

  • Linux, ssh-agent and ssh-add. The man pages are complete, and automating this is easy in the shell. Alternately GNOME users can use Seahorse to tie the ssh keys into the login keychain.
  • Mac OS X, ditto ssh-agent/ssh-add, or use, which will add the keys and passphrase to the login keychain as well.
  • Windows, if you're using SSH on Windows, its puTTY, and you should already have the putty agent installed from the installer. You used the installer right?

*Necessary would be for automated application processes that need to ssh to systems without user intervention.

Slashdot Top Deals

"Catch a wave and you're sitting on top of the world." - The Beach Boys