I am a newbie in Ubuntu. When I open my terminal, the source path (directory) starts with System32, how can I change it to User or Desktop ? When I type cmd.exe : Microsoft Windows [version 10.0.19042.1320] (c) Microsoft Corporation. Tous droits réservés.
1 Answer
So... Windows is an operating system. Ubuntu is also an operating system. Both are operating systems, but they are different operating systems. They both have shells (see here for the difference between a terminal emulator and a shell). On Windows 10, there are two shells: PowerShell* and cmd.exe
. PowerShell can do almost everything cmd.exe
can, as it is far newer. There are several shells on Ubuntu. The one that it uses by default for a user is called bash
. There is a second one called sh
, but it is used less, as it is far less powerful, but it is more cross-platform, similar to how PowerShell is newer, but there are also a few old systems that don't have it.
On Windows, when you start a "Command Prompt" (which is just the start menu entry for cmd.exe
). The default directory that cmd.exe
(or I think PowerShell, too) is C:\Windows\System32
.
Here's the interesting bit: In cmd.exe
, to list files in a directory, you type in dir
and press enter. On PowerShell, you type in Get-ChildItem
, and press enter. Here's where it is confusing: there are a handful of aliases in PowerShell (you can get a list with Get-Alias
). The two that matter here are dir
and ls
. Both are aliased to Get-ChildItem
. This means that when you type in ls
in PowerShell, it will print the files in the current directory. On Ubuntu, both dir
and ls
, also print the files in the current directory.
Here's how I know you are using PowerShell on Windows 10:
You mentioned as a comment that ls
worked (e.g., it listed the files in your current directory). Remember, ls
only works in PowerShell and bash
(so not cmd.exe
). But, you also said cmd.exe
does something: it starts the cme.exe
shell. But that only exists on Windows, not Ubuntu.
Now to answer your question:
On both Windows and Linux, you can change your current directory with the cd
command. So basically, set your directory with cd [where you want to go]
. E.g., on Linux, if you wanted to go to the /etc
directory, you would do cd /etc
. But if you want Ubuntu, either use something like Windows Subsystem for Linux or download it from the Ubuntu website
*Technically, yes, you can install PowerShell on Linux. But I'm talking about the defaults here.
/home/$USER
.cmd.exe
and pressing enter.