VSC Terminal- How to delete the path

Hi, I’m starting to learn python but I’ve gotten stuck on “5- Your First Python Program” (2:29) Mosh’s terminal appears almost empty with the exception of “HelloWorld $” while mine shows a path (I was able to delete the “Copyright (c) Microsoft Corporation…” and “Type ‘help’ to get help…”) .

The following code shows on my terminal:
PS C:\Users\sonia\OneDrive\Documents\Coding Tests\HelloWorld>
image

How can I get my terminal to be like Mosh’s?

Thank you very much.

Hi Sonia

Mosh is a Mac user, so when he is using Visual Studio Code (VSC), it utilizes the native ‘Mac’ command line tool called ‘Terminal’. It’s likely he has tailored his ‘prompt’ to just show the active directory.

In contrast we are Windows users and the ‘PS’ indicates it’s the Windows utility ‘PowerShell’. By default, the prompt is the way you see it, in that it shows the full path.

Easy option - You might choose to move your HelloWorld folder so that it is located at C:\HelloWorld. At least this way, the prompt is shorter.

More complex option - As a test, in VSC, in the terminal window, copy/paste this code as is…

function prompt {
  $p = Split-Path -leaf -path (Get-Location)
  "$p> "
}

So now, this is more like what Mosh has. BUT… this will only last for the current session. To make it more permanent, one must edit or create a profile file for PowerShell. I can provide more details and links if you’re interested.

If anyone knows a more simpler way within VSC, please share.

Try this, I spend allot of time searching, but finally got helped…