DEV Community

George K.
George K.

Posted on

Pimping up your Mac terminal with 5 basic steps

I'd like to chime in with my two cents, it's all about terminal this time. This stuff really helps me and maybe will work great for you too.

1: Oh My Zsh –– https://ohmyz.sh β€” you can set it up with plugins you want to do things much faster in the terminal, my favourites are:
gaa instead of git add .
gcmsg 'amazing commit' instead of git commit -m 'amazing commit'
and of course gp instead of git push πŸ˜‚

2: Another terminal upgrade is npm package git open –– https://www.npmjs.com/package/git-open –– once installed from any local repo run this command and it will open up the current repo url in the browser. Me like it.

3: Making shortcuts for terminal commands you run every day. For example, I start the curriculum app every day and it is in some specific folder, so instead of going into this folder and running npm start from there I've created a shortcut so that I can now run startcur –– my custom command –– from anywhere in the terminal and it will go into this particular folder and execute npm start from there. The way it works is that you need to open ~/.bash_profile file on Mac and add shortcut there, for example like this:

export PATH=/usr/local/bin:$PATH
alias startcur='open -a "Google Chrome" http://localhost:13666 && cd /Users/you/path && npm start'
Enter fullscreen mode Exit fullscreen mode

And once changed do not forget to reload your bash profile by running source ~/.bash_profile

4: When creating a new git repo in the terminal with git init you can also create a remote repo from the same terminal! After git init, git add . and git commit -m 'banana' run

git push --set-upstream https://gitlab.com/YOUR_GITLAB_USERNAME/NAME_OF_NEW_REPO.git master
Enter fullscreen mode Exit fullscreen mode

It will create the remote repo and also push your commit there to the master branch.

5: I like all of my terminal windows to be in tabs so that essentially I have one terminal open and all the different processes are in separate tab -- imho it's easier to navigate and keep track of all open windows. To do this in Dock Preferences you can choos "Always" for "Prefer tabs when opening documents" selector and new new terminal windows including ones opened with cmd+N will go into a new tab instead of window.

Extra:
Checking hidden/system folders in terminal is easy with ls -A and displaying them in Finder could be activated with defaults write com.apple.Finder AppleShowAllFiles TRUE from your terminal.

Top comments (0)