自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

用 tmate 分享你的 Linux 終端

系統(tǒng) Linux
tmate 擴(kuò)展了你分享 Linux 終端會(huì)話的方式。

作為 Fedora Linux QA 團(tuán)隊(duì)的一員,我有時(shí)想將自己執(zhí)行的一堆命令廣而告之給其他開發(fā)者。如果你曾經(jīng)使用過像 tmux 或 GNU Screen 這樣的 終端復(fù)用器,你可能會(huì)認(rèn)為這是一個(gè)挺輕松的任務(wù)。不是所有看我的示范的人都是從筆記本電腦或臺(tái)式機(jī)連接到我的終端會(huì)話的,有些人可能是隨手在他們的手機(jī)瀏覽器中打開的,因?yàn)槲沂褂昧?nbsp;tmate,所以他們可以很容易地做到這一點(diǎn)。

使用 tmate 分享 Linux 終端

觀看別人在 Linux
終端的工作是非常有教育意義的。你可以學(xué)到新的命令、新的工作流程,或者新的調(diào)試和自動(dòng)化的方法。但要抓住你所看到的東西,以便你以后可以自己嘗試,這可能很困難。你可能會(huì)借助截圖或一個(gè)共享終端會(huì)話的屏幕記錄,這樣你就可以在以后打出每個(gè)命令。剩下的唯一選擇是由演示命令的人使用 Asciinema 或 script 和 scriptreplay 等工具來記錄會(huì)話。

但是通過 ??tmate??,用戶可以在只讀模式下或通過 SSH 分享終端。SSH 和只讀會(huì)話都可以通過終端或以 HTML 網(wǎng)頁的形式訪問。

當(dāng)我為 Fedora QA 團(tuán)隊(duì)培訓(xùn)人員時(shí),我使用只讀模式,因?yàn)槲倚枰\(yùn)行命令并顯示輸出,但有了 ??tmate??,人們可以通過從他們的瀏覽器復(fù)制和粘貼到文本編輯器來記錄筆記。

Linux tmate 上手

在 Linux 上,你可以用你的包管理器安裝 ??tmate??。例如,在 Fedora 上:

    $ sudo dnf install tmate

在 Debian 和類似的發(fā)行版上:

    $ sudo apt install tmate

在 macOS 上,你可以用 Homebrew 或 MacPorts 安裝它。如果你需要其他 Linux 發(fā)行版的說明,請(qǐng)參考 ??安裝?? 指南。

Screenshot of terminal showing the options for tmate sharing: web session (regular and read-only) and ssh session (regular and read-only)

Screenshot  of terminal showing the options for tmate sharing: web session (regular and read-only) and ssh session (regular and read-only)

安裝后,啟動(dòng) ??tmate??:

當(dāng) ??tmate?? 啟動(dòng)時(shí),會(huì)生成鏈接,通過 HTTP 和 SSH 提供對(duì)終端會(huì)話的訪問。每個(gè)協(xié)議都有一個(gè)只讀方式,以及一個(gè)反向的 SSH 會(huì)話。

下面是一個(gè)網(wǎng)絡(luò)會(huì)話的樣子:

Screenshot showing tmate terminal window and 2 versions of sharing sessions demonstrating the same code

Screenshot showing tmate terminal window and 2 versions of sharing sessions demonstrating the same code

??tmate?? 的網(wǎng)絡(luò)控制臺(tái)是 HTML5 的,因此,用戶可以復(fù)制整個(gè)屏幕并粘貼到終端來運(yùn)行相同的命令。

保持會(huì)話

你可能想知道如果你不小心關(guān)閉了你的終端會(huì)發(fā)生什么。你也可能想知道如何與不同的控制臺(tái)應(yīng)用共享你的終端。畢竟,??tmate?? 是一個(gè)多路復(fù)用器,所以它應(yīng)該能夠保持會(huì)話,脫離并重新連接到一個(gè)會(huì)話,等等。

當(dāng)然,這正是 ??tmate??? 所能做到的。如果你曾經(jīng)使用過 ??tmux??,這可能是相當(dāng)熟悉的。

    $ tmate -F -n web new-session vi console

這個(gè)命令在 ??vi?? 中打開了 ??new-session??,??-F?? 選項(xiàng)確保會(huì)話在關(guān)閉時(shí)也能重新產(chǎn)生。

A screenshot of the terminal showing the output after using the new-session and -F options: connection information for either a web session (regular or read-only) or ssh session (regular or read-only)

A screenshot of the terminal showing the output after using the new-session and -F options: connection information for either a web session (regular or read-only) or ssh session (regular or read-only)

社交復(fù)用

??tmate?? 給你帶來了 ??tmux?? 或 GNU Screen 的自由度,以及與他人分享會(huì)話的能力。這是一個(gè)有價(jià)值的工具,可以教其他用戶如何使用終端、演示一個(gè)新命令的功能,或調(diào)試意外的行為。它是開源的,所以請(qǐng)?jiān)囈辉嚕?/p>

責(zé)任編輯:龐桂玉 來源: Linux中國
相關(guān)推薦

2021-01-05 09:55:46

TmateLinux命令

2022-01-27 15:37:34

Asciinema終端會(huì)話記錄器開源

2021-08-24 16:20:38

Linux終端

2020-06-01 16:45:44

Linux終端Terminus

2020-01-27 10:48:55

Linux終端技巧

2021-08-12 15:00:01

Linux終端

2020-07-20 10:40:52

Linux命令Ubuntu

2016-07-18 14:49:22

操作系統(tǒng)Linux終端操作

2015-05-15 13:25:43

Linux終端命令

2015-05-13 14:26:40

LinuxLinux終端命令

2021-03-07 13:00:47

Linux終端外觀

2022-07-18 07:12:33

開源Linux

2015-08-24 15:33:54

Linux 終端公有IP

2020-04-03 11:24:50

LinuxUnix進(jìn)程

2014-09-11 14:18:18

Linux

2025-02-10 09:20:00

LinuxScreen終端

2021-07-23 16:15:35

Linux編輯器代碼

2019-09-10 15:20:26

Linux終端命令

2021-02-24 14:00:42

LinuxChromebook谷歌

2023-10-22 08:39:13

Linux目錄切換
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)