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自定义菜单

ubuntu自定义菜单_如何自定义Ubuntu的每日消息相关推荐

  1. 微信java创建菜单_微信自定义菜单的创建(JAVA版)

    微信自定义菜单的创建与使用 需求 当微信公众号设置为开发者模式,想要自己创建和开发菜单的话,就需要自己调用微信创建菜单的接口来创建菜单了.创建菜单之后,如果需要迫切的看到效果,有时候需要取消关注-从新 ...

  2. 选项菜单_上下文菜单_子菜单_图标菜单_自定义菜单_联系人标记弹出菜单

    菜单控件<Menu > 选项菜单(Option Menu) 单击Menu实体按钮弹出,android中把它叫做option menu 上下文菜单(ContextMenu 是Menu的子接口 ...

  3. ubuntu ftp服务器_如何在Ubuntu上安装FTP服务器?

    ubuntu ftp服务器 In this tutorial, let's learn how to install FTP server on Ubuntu. FTP or File Transfe ...

  4. ubuntu rpm安装_为什么说Ubuntu是一个值得尊敬的Linux发行版

    Ubuntu用了好长时间了,最早接触的是RedHat,个人使用体验并不好,当时一直在想,为什么就没有一个更好用的Linux操作系统呢?别万年不变的Windows不行吗?(当时作为一个穷学生党,完全不想 ...

  5. mysql查询自定义数据_实现自定义查询的数据库设计及实现(一)

    需求 先说一下需求:实现用户自定义的查询,用户可以自定义要查询的列.自定义条件条件.自定义排序.除了查询使用外,还可以使用于各个需要根据条件进行约束的业务,如权限: 本设计和实现,很大部分是通过数据库 ...

  6. 关于微信公号自定义菜单链接,跳转到历史消息界面URL

    之前微信公众号的自义定菜单是可以直接链接到历史消息界面的.后来改呀改的,又去掉了这么功能. 无奈公司微信公众号还是需要这个链接功能. 废话不多说上重点: 历史消息URL模板如下图是: https:// ...

  7. vue右键自定义菜单_一款小巧的开源右键菜单管理软件

    要说右键管理软件,果核上面目前收集了几款,例如年久失修的右键管家. 虽然很多年没有更新了,但是软件的功能却正常,日常删除多余的右键菜单没问题. 另外,就是火绒家的右键管家,基本功能也够用 不过嘛,今天 ...

  8. vue鼠标右键自定义菜单_使用Vue自定义指令实现右键菜单

    前言 浏览器里右键时会有一个默认的菜单,在我的开源项目中正好有自定义右键菜单的需求,在npm库找了下与之相关的包,发现都是以组件形式实现的,感觉那种做法太过繁琐. 于是,我就想着能不能像vue的内置指 ...

  9. ubuntu 命令卡住_如何在Ubuntu系统中重置root密码

    IT服务圈儿 有温度.有态度的IT自媒体平台 经授权转自公众号:良许Linux(ID:liangxuxiansheng) 很多人有个问题,就是喜欢把密码设置得很长很复杂,结果谁也没防住,却成功防住了自 ...

最新文章

  1. c语言字符串去重简单,C语言实现简单飞机大战
  2. web 向java_Java web基础
  3. 家门口的医疗新体验,网易云信携手嘉虹健康打造互联网医院新场景
  4. Linux查看关机时间
  5. 什么是 Stack Overflow,什么情况下会造成 Stack Overflow
  6. javascript类式继承函数最优版
  7. 女学霸考692分想当“程序媛”,网友:快劝劝孩子
  8. 【图论】Dijkstra算法解决有向图最短路问题
  9. 体系结构13_Tomasulo算法
  10. AriaNG保存服务器信息,Aria2 AriaNg 安装配置教程
  11. 【读书笔记】法治的细节——做我们觉得对的事情,然后接受它的事与愿违
  12. 《推荐系统实战》读书笔记——在隐式反馈系统中如何给商品打分
  13. 为什么博图中放置按下按钮无反应_为什么点击按钮毫无反应
  14. OpenCV用FAST、SURF、SIFT、BRISK、ORB等进行特征点提取与匹配
  15. 游戏设计之基于高程图的三维地形绘制
  16. 十六、基于FPGA的CRC校验设计实现
  17. 字节青训营第三课之高质量编程与性能调优实战的笔记和总结
  18. 人工神经网络与神经网络,神经网络最新研究方向
  19. virtualapp-RefClass反射机制(转载)
  20. Background背景

热门文章

  1. MySql和Sql Server语法和关键字区别
  2. 设计制作简单计算机,自己设计制作CPU与单片机
  3. php渲染视图,Laravel 视图渲染:Blade 模板引擎
  4. linux 写结构体到文件
  5. mysql员工脚本_mySQL常用脚本汇总
  6. Http协议(4)—HTTP认证机制
  7. 不想当全栈的设计师不是_但我不想成为产品设计师
  8. 马化腾联手10余位科学家发起科学探索奖,腾讯基金投入10亿元启动资金
  9. thread线程栈size及局部变量最大可分配size【转】
  10. CenterOS 7安装Nginx