Home > linux > Super commands for Unix beginners and veterans!

Super commands for Unix beginners and veterans!

As a sysadmin of many years, I’m always fascinated by the world of *Unix and the untapped commands and tricks that are still there that I haven’t found out yet.  There are numerous ways to do something quicker, easier and more efficiently if a sysadmin knows where to look.

In this article, we’re listing the top most useful commands that any sysadmin should know and use when troubleshooting or in general working around their way in a Linux or Unix environments in general.

This command allows you to save a file you edited in VI without the needed permission for that file:

$ :w !sudo tee %

An alternative to traceroute or ping command on Linux is to run mtr:

$ mtr yahoo.com

Ever wanted to execute a command without saving it in history?  Here we go:

$ <space>who  (This will run the ‘who’ command without it being recommended in your history file).  Set your PS1=” ” to do it automatically by prepending space.

Ever found your screen or garbled up and you end up closing session and logging back in?  Well dont’ do that! Just type:

$ reset

To capture your activity on Linux desktop just type:

$ ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/wow.mpg

Want to reverse tunnel?  Here is how you start a tunnel from some external site’s port 80 to your local server port 8001.  You can then hit that site via http://localhost:8001

$ ssh -N -L2001:localhost:80 blah.com

Just a single job around 8PM, better than a cron:

$ echo “who;ps -eaf” | at 8pm

Now, for one of the most helpful if not the most helpful command that’ll allow you to bind port to a process ID…perhaps better than lsof:

$ netstat -tlnp

Ever wanted to tweet from shell?  Perhaps you want to alert your twitter that your service is down?

$ curl -u user:pass -d status=”I am tweeting nigga!” http://twitter.com/statuses/update.xml

Run your website all in memory, here is how:

$ mount -t tmpfs tmpfs /data/blah.com -o size=10g  (Assuming you have at least 10g on server to spare, you now have a new partition to which you can copy your website to)

How about a secure mount via SSH?  First download SSHFS and then:

$ sshfs user@server:/path/to/mount/from /path/to/mount/point

 

There is more!

Categories: linux Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.