ubuntu自定義菜單_如何自定義Ubuntu的每日消息

ubuntu自定義菜單

ubuntu自定義菜單

Ubuntu displays an informative message, known as the message of the day, when a user logs in at the terminal. The MOTD is fully customizable — you can add your own text and other dynamic data.

當用戶在終端上登錄時,Ubuntu將顯示信息性消息,即當日消息。 MOTD是完全可定制的-您可以添加自己的文本和其他動態數據。

When a user logs in, the pam_motd process executes the scripts in the /etc/update-motd.d directory?and dynamically creates the message of the day. You can customize the MOTD by modifying the scripts, removing them or writing your own scripts.

當用戶登錄時,pam_motd進程將執行/etc/update-motd.d目錄中的腳本并動態創建當天的消息。 您可以通過修改腳本,刪除腳本或編寫自己的腳本來自定義MOTD。

每日默認消息 (The Default Message of the Day)

The message of the day is only shown when you log into Ubuntu in text mode, not graphical mode. You can access a virtual terminal with the Ctrl-Alt-F1 shortcut if you’re using a graphical desktop — use the Ctrl-Alt-F7 shortcut to get back to your graphical desktop, also known as your X server. Ctrl-Alt-F2 through Ctrl-Alt-F6 will take you to other virtual terminals.

僅當您以文本模式而非圖形模式登錄Ubuntu時,才會顯示當天的消息。 如果您使用的是圖形桌面,則可以使用Ctrl-Alt-F1快捷方式訪問虛擬終端-使用Ctrl-Alt-F7快捷方式返回圖形桌面(也稱為X服務器)。 Ctrl-Alt-F2到Ctrl-Alt-F6會將您帶到其他虛擬終端。

Here’s Ubuntu’s standard MOTD. It shows the typical system version numbers you’ll be familiar with if you’re a long-time Linux user. It also shows dynamically generated information about available updates and static messages about Ubuntu’s license.

這是Ubuntu的標準MOTD。 如果您是長期使用Linux的用戶,它將顯示您會熟悉的典型系統版本號。 它還顯示有關可用更新的動態生成信息以及有關Ubuntu許可證的靜態消息。

添加自定義消息 (Adding a Custom Message)

Let’s say you want to add a custom message users will see when they log into your Ubuntu system. Ubuntu’s MOTD is generated by scripts when you log in, so you can’t just add it to the /etc/motd file. The place to put your own static messages is /etc/motd.tail — the contents of this file are added to the end of the MOTD when it’s generated.

假設您要添加一個自定義消息,用戶登錄到Ubuntu系統時將看到這些消息。 登錄時,Ubuntu的MOTD是由腳本生成的,因此不能僅將其添加到/ etc / motd文件中。 放置自己的靜態消息的位置是/etc/motd.tail-該文件的內容在生成時會添加到MOTD的末尾。

Let’s use the Nano text editor to open the /etc/motd.tail file with the following command: (Linux terminal wizards can use Vi or Emacs, but Nano is easier for newbies)

讓我們使用Nano文本編輯器通過以下命令打開/etc/motd.tail文件:(Linux終端向導可以使用Vi或Emacs,但是Nano對于新手來說更容易)

sudo nano /etc/motd.tail

須藤nano /etc/motd.tail

This file is completely empty by default. Just enter any message you like — feel free to go crazy with black-and-white ASCII art here. Once you’re done, save the file with Ctrl+O and Enter, then exit Nano with Ctrl+X.

默認情況下,此文件完全為空。 只要輸入您喜歡的任何消息,即可在這里隨意使用黑白ASCII藝術。 完成后,使用Ctrl + O保存文件并按Enter,然后使用Ctrl + X退出Nano。

The next time any user logs in, they’ll see your custom message. If you want to check it out immediately, log out of the terminal with the exit command and log back in.

下次任何用戶登錄時,他們都會看到您的自定義消息。 如果要立即檢出,請使用exit命令注銷終端并重新登錄。

刪除信息 (Removing Information)

Now let’s say we want to remove some of the default information. It’s not just a matter of editting a single file — each section is automatically generated from a script located in the /etc/update-motd.d directory.

現在,我們要刪除一些默認信息。 這不僅僅是編輯單個文件的問題-每個部分都是從/etc/update-motd.d目錄中的腳本自動生成的。

You can get a full list of the files in this directory by typing /etc/update-motd.d at the terminal and pressing Tab.

通過在終端上鍵入/etc/update-motd.d并按Tab,可以獲取此目錄中文件的完整列表。

The scripts are run in numerical order, which is why they’re prefixed with numbers. You could rename the script files and change the numbers to rearrange the order of the different sections in the MOTD, if you liked.

腳本按數字順序運行,這就是為什么要給它們加上數字前綴的原因。 如果愿意,可以重命名腳本文件并更改編號以重新排列MOTD中不同部分的順序。

To remove a script’s information from the MOTD, we just have to prevent it from running. We can do this by removing its execute permissions with the chmod -x command.

要從MOTD中刪除腳本的信息,我們只需要阻止其運行即可。 我們可以通過使用chmod -x命令刪除其執行權限來實現。

