Visual Studio Code has a powerful command line interface built-in that lets you control how you launch the editor. You can open files, install extensions, change the display language, and output diagnostics through command-line options (switches).
Sed ('stream editor') is a Unix utility that parses and transforms text, using a simple, compact programming language. Sed was developed from 1973 to 1974 by Lee E. McMahon of Bell Labs, and is available today for most operating systems. Sed was based on the scripting features of the interactive editor ed ('editor', 1971) and the earlier qed ('quick editor', 1965–66). Sed was one of the. It doesn't have to be flash, just a command line version of Notepad for Microsoft Operating systems. MS-DOS had edit.com. Linux/UNIX has vi, vim, nano, pico. Windows 10 has no command line text editors. Anyone who has used computers and servers knows that the serious work is done on the command line/text based interfaces of an operating system. A text editor is a must-have application for any operating system. We have no dearth of the best modern editors for Linux.But those are GUI based editors. But, for a lot of good reasons, you still need to utilize the command-line.
If you are looking for how to run command-line tools inside VS Code, see the Integrated Terminal.
Command line help
Since you want to open 'a' text editor. It shouldn't be wrong if you use a command line text editor such as vim or vi. User vim filename. Looking at the other answers this might seem controversial. But as you work mostly inside the the terminal. Using vim or Gedit is the ideal choice. CP/M 's line editor EDLIN – a line editor delivered with MS-DOS EDT (Univac) – a line editor for Unisys VS/9 and Fujitsu BS2000 systems ex – an EXtended version of Unix's ed, later evolved into the visual editor vi.
To get an overview of the VS Code command line interface, open a terminal or command prompt and type
code --help
. You will see the version, usage example, and list of command line options.Launching from command line
You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. To do this, from an open terminal or command prompt, navigate to your project folder and type
code .
:Note: Users on macOS must first run a command (Shell Command: Install 'code' command in PATH) to add VS Code executable to the
PATH
environment variable. Read the macOS setup guide for help.Windows and Linux installations should add the VS Code binaries location to your system path. If this isn't the case, you can manually add the location to the
Path
environment variable ($PATH
on Linux). For example, on Windows, VS Code is installed under AppDataLocalProgramsMicrosoft VS Codebin
. To review platform specific setup instructions, see Setup.Insiders: If you are using the VS Code Insiders preview, you launch your Insiders build with
code-insiders
.Core CLI options
Here are optional arguments you can use when starting VS Code at the command line via
code
:Argument | Description |
---|---|
-h or --help | Print usage |
-v or --version | Print VS Code version (for example, 1.22.2), GitHub commit id, and architecture (for example, x64). |
-n or --new-window | Opens a new session of VS Code instead of restoring the previous session (default). |
-r or --reuse-window | Forces opening a file or folder in the last active window. |
-g or --goto | When used with file:line[:character], opens a file at a specific line and optional character position. This argument is provided since some operating systems permit : in a file name. |
-d or --diff | Open a file difference editor. Requires two file paths as arguments. |
-w or --wait | Wait for the files to be closed before returning. |
--locale <locale> | Set the display language (locale) for the VS Code session. (for example, en-US or zh-TW ) |
Opening Files and Folders
Sometimes you will want to open or create a file. If the specified file does not exist, VS Code will create them for you along with any new intermediate folders:
For both files and folders, you can use absolute or relative paths. Relative paths are relative to the current directory of the command prompt where you run
code
.If you specify more than one file at the command line, VS Code will open only a single instance.
If you specify more than one folder at the command line, VS Code will create a Multi-root Workspace including each folder.
Argument | Description |
---|---|
file | Name of a file to open. If the file doesn't exist, it will be created and marked as edited. You can specify multiple files by separating each file name with a space. |
file:line[:character] | Used with the -g argument. Name of a file to open at the specified line and optional character position. You can specify multiple files in this manner, but you must use the -g argument (once) before using the file:line[:character] specifier. |
folder | Name of a folder to open. You can specify multiple folders and a new Multi-root Workspace is created. |
Working with extensions
You can install and manage VS Code extensions from the command line.
Argument | Description |
---|---|
--install-extension <ext> | Install an extension. Provide the full extension name publisher.extension as an argument. Use --force argument to avoid prompts. |
--uninstall-extension <ext> | Uninstall an extension. Provide the full extension name publisher.extension as an argument. |
--disable-extensions | Disable all installed extensions. Extensions will still be visible in the Disabled section of the Extensions view but they will never be activated. |
--list-extensions | List the installed extensions. |
--show-versions | Show versions of installed extensions, when using --list-extensions |
--enable-proposed-api <ext> | Enables proposed api features for an extension. Provide the full extension name publisher.extension as an argument. |
Advanced CLI options
There are several CLI options that help with reproducing errors and advanced setup.
Argument | Description |
---|---|
--extensions-dir <dir> | Set the root path for extensions. Has no effect in Portable Mode. |
--user-data-dir <dir> | Specifies the directory that user data is kept in, useful when running as root. Has no effect in Portable Mode. |
-s, --status | Print process usage and diagnostics information. |
-p, --performance | Start with the Developer: Startup Performance command enabled. |
--disable-gpu | Disable GPU hardware acceleration. |
--verbose | Print verbose output (implies --wait ). |
--prof-startup | Run CPU profiler during startup. |
--upload-logs | Uploads logs from current session to a secure endpoint. |
Multi-root | |
--add <dir> | Add folder(s) to the last active window for a multi-root workspace. |
Opening VS Code with URLs
You can also open projects and files using the platform's URL handling mechanism. Use the following URL formats to:
Open a project
Open a file
Open a file to line and column
You can use the URL in applications such as browsers or file explorers that can parse and redirect the URL. For example, on Windows, you could pass a
vscode://
URL directly to the Windows Explorer or to the command line as start vscode://{full path to file}
.Note: If you are using VS Code Insiders builds, the URL prefix is
vscode-insiders://
.Next steps
Ultraman fighting evolution 3 iso only 100mb. Read on to find out about:
- Integrated Terminal - Run command-line tools from inside VS Code.
- Basic Editing - Learn the basics of the VS Code editor.
- Code Navigation - VS Code lets you quickly understand and move through your source code.
Common questions
'code' is not recognized as an internal or external command
Your OS cannot find the VS Code binary
code
on its path. The VS Code Windows and Linux installations should have installed VS Code on your path. Try uninstalling and reinstalling VS Code. If code
is still not found, consult the platform specific setup topics for Windows and Linux.On macOS, you need to manually run the Shell Command: Install 'code' command in PATH command (available through the Command Palette⇧⌘P (Windows, Linux Ctrl+Shift+P)). Consult the macOS specific setup topic for details.
How do I get access to a command line (terminal) from within VS Code?
VS Code has an Integrated Terminal where you can run command-line tools from within VS Code.
Can I specify the settings location for VS Code in order to have a portable version?
Not directly through the command line, but VS Code has a Portable Mode which lets you keep settings and data in the same location as your installation, for example, on a USB drive.
The command line, also called the Windows command line, command screen, or text interface, is a user interface that's navigated by typing commands at prompts, instead of using a mouse. For example, the Windows folder in a Windows command line is 'C:Windows>' (as shown in the picture). In Unix or Linux, it may be '%' or '>' depending on the shell. Unlike a GUI (graphical user interface) operating system, a command line only uses a keyboard to navigate by entering commands and does not utilize a mouse for navigating.
Why do people use the command line?
Although using a command line interface requires the memorization of many different commands, it can be valuable resource and should not be ignored. Using a command line, you can perform almost all the same tasks that can be done with a GUI. However, many tasks can be performed quicker and can be easier to automate and do remotely.
For example, users who have Microsoft Windows may find a task such as renaming 100+ files in a folder, a very time intensive task. However, renaming 100+ files in a directory can be done in less than a minute with a single command in the command line. The task could also be automated using a batch file or other scripts to run instantly.
Example of doing a task in the command line
For someone with little or no experience with a command line, it may be difficult to grasp how the command line is used. Below is an overview to help demonstrate a task done in the Windows command line and in the Windows GUI.
Move all .txt files to a backup directory in a Windows command line
- Move to the directory containing the .txt files using the cd command. For example, you could move to the hope user's documents by typing 'cdusershopedocuments' at the prompt.
- Once in the directory, if a backup directory did not exist you could use the md command and type 'md backup' to make a new backup directory.
- Finally, to move all .txt files you could use the move command and type 'move *.txt backup' to move all .txt files to the backup folder. The * is used as a wildcard.
Move all .txt files to a backup folder in a Windows
For a comparison to the above command line steps. Below are the steps on how to perform the same action (moving .txt files) in Windows.
- Open the drive and folder containing the .txt files. For example, you could move into the C: drive and navigate to the Users folder, Hope folder, and then the Documents folder to open them for the hope user.
- Once in the folder, if a backup folder did not exist, you could right-click in the folder, click New, select Folder, and name it 'backup' to create a new backup folder.
- If Windows Explorer is not showing the files in the Details view, click the View tab and select Details.
- Click the Type column to browse files by type.
- Highlight all .txt files.
- Right-click the highlighted and select Cut.
- Open the backup folder, and in that folder, right-click and then click Paste to move all files into that folder.
As demonstrated in the two examples above, performing the same task in a command line does require learning at least three commands. However, once these commands are known, it requires less steps in a command line than in Windows. These same commands could also be used in a batch file or other scripting language to automate the process. For example, you could automate backing up files by copying the files instead of moving them. Once the commands are written in a batch file, double-click the batch file to perform all the copying.
Command line commands
There are hundreds of different commands that can be used in a command line. Remembering all the commands, syntax, and options of every command would be impossible, which is why we've created the below pages. Below are links to our Windows command line, MS-DOS, Linux, and Unix command listings. Each of these pages has hundreds of commands with full syntax and examples of how to use each command.
Text interface with menus in a command line
A text interface can be made easier to navigate using menus created with text and ASCII extended characters. For example, many command line text editors use an interface with menus and shortcut keys that make navigating the file being edited easier. The picture below is an example of the MS-DOS editor used to edit files while at the MS-DOS or Windows command line.
Although a text interface with menus has a lot more visual appeal than the command line, this interface is still considered a text interface and not a graphical interface.
Should I learn a command line?
We're strong believers you should learn as much as you can about computers to make using a computer easier. Having a basic understanding of the command line from reading this page gives you a much greater advantage than someone unfamiliar with its capabilities. Below are some reasons you may want to learn even more about the command line.
- You need ways to manage files faster and easier on a computer.
- You work with computers remotely.
- Manage files on a file server or web server (e.g., managing a web page).
- Need to automate commonly performed tasks.
- Want to learn even more about computers.
Should I use 'command line' or 'command-line' in my writing?
Command Line Editors Windows
Both 'command line' and 'command-line' are acceptable and widely used in today's writing. When used as an adjective before a noun, use 'command-line' (with a hyphen) in your writing to help prevent confusion. For example, in the sentence 'Make sure you entered the correct command-line parameter.' the word 'command-line' is describing a type of parameter.
When used as a noun, use 'command line' (with no hyphen) in your writing. For example, in the sentence 'Open the command line.' the use of 'command line' is used as a noun.
Related pages
Windows Command Line Text Editor
Argument, CUI, Elevated command prompt, MS-DOS, Operating system terms, Virtual real mode