StellarTech Blog

Tag: cli

Case of the missing MOTD file.

by Glen on Jan.06, 2009, Tags: , ,

Have you ever setup a cool /etc/motd on your Ubuntu installation just to see it vanish after a reboot? We don’t need Scooby and the gang to solve this mystery since it’s obviously a start-up script.

Here some cli medicine to make things all better:
touch /etc/motd.static && rm -f /etc/motd; ln -s /etc/motd.static /etc/motd

By default /etc/motd is symlinked to /var/run/motd which is rebuilt by /etc/init.d/bootmisc.sh every time you reboot.

Leave a Comment :, , more...

Grep For Windows

by Glen on Dec.27, 2008, Tags: ,

It is fairly common knowledge among IT professionals that the Windows command line is fairly weak. While PowerShell looks promising it will not be installed by default until Windows Server 08 R2.

It’s alright though since the CLI in Windows isn’t as shabby as it is obscure. Take for example findstr and find. While not as powerful as it’s nix big brother ‘grep’, findstr does a fairly good job and even support regexp. Here are a few handy examples of both commands in action:

finding possible ddos attack to port 80:
netstat -ano | sort /+33 | find ":80 " | more

grep -Rli findme *
findstr /sim findme *

The useful grep -v
netstat -ano | findstr -v "127.0.0.1"

finding a service name (I can never remember windows service names)
sc query | findstr /i "^service_name.*wua"

Leave a Comment :, more...

Adding a Hyphen to su

by Glen on Jun.05, 2008, Tags: ,

I’ve noticed some of the technicians I work with add the hyphen to the end of the ’su’ command and some do not. I am one of those that do not do this. Why type an extra character? To my suprise I’ve actually been doing more typing by leaving off that little hypen. The hyphen sets you up in root’s enviroment instead of the previous users. No more having to manually prefix commands with ‘/sbin/’. Woo hoo. The things I get excited about.

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!