It is possible to become more efficacious and proficient with any tool when you know how to use shortcuts. Consider this for a moment.
Do you think it is okay if someone repeatedly selects text by dragging through the mouse and selecting the cut option from the menu for once instead of pressing Ctrl+X? or by holding down the mouse button to copy the entire text instead of pressing Ctrl+A?
There is no exception to this rule when it comes to Linux shortcuts. Every user of the VS code should be familiar with some Linux keyboard shortcuts.
Almost every Linux user is familiar with the Bourne Again SHell (Bash) since it is the pre-configured shell in most distributions.
It may be difficult for beginners to grasp how to use the VS code, especially since you have to use your arrow keys to navigate. It can also be annoying to have to repeatedly type the same commands, each slightly different.
Despite this, Linux proffers a substantial array of keyboard shortcuts and history functions that makes it simple to work with the VS code productively. A list of the most frequently used VS code Linux keyboard shortcuts has been compiled to help you save time.
TL;DR: The complete blog can be viewed here in a shortened version.
Table Of Contents
- Fundamental shortcuts
- Editing basics
- Multi-cursor and selection
- Search and replace
- File management
- Shortcuts for the Linux Terminal
1. The fundamental shortcuts
i.) Display command palette
We can look for alternative commands in the command palette by pressing this shortcut. The command palette is quite useful, for say, when an individual who is on the lookout for a typical command in VS code, but does not remember the command.
Ctrl + Shift + P
ii.) Create a new window/instance
We can open a completely new window by using this Linux shortcut, which opens a completely new window or instance of the application.
Ctrl + Shift + N
iii.) Exit the window or instance
By pressing [CTRL] + [SHIFT] + [W], you can close the current window in most software applications. Furthermore known as Ctrl + W, Ctrl + W is a shortcut for Linux used for closing programs, windows, tabs, and documents.
Ctrl + Shift + W
iv) Settings for users
The settings window opens when you press this Linux shortcut. We can view the current settings here or modify them if necessary.
Ctrl + ,
v.) Shortcuts for the keyboard
This VS code Linux shortcut opens a new tab in which all of the current shortcuts are listed.
Ctrl + S
2. Editing basics
i.) Cut the line (empty selection)
This Linux hotkey cut an object\line that has been highlighted, such as a text or image.
Ctrl + X
ii.) Copy the line (empty selection)
To copy a highlighted image, text, or other object, right-click the object and select copy or simply use this shortcut.
Ctrl + C
iii.) To move the line up/down
By using this command in VS code, a line can be moved downward or upward.
Alt + ↓ / Alt + ↑
iv.) Delete the line
The Ctrl+Shift+K keyboard combination is used to delete a line quickly in VSCode. Simply place the cursor on the line you wish to delete and hit the keys.
Ctrl + Shift + K
v.) Insert the line below/ above
Inserting lines above and below are executed by pressing Ctrl+Enter and Ctrl+Shift+Enter, respectively.
Ctrl + Enter (or) Ctrl + Shift + Enter
vi.) Advance to the matching bracket
As a result of implying this command line shortcut in Linux, jump to the bracket that matches.
Ctrl + Shift + \
vii.) Indent / Outdent line
When copying lines between files or modifying code, you may end up with inaccurately indented code. By applying this shortcut, you can efficiently indent or outdent lines. Move multiple lines together by selecting them all.
Ctrl + ] / Ctrl + [
viii.) Toggles between beginning and ending
In order toggle between the beginning of the line and the ending of the line, press home or end.
Home / End
ix.) Navigate to the file's the beginning/end
By pressing Ctrl + Home or Ctrl + End, you can go to either the beginning or the end of a line.
Ctrl + Home / Ctrl + End
x.) Move up and down a line
If you press down the Ctrl + ↑ / Ctrl + ↓ shortcut, either it will be scrolled up or down by a line.
Ctrl + ↑ / Ctrl + ↓
xi.) Pan up/down on the page
By employing this Linux shortcut, the page can be scrolled up/down.
Alt + PgUp / PgDn
xii.) Fold or unfold the region
When you place your cursor inside a block of code, you can quickly fold it with Ctrl+Shift+[. You can also unfold the collapsed region by pressing Ctrl + Shift + ] simultaneously.
Ctrl + Shift + [ / Ctrl + Shift + ]
xii.) Fold and unfold all subregions
You can fold (collapse) all subregions by pressing Ctrl + K and then Ctrl + [ and Unfold (uncollapse) all subregions by pressing Ctrl + K Ctrl + ].
Ctrl + K & Ctrl+ [ / Ctrl + K & Ctrl+ ]
xiv.) Fold and unfold all regions
You can fold (collapse) all regions by pressing Ctrl + K and then Ctrl + 0 and Unfold (uncollapse) all regions by pressing Ctrl + K and then Ctrl + J.
Ctrl + K & Ctrl + 0 / Ctrl + K & Ctrl+J
xv.) Include line comment
Ctrl+K, Ctrl+C is a primary keyboard shortcut for adding line comment. Pressing these keys together will comment out just the selected code.
Ctrl + K & Ctrl + C
xvi.) Disable line comment
You can uncomment the code by pressing Ctrl + K + U. Furthermore, you can uncomment by pressing this shortcut.
Ctrl + K + U
xvii.) Switch line comment
The line comment characters should be added at the beginning of each selected line, or they should be removed if they already exist.
Ctrl + /
xviii.) Activate block comments
A keyboard shortcut called Ctrl + Shift + A allows you to toggle block comments.
Ctrl +Shift + A
xix.) Toggle word wrap
Word wrap can be toggled by pressing the right combination of keys in VS Code. To do so, just press Alt + Z if you are using Windows or Linux.
Alt + Z
3. Multi-cursor and selection
i.) The cursor will be inserted
Anywhere in the document you can insert an additional cursor by using this keyboard shortcut.
Alt + Click
ii.) To insert the cursor above or below
The shortcut instantly replicates the line based on the direction chosen with the arrows, so you don't have to copy and paste a line. It is important to highlight a block of text or code before moving it this way.
Shift + Alt + ↑ / Shift + Alt + ↓
iii.) Revert the last cursor move
Misspelled a command? You can discard the current command in the Linux terminal by pressing Ctrl+U instead of backspace. The current cursor position is erased along with everything up to the beginning of the line when you use this shortcut.
Ctrl + U
iv.) Place cursor at end of selected lines
Adding the cursor to the end of highlighted selections can also be a shortcut that helps you develop faster.
Shift + Alt + I
v.) Choose the current line
By pressing this shortcut, you will clear your screen in the VS code terminal. You can do this equivalent to the "clear" command.
Ctrl + L
vi.) Widen / Constrict the selection
This VS code Linux keyboard shortcut lets you move and expand the selection easier when you select a section of code. Left and right arrows can be used to move in whichever direction you choose.
Shift + Alt + → / Shift + Alt + ←
vii.) To select a column (box)
You can select each line of code or text by dragging your cursor across it. In addition, this shortcut terminal hotkeys allows you to select a group of lines partly. If you drag over multiple lines, they will all be selected.
Shift + Alt + drag the mouse
i.) Enable fullscreen
You can enable Fullscreen mode by pressing the shortcut F11 and also you can disable it using the same shortcut.
ii.) Change zoom levels
You can adjust the Zoom level in VS Code with this shortcut as you it is implied to increase and decrease the Zoom level.
Ctrl + + / -
iii.) Switch the display of the sidebar
When you're working on an open file, you often need more space. Whenever necessary, you can use this keyboard/Linux shortcut to display or conceal the sidebar.
Ctrl + B
5. Search and replace
i.) To find
This terminal Linux shortcut key Ctrl + F implies that the find and replace bar will be displayed for the current document when pressed.
Ctrl + F
ii.) To replace
The Linux shortcut key Ctrl + H is applied to replace.
Ctrl + H
iii.) To find the next/previous
Finding the next or finding the previous is performed by pressing this Linux shortcut F3 or Shift + F3.
F3 / Shift + F3
iv.) Invoke find match for all instances
In case you need to modify all the results from a search, selecting all results with this keyboard shortcut will allow you to accomplish that.
Alt + Enter
v.) Adding selection to a new find match
By using this Linux VS code shortcut, you can add a selection to the next find match.
Ctrl + D
vi.) Toggle the previous selection to the new find match
By using the Linux terminal hotkey/shortcut, it is possible in moving the last selection to the next find match.
Ctrl + K & Ctrl + D
i.) To display all symbols
By pressing Ctrl+T, all symbols will display across all files.
Ctrl + T
ii.) Navigate to line…
A specific line of code can be found by finding the code at that line. With this Linux VS code hotkey / shortcut, you don't have to search for the line manually.
Ctrl + G
iii.) To go to file
Through this shortcut, we can find, open, and search for specific files in the project you are currently working on. It is extremely convenient when working on complex tasks.
Ctrl + P
iv.) To go to symbol…
When you hold down the shortcut key Ctrl+Shift+O, you can navigate to symbols inside a file.
Ctrl + Shift + O
v.) Display the problems panel
You can display the Problems panel in VS code terminal by pressing this shortcut Ctrl + Shift + M.
vi.) To move to the next error or warning
In the Error List or Output window, pressing this Linux shortcut key F8 switches to the next error.
vii.) Revert to the preceding error or warning
When using the Error List or Output window, this Linux keyboard shortcut F8 helps you go to the previous error.
Shift + F8
viii.) Displays the editor group history
With this keyboard shortcut, you can toggle between multiple tabs and choose which one to open when you have a lot of tabs open. The shortcut shows a list of tabs and lets you select one to open, and you can toggle between them easily.
Ctrl + Shift + Tab
ix.) Move backward
To go backward in VS code, use this Linux keyboard shortcut.
Ctrl + Alt + -
x.) Move forward
You can keep moving forward by using this Linux keyboard shortcut.
Ctrl + Shift + -
xi.) Switches tab moves focus
On the Linux keyboard shortcuts, this command line shortcut toggles the tab key to move the focus.
Ctrl + M
7. File management
i.) To create a new file
It's easy to create a new file by holding down the shortcut key Ctrl+N.
Ctrl + N
ii.) Open the file
You can open the file by pressing the shortcut key Ctrl + O.
Ctrl + O
iii.) To save
When you hold down the shortcut key Ctrl + S, all your files and settings are saved.
Ctrl + S
iv.) To save as
You can access the save as option when you hold down the command line Linux shortcut key Ctrl + Shift + S.
v.) To close
A shortcut for erasing the preceding word is Ctrl+W. When the cursor is over a word, the whole word will be erased from the cursor position to the start.
Ctrl + W
vi.) To close all windows
When you hold down the shortcut key Ctrl+K and then Ctrl+W, you can close all your files.
Ctrl + K & Ctrl + W
vii.) To reopen the closed editor
The shortcut key Ctrl+Shift+T can be used to reopen any closed editor at any time.
Ctrl + Shift + T
viii.) Keep editor in preview mode
You can keep the preview mode editor open by simply pressing this Linux terminal shortcut key Ctrl+K Enter.
Ctrl + K & Enter
ix.) To open next
By holding down the Linux terminal shortcut key Ctrl+Tab, you can navigate to the next tab.
Ctrl + Tab
x.) Returns to the previous
By holding down the Linux shortcut key Ctrl+Shift+Tab, you can navigate to the previous tab.
Ctrl + Shift + Tab
xi.) Copy the active file's path
It is possible to copy the path of the active file by holding down this terminal hotkey in Linux.
Ctrl + K & P
xii.) Shows active files in Explorer
By holding down the shortcut key Ctrl+Shift+Tab, the active file in Explorer will be revealed.
Ctrl + K & R
xiii.) Display the active file in a new window/instance
You can open the current file in a new window/instance by holding down this shortcut key.
Ctrl + K O
i.) Switches breakpoints
A breakpoint can be enabled once, disabled once, and deleted once by simply pressing the Linux command line shortcut key F9 .
ii.) To begin or continue
Using this keyboard shortcut in Linux, you can start or continue a debugging session.
iii.) Step into or out of
You can step into or out of the breakpoint using this Linux command line shortcut. Breakpoints are either executed or terminated by this command.
F11 / Shift+F11
iv.) To step over
You can Step over a breakpoint with this BASH shortcut. The next breakpoint will not be run, nor will it exit the debug session.
v.) To stop
Stopping the debugging session can be accomplished with this windows/Linux terminal shortcut.
vi.) Display hover
A hover window will appear for the part of the code where the cursor is currently located. Whenever the cursor hovers over some part of the window, some additional information appears by applying this windows/Linux terminal shortcut.
Shortcuts for the Linux Terminal
It's easier to develop projects in VS Code with keyboard shortcuts, allowing you to build quality projects faster.
By implying shortcuts, we can be more streamlined and proficient when using any tool. Terminals are no exception. The Linux terminal has several shortcuts that should be familiarized with and known by all users.
The Bash shell keyboard shortcuts enhance work efficiency within an ever-changing organization by helping you make better use of your time.
Linux is a very adaptable operating system, and we can often acquire similar results using a variety of approaches. Many Linux users attribute a great deal of importance to the command line and terminal.
In addition to improving skills, shortcuts can save time as well. Keyboard shortcuts give quick access to specific commands and tasks using combinations of keys. Shortcut keys are used by almost everyone for convenience.
With these shortcut keys, we will be able to run and access previously run commands, change the text on the terminal, access the editor, control processes, move the cursor, and so on.
Monitor Your Entire Application with Atatus
Atatus is a Full Stack Observability Platform that lets you review problems as if they happened in your application. Instead of guessing why errors happen or asking users for screenshots and log dumps, Atatus lets you replay the session to quickly understand what went wrong.
We offer Application Performance Monitoring, Real User Monitoring, Server Monitoring, Logs Monitoring, Synthetic Monitoring, Uptime Monitoring and API Analytics. It works perfectly with any application, regardless of framework, and has plugins.
Atatus can be beneficial to your business, which provides a comprehensive view of your application, including how it works, where performance bottlenecks exist, which users are most impacted, and which errors break your code for your frontend, backend, and infrastructure.
If you are not yet a Atatus customer, you can sign up for a 14-day free trial .