Create a new file in vscode terminal
To create a new file in VSCode terminal, you can use the following commands:
Method 1: Using the touch
command
- Open the VSCode terminal by clicking on "Terminal" in the top menu bar and selecting "New Terminal" or by using the keyboard shortcut
Ctrl + Shift +
(backtick). - Type the following command and press Enter:
touch newfile.txt
This will create a new file named
newfile.txt
in the current directory.
Method 2: Using the code
command
- Open the VSCode terminal as described above.
- Type the following command and press Enter:
code newfile.txt
This will create a new file named
newfile.txt
in the current directory and open it in VSCode.
Method 3: Using the echo
command
- Open the VSCode terminal as described above.
- Type the following command and press Enter:
echo "" > newfile.txt
This will create a new file named
newfile.txt
in the current directory and add an empty line to it.
Note: The >
symbol is used to redirect the output of the echo
command to a file. The ""
is an empty string, which is what gets written to the file.