All Questions
Tagged with bash windows-subsystem-for-linux
233
questions
0
votes
0
answers
37
views
Launching Windows apps from WSL2 with foreground process control
I'm using WSL2 on Windows 11 and I'm trying to achieve the following: I want to launch Windows applications from within WSL2 and have the Bash terminal maintain a handle to the new process. ...
0
votes
1
answer
78
views
Why executing 'bash' in the terminal opens wsl on Windows 10?
When I run the 'bash' command in the terminal, my console automatically switches to the 'wsl' mode. Why is this happening and how do I stop this behavior? It causes problems when I run other scripts, ...
1
vote
0
answers
152
views
WSL run a non-login shell even with `--shell-type login`
Previously running wsl sourced .profile for me, as expected:
As of build 16188 when running bash.exe without arguments (or with the ~ argument) bash will be launched as a login shell. The same is ...
1
vote
1
answer
657
views
How do I change the background color for folders in PowerShell when invoking the "ls" command from WSL Interop?
I've installed the WslInterop module and exposed several commands from WSL2.
I'm using Import-WslCommand "apt", "cat", "awk", "nano", "find", "...
-1
votes
2
answers
550
views
WSL Bash: how do I get a symlink to act like a local folder
I have 2 folders set up:
/
folder/
subfolder/
file.txt
symlink-folder/
subfolder/ -> /folder/subfolder
If I cd /symlink-folder/subfolder then run ls, I see file.txt, as I expect. ...
0
votes
1
answer
2k
views
Using grep to search for files with a specific extension [duplicate]
I'm trying to recursively look for C Sharp files containing specific text using a bash prompt on Windows Subsystem for Linux.
If I type grep -l -i -r "public virtual List<" /mnt/c/mycode/*...
0
votes
0
answers
203
views
Connecting to X server with xming and putty: 'xterm: Xt error: Can't open display' error troubleshooting
I keep getting the
xterm: Xt error: cannot connect to X server:[:0]
error trying to run PGPLOT function. I am running xmings and putty with X11 forwarding enabled.
I have tried echo $DISPLAY and ...
1
vote
1
answer
28
views
How to inject powershell computed values into bash command (ran from powershell)?
I'm trying to convert wepb images into png, using dwebp, but the parameters are from powershell:
foreach($ff in $f)
{
bash -c "dwebp $ff.name {$ff.name -replace '(.*).webp','$1.png'}"
}
...
0
votes
0
answers
715
views
Valid Shell Script dosen't run in WSL
I have a simple shell script which runs completly fine on VM but gives me syntex error in WSL.
insert(){
read -p "Enter Name: " name
read -p "Enter Phone Number: " ...
0
votes
1
answer
2k
views
WSL command doesn't work through CMD/PowerShell [duplicate]
I'm trying to install software to multiple WSL distros, so I'm doing this using a batch file.
Here's an example command and its output:
CMD> wsl -u root -d Ubuntu-22.04 "apt-get update &&...
1
vote
1
answer
140
views
script to restart process on Debian WSL
I have amule-daemon installed on Debian 11 WSL.
Process amuleweb crashes every now and then so I need to restart it.
I'm trying to automate this with the following bash script:
#!/bin/bash
if [[ $(...
1
vote
0
answers
211
views
Can't figure out how to add padding to left side of Ubuntu 20.04.5 CLI in WSL 2(On Win11)
Posting here with updated detail after posting on AskUbuntu as user @NotTheDr01ds had a great answer but unfortunately it did not accomplish what I was hoping to accomplish.
I installed WSL 2 and ...
1
vote
1
answer
146
views
Separate file path from command in Bash under WSL2
Is there a way to separate the file path from the commandline in the Bash prompt in WSL2?
For example:
Current:
user1@DESKTOP-RMF1234:~/mywork/helloworld/tests$ ls
Expect:
user1@DESKTOP-RMF1234:~/...
13
votes
4
answers
8k
views
How can I check if the environment is WSL from a shell script?
In .bashrc, I have some configuration for specific environments like this.
if [ "$(uname)" = 'Linux' ]; then
. "$HOME/.bash.d/ubuntu"
fi
if [ "$(uname)" = 'Darwin' ]; ...
1
vote
1
answer
4k
views
JAVA_HOME env var in WSL return the error "not defined correctly' when a try run a mvn command
I set the JAVA_HOME with the command export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin/java and tried to run an app with mvn compile jib:build.
But return this message: The JAVA_HOME environment ...