MENU

Nushell

• 2021 年 07 月 07 日 • Linux

NuShell

采用Rust写的,安全性提高的同时,Bug率也降低了,NuShell 专注于实现以下目标:

  • 创建具有现代感的灵活的跨平台Shell
  • 允许你将命令行应用程序与可理解数据结构的Shell进行混合和匹配
  • 具有现代命令行应用程序提供的用户体验优化

Github地址

第 1 步:安装开发人员工具

Ubuntu / Debian:

sudo apt update
sudo apt install pkg-config libssl-dev -y
sudo apt install libxcb-composite0-dev libx11-dev -y

基于 RHEL 的系统:

sudo yum install libxcb openssl-devel libX11-devel -y

苹果系统:

brew install openssl cmake

第 2 步:在 Linux 上安装 Nushell

下载最新的二进制归档文件:

cd /tmp
curl -s  https://api.github.com/repos/nushell/nushell/releases/latest | grep browser_download_url |  cut -d '"' -f 4 | grep '\linux.tar.gz' | wget -i -

解压下载的文件:

tar -xvf nu_*_linux.tar.gz

将二进制文件复制到您的 PATH:

sudo mv nu_*_linux/nushell-*/nu /usr/local/bin

Nushell将在启动时在您的 PATH中查找插件。虽然Nushell在没有它们的情况下会有一些功能,但要获得完整的功能,你需要将它们复制到您的路径中,以便加载它们。

sudo mv nu_*_linux/nushell-*/nu_plugin* /usr/local/bin

Fedora 用户可以使用COPR repo安装Nushell:

sudo dnf copr enable atim/nushell -y && sudo dnf install nushell -y

用到了dnf copr需要安装dnf-plugins-core

yum install -y dnf
wget -P /etc/yum.repos.d/ https://copr.fedoraproject.org/coprs/jkastner/dnf-plugins-core/repo/epel-7/jkastner-dnf-plugins-core-epel-7.repo && yum install dnf-plugins-core

第 3 步:将用户 Shell 设置为 Nushell

创建一个名为techviewleo的新用户:

$ sudo adduser techviewleo
Adding user `techviewleo' ...
Adding new group `techviewleo' (1000) ...
Adding new user `techviewleo' (1000) with group `techviewleo' ...
Creating home directory `/home/techviewleo' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for techviewleo
Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
Is the information correct? [Y/n] y

将用户默认 shell 设置为 Nu:

sudo chsh -s /usr/local/bin/nu techviewleo

切换到创建的用户帐户:

$ su - techviewleo
Password:
Welcome to Nushell 0.28.0 (type 'help' for more info)
/home/techviewleo>

测试 ls 命令在 Nushell 中的工作方式:

$ su - techviewleo
Password:
Welcome to Nushell 0.28.0 (type 'help' for more info)
/home/techviewleo>