If we wanted to remove the documentation text in the MOTD, we’d run the following command:

如果要刪除MOTD中的文檔文本,請運行以下命令:

sudo chmod -x /etc/update-motd.d/10-help-text

須藤chmod -x /etc/update-motd.d/10-help-text

The next time a user logs in, they won’t see the documentation line.

用戶下次登錄時,將不會看到文檔行。

添加動態信息 (Adding Dynamic Information)

We can write our own scripts to add any dynamic information we like to the MOTD. As an example, let’s try using the weather-util package to create a script that adds the current local weather to the MOTD.

我們可以編寫自己的腳本,將我們喜歡的任何動態信息添加到MOTD。 例如,讓我們嘗試使用weather-util包創建一個腳本,該腳本將當前的本地天氣添加到MOTD。

It’s not installed by default, so let’s install it with the following command:

默認情況下未安裝它,因此讓我們使用以下命令進行安裝:

sudo apt-get install weather-util

sudo apt安裝weather-util

You’ll need your local International Civil Aviation Organization code, which you can get from this website. Here’s how to use weather-util with your code:

您需要本地國際民航組織的代碼,可以從該網站獲得。 這是在您的代碼中使用weather-util的方法:

weather -i CODE

天氣-i代碼

Now let’s use the following command to create a script in the appropriate location and open it with Nano:

現在,讓我們使用以下命令在適當的位置創建腳本并使用Nano打開它:

sudo nano /etc/update-motd.d/98-weather

須藤納米/etc/update-motd.d/98-weather

After Nano opens, enter the following code, replacing CODE with your local weather code:

Nano打開后,輸入以下代碼,將CODE替換為您當地的天氣代碼:

#!/bin/sh

#!/ bin / sh

echo weather -i CODE echo

回聲天氣-i CODE回聲

Press Ctrl-O and Enter to save, then press Ctrl-X to quit.

按Ctrl-O和Enter鍵保存,然后按Ctrl-X退出。

Make the script executable with chmod +x or it won’t run:

使用chmod + x使腳本可執行,否則它將無法運行:

sudo chmod +x /etc/update-motd.d/98-weather

須藤chmod + x /etc/update-motd.d/98-weather

Now users will see a local weather forecast when they log in. There’s nothing special about weather-util — you can use any command that prints text to the terminal.

現在,用戶登錄時將看到本地天氣預報。weather-util沒什么特別的-您可以使用任何將文本打印到終端的命令。



The MOTD isn’t only displayed when users log in locally. Any users that log in remotely with SSH or Telnet will also see your customized MOTD.

僅當用戶本地登錄時才顯示MOTD。 使用SSH或Telnet遠程登錄的所有用戶還將看到您自定義的MOTD。

翻譯自: https://www.howtogeek.com/104708/how-to-customize-ubuntus-message-of-the-day/

ubuntu自定義菜單

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/279117.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/279117.shtml
英文地址,請注明出處:http://en.pswp.cn/news/279117.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

java避免使用orderby_java – @OrderBy在JPA中無法正常工作

OrderBy如何運作?它在以下代碼中不起作用:Employee.javapackage com.semanticbits.pojo;import java.util.List;import javax.persistence.CascadeType;import javax.persistence.Embedded;import javax.persistence.Entity;import javax.persistence.Ge…

BigDecimal四舍五入與保留位

1.引言 借用《Effactive Java》這本書中的話,float和double類型的主要設計目標是為了科學計算和工程計算。他們執行二進制浮點運算,這是為了在廣域數值范圍上提供較為精確的快速近似計算而精心設計的。然而,它們沒有提供完全精確的結果&#…

火狐web開發清楚緩存_如何使用Firefox的Web開發工具

火狐web開發清楚緩存Firefox’s Web Developer menu contains tools for inspecting pages, executing arbitrary JavaScript code, and viewing HTTP requests and other messages. Firefox 10 added an all-new Inspector tool and updated Scratchpad. Firefox的Web Develop…

Leetcode400Nth Digit第N個數字

在無限的整數序列 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...中找到第 n 個數字。 注意: n 是正數且在32為整形范圍內 ( n < 231)。 示例 1: 輸入: 3 輸出: 3 示例 2: 輸入: 11 輸出: 0 說明: 第11個數字在序列 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... 里是0&#xff0c;它是…

Java基類共同屬性設置_多選擇基類的訪問屬性-Java初學筆記

多選擇基類的訪問屬性你現在知道在定義類的訪間屬性時可用的選擇項&#xff0c;你希望使用這些類定義子類。你知道在類繼承上這些屬性所具有的效果&#xff0c;但是你如何決定到底應該使用哪一個呢?這里沒有死板和現成的規則&#xff0c;你選擇的訪問屬性取決于在將來你想用類…

IT:如何在Windows Server 2008 R2上安裝Hyper-V虛擬化

Windows Server 2008 R2 and later releases of the product ship with a virtualization platform called Hyper-V, which works quite well since it’s built into Windows. Today we’re going to show you how to install it. Windows Server 2008 R2和更高版本的產品附帶…

FineReport單行與數據庫交互的方法

