aws command works in WSL, but not as one-liner from PowerShell
I'm using WSL (Windows Subsystem for Linux) on windows 10, and installed the Amazon AWS cli on it. When I start WSL (C:\WINDOWS\System32\wsl.exe
in PowerShell) and then aws
it works fine. If I try to run it as a one-liner (C:\WINDOWS\System32\wsl.exe aws
) it doesn't find the aws
command. I need it as a one-liner to be able to use it from a VS Code task.
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe aws
/bin/bash: aws: command not found
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe
pablo@DCA-WS01:/mnt/c/Users/pablo.DCA$ aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: too few arguments
A simple echo
command does work:
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe echo Hi
Hi
And so does Python (which I used to install aws):
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Why does this happen? And how can I fix it, or what could I try to figure out what is going wrong?
command-line amazon-web-services windows-subsystem-for-linux
add a comment |
I'm using WSL (Windows Subsystem for Linux) on windows 10, and installed the Amazon AWS cli on it. When I start WSL (C:\WINDOWS\System32\wsl.exe
in PowerShell) and then aws
it works fine. If I try to run it as a one-liner (C:\WINDOWS\System32\wsl.exe aws
) it doesn't find the aws
command. I need it as a one-liner to be able to use it from a VS Code task.
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe aws
/bin/bash: aws: command not found
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe
pablo@DCA-WS01:/mnt/c/Users/pablo.DCA$ aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: too few arguments
A simple echo
command does work:
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe echo Hi
Hi
And so does Python (which I used to install aws):
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Why does this happen? And how can I fix it, or what could I try to figure out what is going wrong?
command-line amazon-web-services windows-subsystem-for-linux
add a comment |
I'm using WSL (Windows Subsystem for Linux) on windows 10, and installed the Amazon AWS cli on it. When I start WSL (C:\WINDOWS\System32\wsl.exe
in PowerShell) and then aws
it works fine. If I try to run it as a one-liner (C:\WINDOWS\System32\wsl.exe aws
) it doesn't find the aws
command. I need it as a one-liner to be able to use it from a VS Code task.
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe aws
/bin/bash: aws: command not found
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe
pablo@DCA-WS01:/mnt/c/Users/pablo.DCA$ aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: too few arguments
A simple echo
command does work:
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe echo Hi
Hi
And so does Python (which I used to install aws):
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Why does this happen? And how can I fix it, or what could I try to figure out what is going wrong?
command-line amazon-web-services windows-subsystem-for-linux
I'm using WSL (Windows Subsystem for Linux) on windows 10, and installed the Amazon AWS cli on it. When I start WSL (C:\WINDOWS\System32\wsl.exe
in PowerShell) and then aws
it works fine. If I try to run it as a one-liner (C:\WINDOWS\System32\wsl.exe aws
) it doesn't find the aws
command. I need it as a one-liner to be able to use it from a VS Code task.
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe aws
/bin/bash: aws: command not found
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe
pablo@DCA-WS01:/mnt/c/Users/pablo.DCA$ aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: too few arguments
A simple echo
command does work:
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe echo Hi
Hi
And so does Python (which I used to install aws):
PS C:Userspablo.DCA> C:\WINDOWS\System32\wsl.exe python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Why does this happen? And how can I fix it, or what could I try to figure out what is going wrong?
command-line amazon-web-services windows-subsystem-for-linux
command-line amazon-web-services windows-subsystem-for-linux
asked Jan 14 at 14:15
PabloPablo
62
62
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Most likely AWS is not in a system path, like /usr/bin/
. If you are adding it to your $PATH
, e.g. in ~/.bashrc
, it normally won't be executed unless you restart your terminal.
One option would be to use the full path to aws in your one line call from Windows:
c:\windows\system32\wsl.exe /home/username/.local/bin/aws
Or you could force bash to behave as if it was invoked as a login shell with the -l
(or --login
) option
c:\windows\system32\wsl.exe bash -l aws
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394140%2faws-command-works-in-wsl-but-not-as-one-liner-from-powershell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Most likely AWS is not in a system path, like /usr/bin/
. If you are adding it to your $PATH
, e.g. in ~/.bashrc
, it normally won't be executed unless you restart your terminal.
One option would be to use the full path to aws in your one line call from Windows:
c:\windows\system32\wsl.exe /home/username/.local/bin/aws
Or you could force bash to behave as if it was invoked as a login shell with the -l
(or --login
) option
c:\windows\system32\wsl.exe bash -l aws
add a comment |
Most likely AWS is not in a system path, like /usr/bin/
. If you are adding it to your $PATH
, e.g. in ~/.bashrc
, it normally won't be executed unless you restart your terminal.
One option would be to use the full path to aws in your one line call from Windows:
c:\windows\system32\wsl.exe /home/username/.local/bin/aws
Or you could force bash to behave as if it was invoked as a login shell with the -l
(or --login
) option
c:\windows\system32\wsl.exe bash -l aws
add a comment |
Most likely AWS is not in a system path, like /usr/bin/
. If you are adding it to your $PATH
, e.g. in ~/.bashrc
, it normally won't be executed unless you restart your terminal.
One option would be to use the full path to aws in your one line call from Windows:
c:\windows\system32\wsl.exe /home/username/.local/bin/aws
Or you could force bash to behave as if it was invoked as a login shell with the -l
(or --login
) option
c:\windows\system32\wsl.exe bash -l aws
Most likely AWS is not in a system path, like /usr/bin/
. If you are adding it to your $PATH
, e.g. in ~/.bashrc
, it normally won't be executed unless you restart your terminal.
One option would be to use the full path to aws in your one line call from Windows:
c:\windows\system32\wsl.exe /home/username/.local/bin/aws
Or you could force bash to behave as if it was invoked as a login shell with the -l
(or --login
) option
c:\windows\system32\wsl.exe bash -l aws
edited Feb 11 at 19:00
Charlie Harding
736410
736410
answered Feb 11 at 17:41
JasonCGJasonCG
1011
1011
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394140%2faws-command-works-in-wsl-but-not-as-one-liner-from-powershell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown