Home > OS >  How to create a file in VS code via terminal on mac inside a folder
How to create a file in VS code via terminal on mac inside a folder

Time:11-16

enter image description here

I tried using code command but it doesn't create the file inside the folder I am in

CodePudding user response:

It looks like you didn't save the file. After you save it, it will be written in disk. If you want to create an empty file and then open in VSCode you could run also:

touch index.css
code index.css

CodePudding user response:

Use tha nano command, it is one of the most useful commands for saving and editing a file inside terminal. If it does not save on the folder your have opened, then maybe you are at another directory in the terminal. You can see the directory on the very left of the line where you type in the terminal. In zsh, it is on the left of the '%' sign.

  • Related