Posts Tagged ‘howto’
Cool GNU Screen Helper Functions
I’m a big fan of using GNU Screen, a terminal multiplexer. At any given time, I could be interacting with a dozen different Unix servers at work. I therefore group servers into logical, named groups and jump back and forth between them using screen.
I find the following one-liner functions to be incredibly helpful to me when it comes to managing multiple screen sessions simultaneously. Hopefully someone else will also benefit from them. I currently run these one-liners using the Bash shell, and store them in my ~/.bashrc file. Each function should be runnable from a shell prompt.
getscreenpids
function getscreenpids() { ps auxww | grep screen | grep -v grep | awk '{print $2}'; }
This function simply returns a list of process id’s (pid’s) for each screen process. This is nice info to have if you want to kill a screen session, since each session uses it’s own screen process.
clearscreen
function clearscreen() { for pid in $(getscreenpids); do kill -9 $pid; done; screen -wipe; }
This function kills every screen session into which I am logged. This is nice if things get flaky and I just want to kill all of my screen processes quickly.
killscreen
function killscreen() { screen -ls | grep $1 | awk '{print $1}' | cut -f1 -d. | xargs kill -9; screen -wipe; }
This function kills every screen session that uses the title that you pass as the first parameter. So if you have one or more screen sessions titled “envA”, and you pass that string to this function, all of those screen sessions will be killed.
Good Java Resources
I’ve been using Java since 2000 for a variety of tasks, mostly related to software administration and maintenance. A common request from co-workers and some of my geekier friends is a list of recommended resources for Java training.
I’ve built this list a couple of times, and I keep losing the old lists, so I thought that I would put it on my wiki so it would be a little more permanent. I hope that a few people find it helpful.
Dead-Tree Book Resources
- Just Java – The Java bible. No matter what you do with Java, you’ll need this book eventually. Not only is it very informative, it is entertaining and very well written. It’s one of those truly excellent technical books that you see so very rarely in a jungle of crap.
- Sun Certified Programmer & Developer for Java 2 Study Guide – The only book you’ll really need to become a Sun Certified Java Programmer. Also very well written.
- Head First Java – I haven’t actually read this book, but I’ve heard wonderful things about it from multiple sources, and it was written by the same authors of the previous bullet point. I look forward to reading the other books from the succesful Head First series.
- Core Servlets and Javaserver Pages – A good book for learning the basics of JSP’s and servlets. I recommend checking this book out from the library because it’s a fairly quick read. Another cool thing about this book is that there are a lot of excerpts available at http://www.coreservlets.com. Definitely check out the web site if you’re interested in this book.
Online Book Resources
- How To Think Like A Computer Scientist – This is a good, free start to programming with Java.
- Thinking in Java – This is an excellent free book for programming in Java. It’s quite possibly the best free programming book available for any language.
Web Sites
- JavaRanch – I highly recommend this web site if you are a beginning Java programmer. I feel that the following sections are particularly good:
- Forum – I received some great support from this forum on numerous occasions, but it was especially useful when I was studying for the SCJP test.
- Campfire Stories – Tutorials and tips
- Bunkhouse – The best place for unbiased reviews of Java books.
- Cattle Drive – I am a former pupil in their Cattle Drive class, and found it to be a very good educational value for beginners.
- Roedy Green’s Java & Internet Glossary – His exception page is my favorite place to go when I’m stuck on a particular error and need a little guidance. Also, it includes a treasure trove of documentation and tutorials to help you with most basic tasks. It’s an absolutely essential resource.
Note: Please note that I linked to Amazon for all of the books listed above, but I’m not getting a kickback for doing so. You should be able to find a lot of these books at your local library, and they should all be available from discount book sites such as half.com.
Good luck and have fun!

