当前位置:网站首页>Multipass中文文档-使用实例命令别名
Multipass中文文档-使用实例命令别名
2022-06-26 04:35:00 【但老师】
总目录(待翻译完完善)
1. 概览
2. 教程
3. 使用指引
3.1 安装Multipass
3.1.1 基于Linux
3.1.2 基于macOS
3.1.3 基于Windows
3.2 管理实例
3.2.1 创建实例
3.2.2 修改实例
3.2.3 使用实例
3.2.4 使用实例命令别名
3.2.5 与实例共享数据
3.2.6 移除实例
3.3 管理Multipass
3.3.1 设置驱动
3.3.2 使用Multipass服务授权代理
3.3.3 远程使用Multipass
3.3.4 提高挂载性能
3.3.5 使用Packer打包Multipass镜像
3.3.6 设置图像界面
3.3.7 使用不同的macOS终端
3.4 问题排查
3.4.1 连接日志
3.4.2 网络问题排查
使用实例命令别名
[版本1.8.0及之后]
这篇文档教授了在实例中如何创建, 列举, 执行和移除命令别名.
内容:
创建别名
也见: alias
使用命令alias在特定实例上创建可执行命令的别名. 下面代码使用了这个命令去创建一个别名lscc, 这个别名会在实例crazy-cat中执行命令ls:
$ multipass alias crazy-cat:ls lscc
在执行这个命令之后,别名lscc就会被定义在实例crazy-cat上, 并绑定了执行命令ls. 如果lscc被删除, 命令的别名就是默认命令(这种情况就是ls).
译注: 我理解这句话的意思就是: lscc别名被删除后, ls的默认别名就是ls, 即自己就是自己的命令别名
列举已定义别名
也见: aliases
看目前为止已定义的别名清单, 使用aliases命令:
$ multipass aliases
Alias Instance Command
lscc crazy-cat ls
执行别名
有两种方法执行别名.
multipass <alias>
第一种执行别名的方式是
$ multipass lscc
这会进入crazy-cat实例的shell, 并执行ls, 然后返回到主机命令行, 类似于exec命令
也支持参数, 用--进行分隔:
$ multipass lscc -- -l
<alias>
第二种执行别名的方法是一个两步过程:
添加Multipass别名脚本文件夹到系统路径
首先, 添加别名脚本文件夹到系统路径. 在你第一次创建别名的时候, 指引就会自动显示, 每个平台显示都不一样. 例如:
$ multipass alias crazy-cat:ls lscc
You'll need to add this to your shell configuration(.bashrc, .zshrc or so) for alias to work withour prefixing with `multipass`
PATH="$PATH:/home/user/snap/multipass/common/bin"
Linux
Linux上的shell配置需要修改一下. 在大多Linux版本中, 默认的shell是bash, 它可以在用户的home目录通过文件.bashrc配置. 任何文本编辑器都可以修改文件, 例如:
$ nano ~/.bashrc
在编辑文件的时候, 在正文末尾新增一行如下:
export PATH="$PATH:/home/user/snap/multipass/common/bin"
(记得在上述案例命令中将文件夹更改为正确的文件夹, 并重启shell)/
在使用zsh作为shell的场景中, 需要修改的文件是.zshrc而不是.bashrc; 步骤也是一样的.
macOS
在MacOS上,最常用的shell是zsh. 将文件夹加到系统路径的步骤和Linux上是一样的,如上所述
Windows
然而, 在Windows上,略微有点复杂。为了让修改永久化,需要使用PowerShell储存旧系统路径, 增加别名文件夹, 并且存储道新路径。
$old_path = (Get - ItemProperty - Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$new_path = "$old_path;C:\Users\<user>\AppData\Local\Multipass\bin"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $new_path
不要忘记重启终端。文件夹现在已经永久加到你的路径中了, Multipass现在可以通过引用别名来执行了。
执行别名
一旦你将别名文件夹加入到了系统路径, 你就可以直接(不需要写multipass)执行如下:
$ lsccat alias definition time,
这个命令(基于路径已经被加到系统路径)等价于multipass lscc. 并支持参数,且不需要--:
$lscc -l
移除别名
也见:unalias
最后,移除别名lscc,发出指令:
multipass unalias lscc
️当实例被清除(purged)的时候,别名也会被移除。这就意味着,
multipass delete crazy-cat --purge也会移除别名lscc。
原文链接
边栏推荐
- PHP inherited in class return does not work
- A brain map to summarize the needs analysis (a supplement to the actual situation at work)
- Analysis report on the development trend and operation status of China's environmental monitoring instrument industry from 2022 to 2028
- PHP syntax summary
- 做软件测试学历重要还是能力重要
- I like you!
- [Qunhui] import certificate
- Use shell script to analyze system CPU, memory and network throughput
- Redis cache message queue
- Mysql8.0 configuring my SQL in INI file_ mode=NO_ AUTO_ CREATE_ User can start
猜你喜欢

2020-12-18

Database design (3): database maintenance and optimization

Gateway can not connect to tcp://127.0.0.1: Connection refused

Thinkphp6 implements a simple lottery system
![Fastadmin always prompts sqlstate[23000]: integrity constraint violation: 1052 column 'ID' in order clause is am](/img/71/ed3b2ca9e6d4afd2dae3c601b3a75b.jpg)
Fastadmin always prompts sqlstate[23000]: integrity constraint violation: 1052 column 'ID' in order clause is am

NVM installation and use and NPM package installation failure record

Your requirements could not be resolved

PIP batch complete uninstall package
![[Qunhui] no port access (reverse proxy + intranet penetration)](/img/bc/b1e0c5c382e30fbcea28fbc68c1151.jpg)
[Qunhui] no port access (reverse proxy + intranet penetration)

Svn error command revert error previous operation has not finished; run ‘ cleanup‘ if
随机推荐
Laravel file stream download file
Nabicat connection: local MySQL & cloud service MySQL and error reporting
Install cenos in the virtual machine
排序查询
Performance test comparison between PHP framework jsnpp and thinkphp6
numpy 数据输入输出
微软禁止俄用户下载安装Win10/11
PHP splits a string into arrays
Laravel uses phpword to generate word documents
Jenkins introduces custom jars
Mysql8.0 configuring my SQL in INI file_ mode=NO_ AUTO_ CREATE_ User can start
1.13 learning summary
What is the best way to store chat messages in a database? [Close] - best way to store chat messages in a database? [closed]
How to use the configured slave data source for the scheduled task configuration class scheduleconfig
MySQL index details
Nabicat连接:本地Mysql&&云服务Mysql以及报错
CTF serialization and deserialization
mysql高级学习(跟着尚硅谷老师周阳学习)
Oracle 數據泵導錶
Clean up photo SCR virus / iframekill injection removal /iframekill removal photo scr