Ask coding questions

← Back to all posts
Open a file in code editor from shell
SMShimanto

I'm looking for a command that will open a file in the editor tab. If the file does not exist it should create the file.
As we see in VScode "code filename" command.
[Edit]
My main goal is to use the shell instead of the left file explorer provided by repl.it
Thanks

Voters
BradCodeCoach
SMShimanto
Comments
hotnewtop
Codeverse

I couldn't find a command to do so, but I know a program that comes close to it. First do this, npm init, then npm i nedb. Second,

Squirrel777

Well, there is no command to do both! But the shell in your repl is bash, which does not have the code command like Windows. So to create a file do touch <example.txt> and to open a file do cd path/to/file/name and you are done!

SMShimanto

@Squirrel777 cd command can't open a file instead of folder

Wumi4

You can use the CLI text editors, like Vim, Emacs, Neovim, Kakoune, etc.

SMShimanto

@Wumi4 Thanks but I want to use the main code editor provided by repl.it

Wumi4

@SMShimanto Then just click on the file, it should appear on the File Browser on the left of your editor.

SMShimanto

@Wumi4 yes that works but I want it to be done by my python programmer