WSL can run Windows tools directly from the WSL command line using. To use the Linux command ls -la to list files in the C:\Program Files Windows file system path, using PowerShell: C:\temp> wsl ls -la "/mnt/c/Program Files" To use the Linux command ls -la to list files in the /proc/cpuinfo Linux file system path, using PowerShell: C:\temp> wsl ls -la /proc/cpuinfo File paths must be specified in the WSL format. The commands passed into wsl.exe are forwarded to the WSL process without modification. To use the Linux command ls -la to list files and the PowerShell command > out.txt to print that list to a text file named "out.txt", combine the commands: C:\temp> wsl ls -la > out.txt To use the PowerShell command dir to list files and the Linux command grep to filter the results for words containing "git", combine the commands: C:\temp> dir | wsl grep git To use the Linux command ls -la to list files and the PowerShell command findstr to filter the results for words containing "git", combine the commands: wsl ls -la | findstr "git" Here are a few examples of mixing Linux and Windows commands using PowerShell. After entering your password correctly, your distribution will download updates. Your default Linux distribution user name will be listed after running this command and you will be asked for your password. Things such as sudo, piping, and file redirection work.Įxample using sudo to update your default Linux distribution: C:\temp> wsl sudo apt-get update The Linux command following wsl (or wsl.exe) is handled like any command run in WSL.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |