Betty怎么安装使用

53次阅读
没有评论

共计 3479 个字符,预计需要花费 9 分钟才能阅读完成。

本篇内容主要讲解“Betty 怎么安装使用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让丸趣 TV 小编来带大家学习“Betty 怎么安装使用”吧!

安装

Betty 的安装非常简单直接。首先确认你已经安装了下面这些依赖包 [LCTT 译注,需要安装至少 Ruby1.9 以上版本]。

对于基于 Debian 的系统:

sudo apt-get install git curl ruby

对于基于 RPM 的系统:

yum install git curl ruby

现在用 git 工具把 Betty 库 clone 到你自定义的任何路径。这里我克隆到我的 home 目录,例如 /home/sk/.

git clone https://github.com/pickhardt/betty

添加 betty 的别名到你的 bashrc 配置文件。

sudo nano ~/.bashrc

将下列行添加到文件的末尾:

alias betty= /home/sk/betty/main.rb

确保你已经正确地设置好了 betty 的路径。

好了,现在是时候和 betty 好好地玩耍了。

用法

你应该在英语短语之前加上单词“betty”[LCTT 译注,你自然可以用你的小甜心的名字来替换这个不是知道是谁的 Betty :]。你也许已经知道,如果我们想知道在系统中我们的用户名,应该运行下面的命令:

whoami

输出是这样的:

sk

如你所见,我当前登录的用户名是 sk. 现在我也可以通过下面的 betty 命令获取相同的结果。

betty whats my username

输出是这样的:

Betty: Running whoami
sk

真的好酷,是不是?Betty 理解我输入的“whats my username”短语,然后运行“whoami”命令,*** 输出结果。

让我们也来看其他命令。

如果你的输入不够准确,Betty 也能以多种方式回应你。例如,我们运行下面的命令:

betty whats my name

Betty 不确定她应该查找系统用户名还是用户全名。这种情况下,她会询问你多个问题来找到准确的结果。如你下面所见,Betty 问我想要运行哪一条命令(whoami 还是 finger $(whoami) | sed s/.://;q )[LCTT 译注,需要你的系统已经安装 finger]。我只想知道我的用户名,所以我选择数字 1。

Betty: Okay, I have multiple ways to respond.
Betty: Enter the number of the command you want me to run, or N (no) if you don t want me to run any.
[1] whoami
Gets your system username.
[2] finger $(whoami) | sed  s/.*: *//;q 
Gets your full name.
Betty: Running whoami
sk

压缩和解压缩文件夹

如果你想要压缩一个文件或者文件夹,用下面的命令。例如,我想压缩我 home 目录下的“test”文件夹。

betty compress test/ test.tar.gz

输出是这样的:

Betty: Running tar -czvf test.tar.gz test/
test/
test/home/
test/home/sk/
test/home/sk/test/
test/home/sk/test/sample

类似的,我们可以用下面的命令来解压缩一个归档文件。

betty uncompress test.tar.gz

输出是这样的:

Betty: Running mkdir test  tar -zxvf test.tar.gz -C test
test/
test/home/
test/home/sk/
test/home/sk/test/
test/home/sk/test/sample

完整的 Betty 命令行列表

Betty 工具有一些命令格式。如果你输入“what is my user name”而不是“whats my username”,它是不能识别的。所以,你只能输入 Betty 支持的英语短语。

下面给出一个 Betty 支持的完整的命令行列表。

Count:
betty how many words are in this directory
betty how many characters are in myfile.py
betty count lines in this folder
(Note that there s many ways to say more or less the same thing.)
Config:
betty change your name to Joe
betty speak to me
betty stop speaking to me
Datetime:
betty what time is it
betty what is todays date
betty what month is it
betty whats today
Find:
betty find me all files that contain california
Internet:
betty download http://www.mysite.com/something.tar.gz to something.tar.gz
betty uncompress something.tar.gz
betty unarchive something.tar.gz to somedir
(You can use unzip, unarchive, untar, uncompress, and expand interchangeably.)
betty compress /path/to/dir
iTunes:
betty mute itunes
betty unmute itunes
betty pause the music
betty resume itunes
betty stop my music
betty next song
betty prev track
betty what song is playing
(Note that the words song, track, music, etc. are interchangeable)
betty go crazy
betty whats the meaning of life
...and more that are left for you to discover!
betty show me a map of mountain view
Meta:
betty what version are you (or just betty version)
betty whats your github again
Permissions:
betty give me permission to this directory
betty give anotheruser ownership of myfile.txt
Process:
betty show me all processes by root containing grep
betty show me all my processes containing netbio
Sizes:
betty show size for myfile.txt
Spotify:
betty play spotify
betty pause spotify
betty next spotify
betty previous spotify
User:
betty whats my username
betty whats my real name
betty whats my ip address
betty who else is logged in
betty whats my version of ruby
Web queries:
betty turn web on
betty please tell me what is the weather like in London

到此,相信大家对“Betty 怎么安装使用”有了更深的了解,不妨来实际操作一番吧!这里是丸趣 TV 网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-16发表,共计3479字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)