美文网首页
在windows下体验Linux一些指令

在windows下体验Linux一些指令

作者: 该帐号已被查封_才怪 | 来源:发表于2020-11-03 20:04 被阅读0次

一、在windows下体验Linux方法

(一)、 windows terminal+oh-my-posh+posh-git + PSReadline(如果使用的是PowerShell Core则需要安装PSReadline) 【win10】

1、下载Windows Terminal
https://www.microsoft.com/zh-cn/p/windows-terminal/9n0dx20hk701?rtc=1&activetab=pivot:overviewtab
https://github.com/microsoft/terminal
2、使用PowerShell安装oh-my-posh+posh-git + PSReadline(如果使用的是PowerShell Core则需要安装PSReadline)

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
// 如果您使用的是PowerShell Core,请安装PSReadline:
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck

3、修改脚本执行策略
在PowerShell上以管理员身份运行

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

4、配置oh-my-posh+posh-git
在PowerShell上使用指令notepad $PROFILE 或你选择的文本编辑器打开PowerShell配置文件 添加如下启动脚本:

Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme paradox

5、重启PowerShell即可

image.png

6、推荐资料

7、Powershell Core (非Windows自带的Powershell) 步骤

详见 https://zhuanlan.zhihu.com/p/137595941
Powershell Core https://github.com/PowerShell/PowerShell

(二)、 Windows Subsystem for Linux (WSL)组件框架【win10】

1、安装资料
https://zhuanlan.zhihu.com/p/34950508
https://docs.microsoft.com/zh-cn/windows/wsl/about
https://docs.microsoft.com/zh-cn/windows/wsl/install-win10
2、win10与子系统Ubuntu文件互访

  • 2.1、win10下查看Ubuntu文件
    C:\Users\用户名\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\用户名
    当然,UbuntuonWindows_79rhkp1fndgsc可能是其他版本,如:
    C:\Users\用户名\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\用户名
  • 2.2、Ubuntu访问win10文件
    cd /mnt, 如想访问c盘,则cd /mnt/c即可。
  • 2.3、Ubuntu图形界面
    a、在桌面上打开“Filesystemroot”
    b、进入“mnt”文件夹,即可看到win10下所有的盘

详见:https://blog.csdn.net/weixin_41921520/article/details/97782440

(三)、win7之前 使用 Windows Services for UNIX

二、安装cygwin及Linux一些指令(不推荐)

1、进入 https://www.cygwin.com/ 下载cygwin

image.png

2、进入 https://cygwin.com/mirrors.html 并选择China的镜像网址如 http://mirrors.163.com/cygwin/

image.png

3、将 China的镜像网址如 http://mirrors.163.com/cygwin/ 添加至 cygwin 并点击下一步

image.png

4、搜索cygwin 没有自带的指令名称如 wget (为了断点续传 wget -c 或镜像网站wget –mirror )点击下一步


image.png

这里有个坑,就是一定要点Skip 显示版本后再 点击下一步

5、安装至最后一步时记得添加Cygwin图标至桌面,这样方便使用 Cygwin64 Terminal;

6、安装其他Linux指令如浏览网页lynx、links、w3m的时,可以点击cygwin 安装包setup-x86_64.exe 循环执行上面的步骤即可;

lynx links w3m

三、推荐资料

1、8个用于在Linux中浏览网站和下载文件的命令行工具
https://www.howtoing.com/command-line-web-browser-download-file-in-linux/

2、5个基于Linux命令行的工具,用于下载文件和浏览网站
https://www.howtoing.com/linux-command-line-tools-for-downloading-files/

3、 wget命令详解

4、Windows terminal https://github.com/microsoft/terminal

相关文章

网友评论

      本文标题:在windows下体验Linux一些指令

      本文链接:https://www.haomeiwen.com/subject/qnobvktx.html