iTerm Tricks

by damonp on September 14, 2005

in Apple / Mac,SysAdmin

Marc Liyanage posted a script to open a new Terminal window in a specified directory or run a specified command.

What it does is open up a new Terminal window and execute the arguments as command in that new window. When no arguments are given, it opens the new window in the current directory, which means it acts like a “clone” operation for the frontmost window. This is useful if you’re in some deeply nested directory and you need a second window right there. This way you don’t have to copy/paste or type the directory path.

I modified the script slightly to interface with iTerm, opening a new default session instead of a new window.

Download the file, place somewhere in your path, and make sure its executable.

Examples:
Open a second iTerm session in the current directory.

term

Open a second iTerm session in my home directory.

term ~

Open a second iTerm session and start editing my .bashrc file.

term vi ~/.bashrc

Open a second iTerm session in the current directory and start editing filename.

term vi <em>filename</em>

Open a second iTerm session in the current directory (presumably /var/log/httpd) and start following the error_log file using tail.

term tail -f error_log

Popularity: 9%

Most Popular Posts

Damon Parker is a freelance sysadmin and web developer in Texas. He specializes in server setup, server security and high performance server configurations. Need help setting up a web server or getting a server back online after a crash or hack? Email Damon

Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: