溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Betty怎么安裝使用

發(fā)布時(shí)間:2021-12-24 15:30:24 來(lái)源:億速云 閱讀:171 作者:iii 欄目:系統(tǒng)運(yùn)維

本篇內(nèi)容主要講解“Betty怎么安裝使用”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“Betty怎么安裝使用”吧!

安裝

Betty的安裝非常簡(jiǎn)單直接。首先確認(rèn)你已經(jīng)安裝了下面這些依賴包[LCTT譯注,需要安裝至少Ruby1.9以上版本]。

對(duì)于基于Debian的系統(tǒng):
sudo apt-get install git curl ruby
對(duì)于基于RPM的系統(tǒng):
yum install git curl ruby

現(xiàn)在用git工具把Betty庫(kù)clone到你自定義的任何路徑。這里我克隆到我的home目錄,例如 /home/sk/.

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

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

sudo nano ~/.bashrc

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

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

確保你已經(jīng)正確地設(shè)置好了betty的路徑。

好了,現(xiàn)在是時(shí)候和betty好好地玩耍了。

用法

你應(yīng)該在英語(yǔ)短語(yǔ)之前加上單詞“betty”[LCTT譯注,你自然可以用你的小甜心的名字來(lái)替換這個(gè)不是知道是誰(shuí)的Betty :>]。你也許已經(jīng)知道,如果我們想知道在系統(tǒng)中我們的用戶名,應(yīng)該運(yùn)行下面的命令:

whoami

輸出是這樣的:

sk

如你所見(jiàn),我當(dāng)前登錄的用戶名是 sk. 現(xiàn)在我也可以通過(guò)下面的betty命令獲取相同的結(jié)果。

betty whats my username

輸出是這樣的:

Betty: Running whoami
sk

真的好酷,是不是?Betty理解我輸入的“whats my username”短語(yǔ),然后運(yùn)行“whoami”命令,***輸出結(jié)果。

讓我們也來(lái)看其他命令。

如果你的輸入不夠準(zhǔn)確,Betty也能以多種方式回應(yīng)你。例如,我們運(yùn)行下面的命令:

betty whats my name

Betty不確定她應(yīng)該查找系統(tǒng)用戶名還是用戶全名。這種情況下,她會(huì)詢問(wèn)你多個(gè)問(wèn)題來(lái)找到準(zhǔn)確的結(jié)果。如你下面所見(jiàn),Betty問(wèn)我想要運(yùn)行哪一條命令(whoami 還是 finger $(whoami) | sed 's/.://;q')[LCTT譯注,需要你的系統(tǒng)已經(jīng)安裝finger]。我只想知道我的用戶名,所以我選擇數(shù)字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.
1
Betty: Running whoami
sk

壓縮和解壓縮文件夾

如果你想要壓縮一個(gè)文件或者文件夾,用下面的命令。例如,我想壓縮我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

類似的,我們可以用下面的命令來(lái)解壓縮一個(gè)歸檔文件。

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”,它是不能識(shí)別的。所以,你只能輸入Betty支持的英語(yǔ)短語(yǔ)。

下面給出一個(gè)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)

Fun:
betty go crazy
betty whats the meaning of life
...and more that are left for you to discover!

Map:
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

到此,相信大家對(duì)“Betty怎么安裝使用”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI