4 Ways I Effectively Use The Mac Terminal

Gyulnara Grigoryan
2 min readMay 14, 2020
Photo by Goran Ivos on Unsplash

Here are four terminal tips I wish I knew when I first started programming.

Displaying the name of the git branch I am working on

Displaying the name of the git branch I have checked out helps me keep track what I am working on as well as prevents me from committing to an unintended branch. l no longer have to run the git branch command to see what branch I have checked out.

Instructions to add this to your terminal:

  1. If you don’t already have a .bash_profile make one: touch ~/.bash_profile . This adds a .bash_profile file to your home directory.
  2. Open this file using any editor and add the following code:
from: https://www.mfitzp.com/article/add-git-branch-name-to-terminal-prompt-mac/

3. Finally, make sure to source ~/.bash_profile or open a new terminal window to see the effects.

Repositioning my cursor

If you use the left and right arrow keys to navigate your terminal command, I have great news for you. There is a way to move the cursor without using the arrow keys. The solution is to simply press the option key while simultaneously moving your mouse and clicking where you would like to move the cursor.

Splitting my terminal window

command + d

Often when programming, I like to preserve the window I am working in and open a new window to test a theory or just check something out. In this case I’ll split my pane using the shortcut command + d.

Opening finder

open .

By using the command open .(notice the trailing dot), I am able to open the working directory in finder. Although, I usually navigate files and folders using the terminal I sometimes find it useful to see a visual of the file structure as it helps provide more context.

--

--

Gyulnara Grigoryan

Software Engineer | Always Learning | interests: coding, photography, piano, writing, reading, and dancing