Return to site

Terminal Shortcuts For Mac

broken image


Open the Terminal (Mac OS X, Linux) or Command Prompt (Windows)in the given directory via context menu or keyboard shortcut.

Keyboard shortcuts in Terminal on Mac. Use these shortcuts to save time when using Terminal. Work with Terminal windows and tabs. New window with same command. New tab with same command. Show or hide tab bar.

Keyboard shortcuts

Open the Terminal in the current directory

  1. From MacOS, go to the  Apple menu and choose 'System Preferences' and then go to the.
  2. This is the Linux shortcut you cannot live without. It will save you so much time in the Linux.
  3. Linux users: You can assign shortcuts for your most frequently used terminal commands. By appending the following line — as many times as you would like — to your bash configuration file.
PlatformKeyboard shortcut
Mac OS Xctrl-cmd-t
Windowsctrl-alt-t
Linuxctrl-alt-t
Mac terminal shortcut key

Open the Terminal in the project directory

PlatformKeyboard shortcut
Mac OS Xalt-cmd-t
Windowsctrl-alt-shift-t
Linuxctrl-alt-shift-t

FAQ

How to open a new tab instead of a new window?

Mac OS X

  1. Open Automator and select Application as new document.
  2. From the Library, add Run Applescript as Automator action.
  3. Replace the sample AppleScript code with the code fromterminal-tab.scpt.
  4. Save the Automator app as TerminalTab.app to your Applications folder.
  5. In the open-terminal-here settings, set Command toopen -a TerminalTab.app '$PWD'.

Ubuntu Linux

  1. Install xdotool:
    sudo apt-get install -y xdotool
  2. Download terminal-tab.sh and make it executable:
    chmod +x ./terminal-tab.sh
  3. Move the script to a directory in your path:
    sudo mv ./terminal-tab.sh /usr/local/bin/terminal-tab
  4. In the open-terminal-here settings, set Command toterminal-tab.

You know what sets apart a pro user from a regular user? Mastery over the keyboard shortcuts.

Alright! That's not the only thing but it is undoubtedly a factor.

Shortcuts help you to be more productive and efficient with whatever tool you use. Just think about it. If someone holds the mouse all the way down to copy entire text instead of Ctrl+A, how would you feel about it?

Linux terminal is not an exception. There are certain Linux terminal shortcuts that every user must know and practice.

Trust me; once you master these shortcuts, you'll notice how good you are with using the Linux command line.

Must Know Linux Shortcuts

I would like to mention that some of these shortcuts may depend upon the Shell you are using. Bash is the most popular shell, so the list is focused on Bash. If you want, you may call it Bash shortcut list as well.

Do note that I have used the capital letters in the keyboard shortcuts but this does NOT mean that you have to press the shift key while using these shortcuts.

1. Tab

This is the Linux shortcut you cannot live without. It will save you so much time in the Linux command line.

Just start typing a command, filename, directory name or even command options and hit the tab key. It will either automatically complete what you were typing or it will show all the possible results for you.

If you could only remember one shortcut, this would be the chosen one.

2. Ctrl + C

These are the keys you should press in order to break out of a command or process on a terminal. This will stop a running program immediately.

If you want to stop using a program running in the foreground, just press this key combination.

3. Ctrl + Z

Terminal Shortcuts For Mac

This shortcut will send a running program in the background. Normally, you can achieve this before running the program using the & option but if you forgot to do that, use this key combination.

4. Ctrl + D

This keyboard shortcut will log you out of the current terminal. If you are using an SSH connection, it will be closed. If you are using a terminal directly, the application will be closed immediately.

Consider it equivalent to the ‘exit' command.

5. Ctrl + L

How do you clear your terminal screen? Macbroidery embroidery lettering software for mac os. I guess using the clear command.

Instead of writing C-L-E-A-R, you can simply use Ctrl+L to clear the terminal. Handy, isn't it?

6. Ctrl + A

This shortcut will move the cursor to the beginning of the line.

Suppose you typed a long command or path in the terminal and you want to go to the beginning of it, using the arrow key to move the cursor will take plenty of time. Do note that you cannot use the mouse to move the cursor to the beginning of the line.

This is where Ctrl+A saves the day.

7. Ctrl + E

