Linux commands that make me happy

Ok, so at work I started writing a “Linux command of the day” on a whiteboard that was vacant. Some of them are pretty cool so I thought I would show them here.

Some of them are pretty elementary to linux gurus but I’ve been using linux almost exclusively for 2 years and some of these were new to me. This is probably because I’ve been using mostly gnome and am not fully dependant on the CLI.

1. $ sudo !!
What this does is run whatever the last command you typed with sudo in front of it. Very cool, I know I’ve typed some long command before and forgot to add sudo to it. This makes those mistakes a lot easier to deal with. (I got this from hak5.org…good web show).

2. $ route -n
I felt ashamed for not knowing this one but it will help you find what your gateway ip is.

3. $ nmap -v -O ipaddress
Ok this isn’t really a build in command but if you have nmap installed this gives you a port scan and OS information from an IP address.

  • decoy

    I’ve been meaning to do a post like this for a bit. My favorite command has to be find. You can do tons of stuff with find including more safe versions of chmod/chgrp -R, rm -r, etc.

  • http://www.daspecster.com Tom Schultz

    Post it man!

  • http://stevenoxley.blogspot.com/ Steve Oxley

    FYI, ‘!!’ is actually whatever the last thing you typed into the command line is.

    For example (stupid examples, but examples nonetheless), let’s say you type in the directory you want to go to, but forgot to type ‘cd’:

    $ directory1
    $ cd !!

    That will get you what you want. Or lets say you typed in cd but forgot the directory (of course, cd without an argument will take you to your home directory, but let’s say you’re already there):

    $ cd
    $ !! directory1

    Will get you what you wanted. Stupid examples, but it shows the power of it.

  • decoy

    Yet again another nifty trick that works in bash but not ksh (where I spend 90% of my time now :[ ).