iTerm2 is a very popular replacement application for Apple's Terminal. The application makes using terminal services a lot more productive. One great tool is the Key Mapping.
If your copying/pasting the same commands every time you open up iTerm2, you should know about the Key Mapping functionality. You can easily set up keyboard short cuts to perform some common commands.
- ps -ef | grep chrome ## Show active processes
- tar -cvf- . | gzip -9 > files.tar.gz ## Tar and Compress the current directory
- bbedit /etc/hosts ## Change the local host file
- su - apachectl restart ## Restart apache
- mysqldump website >mysql-backup.sql # Quickly Backup the mysql database
- sudo -u company /home/company/.virtualenvs/dev-ppc-two/bin/python run_report.py
Follow the steps below to put your own KeyMapping
Setting up the KeyMapping
It's really easy to set up KeyMapping. You do it for each profile. Which makes it great as you may have different commands for each server that you are connecting to.
- Open iTerm2
- Type Command , to open up Preferences
- Select the Profiles on the Top
- Select a Profile Name in the left panel
- Then Select the ‘Keys' sub menu
- Click the ‘+' under the row of "Key Mappings"
- Click on the "Click to Set" and define your hot key
- Under the Action Menu scroll and search for "Send Text"
As you can see there are a lot of action items. iTerm has a nice document of all the capabilities that you can do. Some tricks you can do:
- Quickly open up a profile that is tailing the error log file using the "Split Horizontally with Profile."
- Switch between live and dev sites using the "Change Profile" action.
- Search for ‘Errors' and ‘Warnings' that you may have missed using the "Find Regular Expression.."
- Check out various AWS instances by opening the profile in a new tab via "New Tab with Profile."
Add your Comments
Feel free to leave a comment about this post.