This shortcut is sort of opposite to Ctrl+A. Ctrl+A sends the cursor to the beginning of the line whereas Ctrl+E moves the cursor to the end of the line.

Note: If you have the Home and End keys on your keyboard, you can also use them. Home is equivalent to Ctrl +A and End is equivalent to Ctrl + E.

8. Ctrl + U

Typed a wrong command? Instead of using the backspace to discard the current command, use Ctrl+U shortcut in the Linux terminal. This shortcut erases everything from the current cursor position to the beginning of the line.

9. Ctrl + K

This one is similar to the Ctrl+U shortcut. The only difference is that instead of the beginning of the line, it erases everything from the current cursor position to the end of the line.

10. Ctrl + W

You just learned about erasing text till the beginning and the end of the line. But what if you just need to delete a single word? Use the Ctrl+W shortcut.

Using Ctrl+W shortcut, you can erase the word preceding to the cursor position. If the cursor is on a word itself, it will erase all letters from the cursor position to the beginning of the word.

The best way to use it to move the cursor to the next space after the targetted word and then use the Ctrl+W keyboard shortcut.

11. Ctrl + Y

Mac Terminal Commands Cheat Sheet

This will paste the erased text that you saw with Ctrl + W, Ctrl + U and Ctrl + K shortcuts. Comes handy in case you erased wrong text or if you need to use the erased text someplace else.

12. Ctrl + P

You can use this shortcut to view the previous command. You can press it repeatedly to keep on going back in the command history. In a lot of terminals, the same can be achieved with PgUp key.

13. Ctrl + N

You can use this shortcut in conjugation with Ctrl+P. Ctrl+N displays the next command. If you are viewing previous commands with Ctrl+P, you can use Ctrl+N to navigate back and forth. Many terminals have this shortcut mapped to the PgDn key.

Bonus shortcut: Ctrl + R to search in command history

Mac Terminal Command Shortcut

You typed some command but cannot remember what it was exactly? Meet Ctrl + R.

Mac terminal shortcut key

This keyboard shortcut allows you to perform a search in your command history. Just press Ctrl+R and start typing. It will show the last command that matches the string you typed. Note that the typed string could be anywhere in the command. How cool is that?

If you want to see more commands for the same string, just keep pressing Ctrl + R.

Terminal Shortcuts For Mac Shortcut

You can press enter to run the command selected or press Esc to come out of the search with the last search result.

Terminal shortcuts for mac os

Open the Terminal in the project directory

PlatformKeyboard shortcut
Mac OS Xalt-cmd-t
Windowsctrl-alt-shift-t
Linuxctrl-alt-shift-t

FAQ

How to open a new tab instead of a new window?

Mac OS X

  1. Open Automator and select Application as new document.
  2. From the Library, add Run Applescript as Automator action.
  3. Replace the sample AppleScript code with the code fromterminal-tab.scpt.
  4. Save the Automator app as TerminalTab.app to your Applications folder.
  5. In the open-terminal-here settings, set Command toopen -a TerminalTab.app '$PWD'.

Ubuntu Linux

  1. Install xdotool:
    sudo apt-get install -y xdotool
  2. Download terminal-tab.sh and make it executable:
    chmod +x ./terminal-tab.sh
  3. Move the script to a directory in your path:
    sudo mv ./terminal-tab.sh /usr/local/bin/terminal-tab
  4. In the open-terminal-here settings, set Command toterminal-tab.

You know what sets apart a pro user from a regular user? Mastery over the keyboard shortcuts.

Alright! That's not the only thing but it is undoubtedly a factor.

Shortcuts help you to be more productive and efficient with whatever tool you use. Just think about it. If someone holds the mouse all the way down to copy entire text instead of Ctrl+A, how would you feel about it?

Linux terminal is not an exception. There are certain Linux terminal shortcuts that every user must know and practice.

Trust me; once you master these shortcuts, you'll notice how good you are with using the Linux command line.

Must Know Linux Shortcuts

I would like to mention that some of these shortcuts may depend upon the Shell you are using. Bash is the most popular shell, so the list is focused on Bash. If you want, you may call it Bash shortcut list as well.

Do note that I have used the capital letters in the keyboard shortcuts but this does NOT mean that you have to press the shift key while using these shortcuts.

1. Tab

