Taco
Taco

Reputation: 2923

What directory is ~/ pointing to in a VS Code terminal?

I'm getting started with creating my own VS Code extension by following this tutorial. After installing Yeoman and walking through the prompts, I'm told I can change directories to my extension with cd identifier:

To start editing with Visual Studio Code, use the following commands:

    cd identifier
    code-insiders .

After doing so, I came to learn that it didn't open the folder it had created, and, I had no idea where it put it. I did, have a relative path however, which was a start:

ComputerInfo ~/identifier
$

I was able to discover that this maps to my user folder on the machine by executing:

dirs ~/

However, this feels a bit "hackish" since I got an error, and that's what gave me the path:

ComputerInfo ~/identifier
$ dirs ~/
bash: dirs: /c/Users/Taco/: invalid option
dirs: usage: dirs [-clpv] [+N] [-N]

How can I properly determine the directory for ~/ in the VS Code terminal?

Upvotes: 1

Views: 318

Answers (1)

Ricardo Erckert
Ricardo Erckert

Reputation: 85

Normally '~' is simply your home. if you type 'env' into a terminal you get a lengthy answer about all system settings. The interesting line for you is 'HOME=/home/'username'' . At least it is like that on my PC. There is a second way: type 'cd' (without any path. This takes you to your home. Next type 'pwd' (Present Work Directory). This command returns where you are.

Upvotes: 1

Related Questions