Use of ls -la on windows OS [duplicate] - powershell

This question already has an answer here:
Error trying to list files in directory using the ls -la command
(1 answer)
Closed 16 days ago.
software devs it is requested to help me. I want to use the ls -la command on the vs code terminal. It is not working
enter image description here
I tried setting the execution policy to unrestricted. It got unrestricted but it still didn't work. Look i have used ls -la command on a kali linux vm in the past. Currently i am trying to usxe it on a windows default os running vs code and it isn't working. Please help me. Regards

ls is a unix command. The equivalent for that in windows is dir.
If you still want to use 'ls', better of setting it as an alias for dir.

ls -la is a linux command that displays all the files including hidden files in long format. The equivalent of it on Windows is dir /a

Related

Can't run mongo command on windows [duplicate]

This question already has answers here:
mongo.exe not installed in Version 6.0.0
(7 answers)
mongosh is a valid command but mongo is not found
(2 answers)
Closed 13 days ago.
I tried t to set up Community MongoDB on my windwos pc. I followed the installation process and tried to set up the environment variables. I copied the pathes from my explorer, so the pathes should be correct. screenshot of my env
Nonetheless I can't use any mongo commands on my command shell. Anytime I try to run "mongo" or "mongodb" or "mongo --version" it says "command is either misspelled or couldn't be found". screenshot of my cmd shell
When I use the command "mongod" some strange code appears screenshot of my cmd shell
How can I solve this problem?
Found the solution: you have to set up mongoshell first and then you can use the command "mongosh" to use it with the windows command. This tutorial helped me set everything up: youtube.com/watch?v=V-d6VAYrjeQ

WSL vscode command returning error "not found"

I have this message whenenver i try to type code .
Can someone help me please ?
Thanks in advance
Fixed it
Open VS Code on Windows
Open Extensions and then search on WSL
It should say the extension needs to be reloaded - go ahead and reload it
Open WSL and type code
This should force another upgrade of code and this time it should launch.
I just now had the same issue on WSL2 Kali. I tried everything given here: https://github.com/microsoft/vscode-remote-release/issues/2962.
My problem was VS Code was not on Kali's path. Here's how I fixed it :)
echo $PATH
# Confirm PATH is missing this:
/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/
# Confirm VS Code's location then export:
export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"
# It's temporarily added to path...
echo $PATH
# This should now trigger VS Code Server install,
# then open ~/ in VS Code.
code .
# If above works, make it permanent:
echo 'export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"' >> ~/.bashrc
# Restart shell + test
exec "$SHELL"
code .
I solved this problem by opening windows powershell in admin mode and typing the following command:
wsl --update
Then I typed this command to force restart the WSL and all done
wsl --shutdown
I have same issue when I trying export my old wsl and move whole project to nvme ssd using new distro.
I able to run the code . on root , but when i switch to my name then it doesn't work, I guess is WSL PATH problem.
I not really familiar to the linux, the below image may easier for you to understand what i am saying.
When i use echo $PATH on wsl to compare root and my account, and i notice that VS code directory only found on root instead of my account.
So i use export PATH=$PATH:"/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft VS Code/bin" to add the VS Code path to my account* and code . is working once i export this.
But the code . will not be able to run again if you restart the wsl, so we need to put in to bashrc.
But when i try to update my account's* PATH using
echo "PATH=$PATH:/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft\ VS\ Code/bin" >> ~/.bashrc and restart the wsl to login my account, i notice an error msg popup when run the code .
cannot create /tmp/remote-wsl-loc.txt: Permission denied
And i found this.
https://github.com/microsoft/vscode-remote-release/issues/5389
Seem they only giving the workaround for now and hopefully can fix it soon.
*disclaimer above: this code need to run under your account instead of root
**For editing bashrc, instead of using echo and >> write to the file, you also can use code ~/.bashrc to update/edit, when you have the vscode access on wsl.
This also happens if you disable the Windows PATH on WSL. I had my VS Code working fine, then when I disable the windows PATH (by editing/creating the /etc/wsl.conf file and inserting the [interop] appendWindowsPath = false parameter) the code command stopped working.
The ek1n8 solution solves my problem, addind the export manually to the WSL Path:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
For me adding the binary to Path was enough:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
For me it was wsl using the wrong container:
wsl --list -v
NAME STATE VERSION
* docker-desktop-data Stopped 2
Ubuntu Running 2
I did wsl -s ubuntu
wsl --list -v
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop-data Stopped 2
and it solved the problem

Dos Command prompt or Batch file to go to local user directory in windows 7 or 8 or 10

I tried
cd %user%
but it doesn't take me to the local user directory. So in the DOS command prompt how to do get there this way.
Thank you in advance.
try:
cd %USERPROFILE%
Or type:
set
to see all the options for enviornment vars

how to run the perl script in the directory which i specify while running the script in the command line [duplicate]

This question already has answers here:
How do I cd into a directory using perl?
(3 answers)
Closed 9 years ago.
How to run the perl script in the directory which i specify while running the script in the command line
Example:
./scriptname -rd run
My script should go to directory name run and it should run there?
Do a chdir() in your Perl script.
cf http://perldoc.perl.org/functions/chdir.html
The obvious solution is to chdir to the directory before running the script:
dir=$(readlink -f .)
cd run
"$dir"/scriptname

Why is -bash: PATH: command not found displayed when I open my terminal window?

I installed EPD Free 7.3.2 and it was running fine until I wanted to modify PATH to point to where my Python scripts are. I gave up on that and reverted back to my original .bash_profile file.
# Setting PATH for EPD_free-7.3-2
# The orginal version is saved in .bash_profile.pysave
PATH = "/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH
When launching terminal, I get this:
Last login: Thu Jan 3 08:50:20 on ttys000
-bash: PATH: command not found
However, I am able to run iPython and all the libs that come with EPD w/o problems. Anybody knows what the problem is with "PATH: command not found"?
The spaces around the = are a problem. Use this assignment:
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
You need to remove the spaces around =:
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
Otherwise you're trying to run the (non-existent) command PATH with = and "/Library..." as its arguments.