This is the Linux shortcut you cannot live without. It will save you so much time in the Linux command line.

Just start typing a command, filename, directory name or even command options and hit the tab key. It will either automatically complete what you were typing or it will show all the possible results for you.

If you could only remember one shortcut, this would be the chosen one.

2. Ctrl + C

These are the keys you should press in order to break out of a command or process on a terminal. This will stop a running program immediately.

If you want to stop using a program running in the foreground, just press this key combination.

3. Ctrl + Z

This shortcut will send a running program in the background. Normally, you can achieve this before running the program using the & option but if you forgot to do that, use this key combination.

4. Ctrl + D

This keyboard shortcut will log you out of the current terminal. If you are using an SSH connection, it will be closed. If you are using a terminal directly, the application will be closed immediately.

Consider it equivalent to the ‘exit' command.

5. Ctrl + L

How do you clear your terminal screen? Macbroidery embroidery lettering software for mac os. I guess using the clear command.

Instead of writing C-L-E-A-R, you can simply use Ctrl+L to clear the terminal. Handy, isn't it?

6. Ctrl + A

This shortcut will move the cursor to the beginning of the line.

Suppose you typed a long command or path in the terminal and you want to go to the beginning of it, using the arrow key to move the cursor will take plenty of time. Do note that you cannot use the mouse to move the cursor to the beginning of the line.

This is where Ctrl+A saves the day.

7. Ctrl + E

This shortcut is sort of opposite to Ctrl+A. Ctrl+A sends the cursor to the beginning of the line whereas Ctrl+E moves the cursor to the end of the line.

Note: If you have the Home and End keys on your keyboard, you can also use them. Home is equivalent to Ctrl +A and End is equivalent to Ctrl + E.

8. Ctrl + U

Typed a wrong command? Instead of using the backspace to discard the current command, use Ctrl+U shortcut in the Linux terminal. This shortcut erases everything from the current cursor position to the beginning of the line.

9. Ctrl + K

This one is similar to the Ctrl+U shortcut. The only difference is that instead of the beginning of the line, it erases everything from the current cursor position to the end of the line.

10. Ctrl + W

You just learned about erasing text till the beginning and the end of the line. But what if you just need to delete a single word? Use the Ctrl+W shortcut.

Using Ctrl+W shortcut, you can erase the word preceding to the cursor position. If the cursor is on a word itself, it will erase all letters from the cursor position to the beginning of the word.

The best way to use it to move the cursor to the next space after the targetted word and then use the Ctrl+W keyboard shortcut.

11. Ctrl + Y

Mac Terminal Commands Cheat Sheet

This will paste the erased text that you saw with Ctrl + W, Ctrl + U and Ctrl + K shortcuts. Comes handy in case you erased wrong text or if you need to use the erased text someplace else.

12. Ctrl + P

You can use this shortcut to view the previous command. You can press it repeatedly to keep on going back in the command history. In a lot of terminals, the same can be achieved with PgUp key.

13. Ctrl + N

You can use this shortcut in conjugation with Ctrl+P. Ctrl+N displays the next command. If you are viewing previous commands with Ctrl+P, you can use Ctrl+N to navigate back and forth. Many terminals have this shortcut mapped to the PgDn key.

Bonus shortcut: Ctrl + R to search in command history

Mac Terminal Command Shortcut

You typed some command but cannot remember what it was exactly? Meet Ctrl + R.

This keyboard shortcut allows you to perform a search in your command history. Just press Ctrl+R and start typing. It will show the last command that matches the string you typed. Note that the typed string could be anywhere in the command. How cool is that?

If you want to see more commands for the same string, just keep pressing Ctrl + R.

Terminal Shortcuts For Mac Shortcut

You can press enter to run the command selected or press Esc to come out of the search with the last search result.

Try it and be amazed.

What's your favorite Linux terminal shortcut?

If you would like to learn a few more Linux terminal tricks, you may watch this video to unearth hidden command line gems:

Open Terminal Mac Shortcut

I have shared my favorite terminal shortcuts. What are some of your favorite Linux shortcuts? If you have one (or more), why not share it with the rest of us in the comment section?

Become a Member for FREE

Mac Terminal Shortcut Key

Become a member to get the regular Linux newsletter (2-4 times a month) and access member-only content

Join the conversation.





broken image