QA Graphic

iTerm2 Shortcuts

Use Keyboard Shortcuts to replace common copy and paste

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.

i Term Screen Shot2020

iTerm2 KeyMapping

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.

Examples

  • 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

i Term2 Steps Keys
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.

  1. Open iTerm2
  2. Type Command , to open up Preferences
  3. Select the Profiles on the Top
  4. Select a Profile Name in the left panel
  5. Then Select the ‘Keys' sub menu
  6. Click the ‘+' under the row of "Key Mappings"
  7. Click on the "Click to Set" and define your hot key
  8. 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."

 

About

A Mac veteran since 1989, I'm here to share my experience with tips and tricks every Friday. Witnessing the evolution of Mac software and hardware firsthand, I've gained a deep understanding of how these machines work and can help you troubleshoot any issues that may come up.

Schedule

ThursdayGluten Free
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
TuesdayQA
WednesdayKeyboard Maestro