1. 問題描述 我們在做一張報表填報的時候經常會遇到需要在一行進行添加動作&#xff0c;將該行數據直接與數據庫交互&#xff0c;執行存儲過程過程。我們可以通過每一行增加帆軟“插入”按鈕實現插入動作&#xff0c;并且在控件事件中增加和數據庫的交互&#xff0c;但當事件…

java cas volatile_每日一個知識點:Volatile 和 CAS 的弊端之總線風暴

每日一個知識點系列的目的是針對某一個知識點進行概括性總結&#xff0c;可在一分鐘內完成知識點的閱讀理解&#xff0c;此處不涉及詳細的原理性解讀。一、什么是總線風暴總線風暴&#xff0c;聽著真是一個帥氣的詞語&#xff0c;但如果發生在你的系統上那就不是很美麗了&#…

SqlServer之代碼塊相關

轉載必需注明出處:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/sqlserver-codeblock/ 一、go語句 Go語句是SqlServer中用來表示當前代碼塊結束提交并確認結果的語句。 Go語句不能和其他Sql命令卸載同一行上&#xff01; 定義的局部變量作用域局限在定義它的代碼…

010 使用list和tuple

list Python內置的一種數據類型是列表&#xff1a;list。list是一種有序的集合&#xff0c;可以隨時添加和刪除其中的元素。 比如&#xff0c;列出班里所有同學的名字&#xff0c;就可以用一個list表示&#xff1a; >>> classmates [Michael, Bob, Tracy] >>&g…

IT:如何使用Server 2008 R2上的遠程桌面服務設置自己的終端服務器

In today’s IT learning article, we are going to take a look at installing Terminal Services, otherwise known as Remote Desktop Services, on a Server 2008 R2 machine. 在今天的IT學習文章中&#xff0c;我們將介紹在Server 2008 R2計算機上安裝終端服務(也稱為遠程…

java 中的chartdata_獲取Helm Charts中的文件夾列表

獲得了位于templates文件夾之外的配置文件列表&#xff0c;我們將其輸入到如下的helm圖表中&#xff1a;├── configs│ ├── AllEnvironments│ │ ├── Infrastructure│ │ └── Services│ │ ├── ConfigFile1│ │ ├── ConfigFile2│ ├…

Win10 jdk的安裝以及環境變量的配置,及需要注意的坑

此篇文章獻給自己&#xff0c;希望下次長點記性 最近本人終于有時間開始學習appium&#xff0c;并且開始在電腦上配置環境&#xff0c;第一步就是在我那剛裝的Win10 系統上安裝jdk&#xff0c;過程并不順利&#xff0c;由于之前都是用的win7&#xff0c;幾乎都是一路的下一步&a…

java部分服務出現異常_Java web service 異常

1.org/apache/commons/discovery/tools/DiscoverSingletonException in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton缺少&#xff1a;commons-logging和commons-discovery2.ojava.lang.NoClassDefFoundErr…

Jenkins配置Findbugs做源代碼安全掃描

2019獨角獸企業重金招聘Python工程師標準>>> 此內容目標閱讀用戶&#xff1a;運維人員 配置步驟如下&#xff1a; Jenkins安裝Findbugs插件 Jenkins系統管理 → 管理插件 → (可選插件)找到Findbugs及其依賴插件全部安裝成功&#xff0c;Jenkins重啟&#xff0c;即可…

如何從USB運行Windows 8 Developer Preview

Running Windows 8 from a USB should not be confused with installing Windows on a USB drive–in this case, instead of installing it on the drive, we’re just running it straight from the portable drive. Here’s how to do it. 從USB運行Windows 8不應與在USB驅動…

PAT-乙級-1042 字符統計

請編寫程序&#xff0c;找出一段給定文字中出現最頻繁的那個英文字母。 輸入格式&#xff1a; 輸入在一行中給出一個長度不超過 1000 的字符串。字符串由 ASCII 碼表中任意可見字符及空格組成&#xff0c;至少包含 1 個英文字母&#xff0c;以回車結束&#xff08;回車不算在內…

acm教程 java版_[轉]ACM之java速成

這里指的java速成&#xff0c;只限于java語法&#xff0c;包括輸入輸出&#xff0c;運算處理&#xff0c;字符串和高精度的處理&#xff0c;進制之間的轉換等&#xff0c;能解決OJ上的一些高精度題目。1. 輸入&#xff1a;格式為&#xff1a;Scanner cin new Scanner(newBuffe…

配置SSH非管理員用戶登錄

以root身份登進系統后&#xff0c;增加一個非root帳戶&#xff0c;名稱為:systemadmin&#xff0c;密碼按您的需求設置一個即可。接下來我們要禁止root直接登陸。 [rootmail ~]# useradd systemadmin [rootmail ~]# passwd systemadmin [rootmail ~]# vim /etc/ssh/sshd_conf…

火狐查cookie_Firefox 65默認會阻止跟蹤Cookie

火狐查cookieMozilla today released Firefox 63, which includes an experimental option to block third-party tracking cookies, protecting against cross-site tracking. You can test this out today, but Mozilla wants to enable it for everyone by default in Firef…