Master Keyboard Shortcuts

30 Oct 2023

In this post, I will be sharing why you should ditch the mouse and take the time to pick up and master keyboard shortcuts.

As a software engineer, efficiency is of the essence, especially when dealing with many mundane tasks and/or meeting tight deadlines. For any work setup, majority of the time is spent moving between the keyboard and mouse.

Fortunately for us, this precious time can be saved by learning keyboard shortcuts that can perform the same functions.

Below is a compilation of shortcuts (Mac and Windows) that I will recommend for speeding up your workflows in web browsers, the Terminal and VSCode.

Shortcuts (Mac)

Basic

Command + A                             Select all                                                          
Command + C                             Copy                                                                
Command + F                             Find keyword                                                        
Command + Option + F                    Replace keyword                                                     
Command + Q                             Close application                                                   
Command + S                             Save                                                                
Command + V                             Paste                                                               
Command + W                             Close active window                                                 
Command + X                             Cut                                                                 
Command + Z                             Undo                                                                
Command + `                             Toggle between application windows                                  
Command + Shift + Z                     Redo                                                                
Command + Ctrl + F                      Fullscreen                                                          
Command + Up/Down                       Move cursor to start/end of document                                
Command + Left/Right                    Move cursor to start/end of line                                    
Command + Option + D                    Show Dock                                                           
Command + Option + Space                Open Finder                                                         
Command + Mission Control               Show/Hide opened apps                                               
Command + Shift + 3                     Print full screen                                                   
Command + Shift + 4                     Select area and print screen of selected area                       
Command + Shift + 5                     Screen recording                                                    
Command + Shift + Up/Down               Select all characters from cursor to the top/bottom of the document 
Command + Shift + Left/Right            Select all characters left/right of the cursor                      
Command + Space + 'Type your search'    System search                                                       
Command + Tab                           Toggle applications                                                 
Ctrl + Up                               View all applications from desktop                                  
Shift + Up/Down                         Select characters above/below the line                              
Shift + Left/Right                      Select characters left/right of the cursor                          
Option + Up/Down                        Move current line above/below it                                    
Option + Left/Right                     Move cursor to the start/end of words

Browser

Comamnd + D                                     Bookmark current tab                      
Command + L                                     Move cursor to address bar                
Command + R                                     Reload page                               
Command + T                                     Open new tab                              
Command + W                                     Close active tab                          
Command + Shift + T                             Open recently closed tab                  
Command + Shift + W                             Close all active windows                  
Command + Left/Right                            Navigate to previous/next page in history 
Control + Tab OR Command + Option + Left/Right  Toggle between tabs                       
F12                                             Open web console

VSCode

Command + L                               Select line                                                  
Command + P                               Search for file                                              
Command + N                               Work on a new file                                           
Command + W                               Close active tab                                             
Command + Shift + F                       Find keyword in directory                                    
Command + Shift + K                       Delete line                                                  
Command + Shift + P                       Open command palette                                         
Command + Shift + V                       Preview Markdown file on the side                            
Command + Option + Up/Down                Add cursors to multiple lines at the same horizontal positon 
Command + Option + Left/Right             Toggle tabs                                                  
Command + \                               Split code editor/Terminal                                   
Command + /                               Comment line of code                                         
Ctrl + `                                  Open/close Terminal in code editor                           
Ctrl + Shift + `                          Open new Terminal in code editor                             
Option + Shift + Up/Down                  Copy and paste current line above/below it                   
Option + Shift + Left/Right               Select words to the left/right of the cursor                 
`Select keyword` + Command + D            Add cursor to all found keywords one at a time               
`Select keyword` + Command + Shift + L    Add cursor to all found keywords

Bash/Terminal

Command + D                            Split Terminal vertically                                                         
Command + Shift + D                    Split Terminal horizontally                                                       
Command + T                            Open new Terminal tab                                                             
Command + W                            Close active Terminal tab                                                         
Command + Shift + W                    Close all active Terminal tabs in the same session                                
Command + Left/Right                   Toggle between Terminal tabs                                                      
Command + Option + Up/Down/Left/Right  Toggle between split Terminals in the same tab                                    
Command + Shift + I                    Broadcast input to multiple Terminal tabs in the same session (iTerm) 
Ctrl + A                               Move cursor to start of line                                                      
Ctrl + E                               Move cursor to end of line                                                        
Ctrl + H                               Clear character before cursor position                                            
Ctrl + D                               Clear character after cursor position                                             
Ctrl + U                               Clear line before cursor position                                                 
Ctrl + K                               Clear line after cursor position                                                  
Ctrl + L OR `clear` OR `cls`           Clear screen                                                                      
Ctrl + W                               Delete previous word                                                              
Ctrl + C                               Cancel program                                                                    
Ctrl + Z                               Stop program                                                                      
`history`                              Show history of commands                                                          
Option + Left/Right                    Move cursor between words                                                         
Up/Down                                Cycle history of commands

Shortcuts (Windows)

Basic

Alt + F4                             Close active window                                                 
Alt + Tab                            Toggle applications/View all applications from desktop              
Alt + Shift                          Change Language/Keyboard                                            
Alt + Shift + Up/Down                Move current line above/below it                                    
Ctrl + A                             Select all                                                          
Ctrl + C                             Copy                                                                
Ctrl + F                             Find keyword                                                        
Ctrl + H                             Replace keyword                                                     
Ctrl + S                             Save                                                                
Ctrl + V                             Paste                                                               
Ctrl + X                             Cut                                                                 
Ctrl + Z                             Undo                                                                
Ctrl + Shift + Z                     Redo                                                                
F11                                  Fullscreen                                                          
Ctrl + Left/Right                    Move cursor to the start/end of words                               
Ctrl + Home/End                      Move cursor to start/end of document                                
Home/End                             Move cursor to start/end of line                                    
Shift + Up/Down                      Select characters above/below the line                              
Shift + Left/Right                   Select characters left/right of the cursor                          
Shift + Home/End                     Select all characters left/right of the cursor                      
Shift + Page Up/Page Down            Select all characters from cursor to the top/bottom of the document 
Windows                              Show Start Menu                                                     
Windows + `Type your search`         System search                                                       
Windows + D                          Show/hide desktop                                                   
Windows + E                          Open File Explorer                                                  
Windows + Alt + R                    Screen recording                                                    
Windows + Print Screen               Print full screen                                                   
Windows + Shift + S OR Print Screen  Select area and print screen of selected area

Browser

Alt + D                            Move cursor to address bar                
Alt + Left/Right                   Navigate to previous/next page in history 
Ctrl + D                           Bookmark current tab                      
Ctrl + R                           Reload page                               
Ctrl + T                           Open new tab                              
Alt + F4 OR Ctrl + F4 OR Ctrl + W  Close active tab                          
Ctrl + Shift + T                   Open recently closed tab                  
Ctrl + Shift + W                   Close all active windows                  
Ctrl + Tab                         Toggle between tabs                       
F12                                Open web console

VSCode

Alt + Left/Right                       Toggle tabs                                                  
Alt + Shift + Up/Down                  Copy and paste current line above/below it                   
Ctrl + L                               Select line                                                  
Ctrl + P                               Search for file                                              
Ctrl + N                               Work on a new file                                           
Ctrl + W                               Close active tab                                             
Ctrl + \                               Split code editor/Command Prompt                             
Ctrl + /                               Comment line of code                                         
Ctrl + `                               Open/Close Command Prompt in code editor                     
Ctrl + Alt + Up/Down                   Add cursors to multiple lines at the same horizontal positon 
Ctrl + Shift + `                       Open new Command Prompt in code editor                       
Ctrl + Shift + F                       Find keyword in directory                                    
Ctrl + Shift + K                       Delete line                                                  
Ctrl + Shift + P                       Open command palette                                         
(Ctrl + K) + V                         Preview Markdown file on the side                            
Ctrl + Shift + Left/Right              Select words to the left/right of the cursor                 
`Select keyword` + (Ctrl + D)          Add cursor to all found keywords one at a time               
`Select keyword` + (Ctrl + Shift + L)  Add cursor to all found keywords

Powershell/Command Prompt

Alt + Enter                          Fullscreen                             
Home                                 Move cursor to start of line           
End                                  Move cursor to end of line             
Backspace                            Clear character before cursor position 
Delete                               Clear character after cursor position  
Ctrl + Home                          Clear line before cursor position      
Ctrl + End                           Clear line after cursor position       
Esc OR `clear` OR `cls`              Clear screen                           
Ctrl + Backspace                     Delete previous word                   
Ctrl + C                             Cancel program                         
Ctrl + Z                             Stop program                           
Ctrl + Left/Right                    Move cursor between words              
`history`                            Show history of commands               
Up/Down                              Cycle history of commands

Other ways to shortcut your workflow

  1. Learn to touch-type, which incorporates all fingers to access your keyboard optimally. With sufficient practice, you will be able to save time by typing without glancing on the keys.

  2. Use tabs for autocompletion in the Terminal, especially when your file paths are long/unknown.

  3. When inputting text in multiple input boxes, use tabs instead of moving the mouse to proceed to the next input.

  4. Use aliases to execute long/complex commands

    • alias nrs=npm run start (Executes npm run start with nrs)

    • alias gps=git push (Executes git push with gps)

  5. Broadcast input to multiple Terminal tabs in the same session if the same executions need to be done on multiple replica servers - a nice feature of iTerm2.

Conclusion

After being exposed to these shortcuts, I learnt how excruciatingly painful it is to have wasted time using the mouse or performing repetitive work.

For those who just received your laptop or are new to shortcuts, I recommend trying these out to boost your productivity!

  1. Keyboard shortcuts for a Developer

  2. 10 Essential Keyboard Shortcuts For Programmers

  3. Bash Shortcuts

  4. Powershell Key Combinations

  5. Windows vs. Mac: 70+ Common and Helpful Keyboard Shortcuts

  6. Visual Studio Code - Keyboard Shortcuts for Mac

  7. Visual Studio Code - Keyboard Shortcuts for Windows

  8. iTerm2

  9. What is Windows Terminal?

  10. Typing Techniques – 5 Skills to Master