做网站卖什么条件,去申请注册一个中视频自媒体账号,网站建站建设多少钱,wordpress 安装插件文章目录 在Windows中运行Linux命令使用PowerShell混合使用Linux和Windows命令通过power shell在Windows混合使用Linux工具在Linux中混合使用Windows 工具 推荐阅读 Windows和Linux的工具和命令可以通过WSL互换使用。 可以在Linux子系统中运行Windows命令#xff0c;也可以在W… 文章目录 在Windows中运行Linux命令使用PowerShell混合使用Linux和Windows命令通过power shell在Windows混合使用Linux工具在Linux中混合使用Windows 工具 推荐阅读 Windows和Linux的工具和命令可以通过WSL互换使用。 可以在Linux子系统中运行Windows命令也可以在Windows中运行Linux子系统工具。 但是需要注意Windows和Linux文件系统以不同的方式处理大小写—Windows是不区分大小写的Linux是区分大小写的。
\\wsl$通过Windows查看Ubuntu文件目录
在Windows中运行Linux命令
分别在Ubuntu和Windows运行ls -la 指令 Ubuntu
ls -lawindows
wsl ls -la在Ubuntu中运行 ls -la可以看Ubuntu的文件目录在Windows power shell中运行wsl ls -la则可以看到Windows文件目录。 我们在Ubuntu中安装了dig工具那么除了可以在Ubuntu系统中使用也可以通过power shell中执行
wsl dig baidu.com 直接比照Ubuntu中的指令用法会有提示报错。
PS C:\Users\Administrator dig baidu.com
dig : The term dig is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s
pelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1dig baidu.com~~~ CategoryInfo : ObjectNotFound: (dig:String) [], CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundExceptionPS C:\Users\Administrator执行wsl dig baidu.com则可以正常执行并输出结果
PS C:\Users\Administrator wsl dig baidu.com; DiG 9.18.12-0ubuntu0.22.04.1-Ubuntu baidu.com
;; global options: cmd
;; Got answer:
;; -HEADER- opcode: QUERY, status: NOERROR, id: 47817
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;baidu.com. IN A;; ANSWER SECTION:
baidu.com. 429 IN A 39.156.66.10
baidu.com. 429 IN A 110.242.68.66;; Query time: 47 msec
;; SERVER: 114.114.114.114#53(114.114.114.114) (UDP)
;; WHEN: Tue Nov 28 14:59:15 CST 2023
;; MSG SIZE rcvd: 70PS C:\Users\Administrator在Windows使用sudo更新Linux子系统
wsl sudo apt-get updatePS C:\Users\Administrator wsl sudo apt-get update
[sudo] password for mirror:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:3 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [989 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1200 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1003 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [192 kB]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1143 kB]
Get:10 http://security.ubuntu.com/ubuntu jammy-security/restricted Translation-en [186 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [799 kB]
Fetched 5741 kB in 28s (202 kB/s)
Reading package lists... Done
PS C:\Users\Administrator使用PowerShell混合使用Linux和Windows命令
通过power shell在Windows混合使用Linux工具
用Linux的指令ls -la 列出文件目录再通过power shell的管道符 和findstr 指令找出目录中含有“Do”字符串的目录。
wsl ls -la | findstr DoPS C:\Users\Administrator wsl ls -la | findstr Do
drwxrwxrwx 1 mirror mirror 4096 Nov 9 10:59 Documents
drwxrwxrwx 1 mirror mirror 4096 Nov 21 16:01 Downloads
lrwxrwxrwx 1 mirror mirror 36 Mar 25 2022 My Documents - /mnt/c/Users/Administrator/Documents
PS C:\Users\Administrator先通过dir 查看当前文件目录
PS C:\Users\Administrator dirDirectory: C:\Users\AdministratorMode LastWriteTime Length Name
---- ------------- ------ ----
d-r--- 2022/3/25 13:23 3D Objects
d-r--- 2022/3/25 13:23 Contacts
d-r--- 2023/11/27 14:09 Desktop
d-r--- 2023/11/9 10:59 Documents
d-r--- 2023/11/21 16:01 Downloads
d-r--- 2022/3/25 13:23 Favorites
d-r--- 2022/3/25 13:23 Links
d-r--- 2022/3/25 13:23 Music
d-r--- 2022/3/25 13:24 OneDrive
d-r--- 2022/3/25 13:23 Pictures
d----- 2023/2/15 17:20 PycharmProjects
d-r--- 2022/3/25 13:23 Saved Games
d-r--- 2022/3/25 13:23 Searches
d-r--- 2023/6/13 13:24 Videos
d----- 2023/2/28 16:02 WebControlThird
-a---- 2023/11/2 15:10 1014 res.bmp
接着运用Windows和Linux混合指令找出含有“Do”字符串的目录
dir | wsl grep DoPS C:\Users\Administrator dir | wsl grep Do
d-r--- 2023/11/9 10:59 Documents
d-r--- 2023/11/21 16:01 Downloads
PS C:\Users\Administrator在Linux中混合使用Windows 工具
在Ubuntu中通过Windows ipconfig工具查看当前IP地址
mirrorUbuntu22:~$ ipconfig.exeWindows IP ConfigurationEthernet adapter 以太网:Connection-specific DNS Suffix . : domain.comLink-local IPv6 Address . . . . . : fe80::82b:d1c2:85c7:7798%10IPv4 Address. . . . . . . . . . . : 192.168.8.20Subnet Mask . . . . . . . . . . . : 255.255.255.0Default Gateway . . . . . . . . . : 192.168.8.250过滤IPv4地址 ipconfig.exe | grep IPv4mirrorUbuntu22:~$ ipconfig.exe | grep IPv4IPv4 Address. . . . . . . . . . . : 192.168.8.20
mirrorUbuntu22:~$再来一个Windows netsh工具的使用范例
mirrorUbuntu22:~$ netsh.exe
netshlan
netsh lanshow interfaceThere is 1 interface on the system:Name : 以太网Description : Intel(R) Ethernet Connection (11) I219-LMGUID : 32da7e41-d361-47c1-99b0-77e1a1a069d9Physical Address : 88-88-88-88-88-87State : Connected. Network does not support authentication.netsh lan 推荐阅读 Ubuntu挂载NFS(Network File System) 怎么解决权限不一致的问题 Ubuntu镜像源cn.arichinve.ubuntu.com不可用原因分析和解决 Windows 11安装Ubuntu 实战教程 PowerShell无人参与安装最新版本SQL Server Management Studio (SSMS) VRRP虚拟路由器冗余协议标准协议工作机制与优势介绍 Linux MTRMy TraceRoutecommand