Archive for December 5th, 2008
I was recently asked how to change screens working directory. It took me a few minutes to realize the benefit of this as I typically have different screen sessions for different purposes. But after thinking about it for a few minutes I have been in situations where what I was doing in a screen session morphed and it would have been nice for new windows to be opened to a different working directory than where I started my session.
A few minutes of grepping around in man -a screen gave the answer.
C-a:chdir /path/to/new/dir
This is lifted from http://bashcurescancer.com/shell-function-which-webserver-does-that-site-run.html.
Handy shell function you can put in your .bashrc. Quickly find out what server a host is running.
what-http-server() { curl -s -I $(for h in "$@"; do printf "http://%s " "$h"; done) | awk -F': ' '/^Server:/ {print $2}'; }
Now try what-http-server kernel.org google.com hotmail.com.