树莓派高大上ssh连接后系统信息和温度提示

技术 · 2019-09-05 · 90 人浏览

安装screenfetch:显示系统、主题信息

sudo apt install screenfetch
screenfetch

系统信息


linux各发行版logo图片及系统信息

sudo apt install linuxlogo
linux_logo
linux_logo -f -L list
sudo apt-get install neofetch
neofetch

logo

系统信息

系统信息


安装会说话的牛

sudo apt-get install cowsay

然后输入下面进行测试

cowsay “我是会说话的牛”

会说话的牛

只需用 -l参数就能看到它能提供的所有动物。

cowsay -l

会输出如下人物,你可以通过-f参数加人物名字来更换说话人物:

# Cow files in /usr/share/cowsay/cows:
apt beavis.zen bong bud-frogs bunny calvin cheese cock cower daemon default
dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
ghostbusters gnu head-in hellokitty kiss kitty koala kosh luke-koala
mech-and-cow meow milk moofasa moose mutilated pony pony-smaller ren sheep
skeleton snowman sodomized-sheep stegosaurus stimpy suse three-eyes turkey
turtle tux unipony unipony-smaller vader vader-koala www

比如更换成eyes:

cowsay -f eyes  “我是眼睛”

我是眼睛

这是我认为里面比较好看的

stegosaurus            剑龙
 __________________
< “我是会说话的剑龙” >
 ------------------
                             .       .
                            / `.   .' "
                    .---.  <    > <    >  .---.
                    |       - ~ ~ - /  /    |
         _____          ..-~             ~-..-~
        |     |   ~~~.'                    `./~~~/
       ---------   \__/                        \__/
      .'  O         /               /         "
     (_____,    `._.'               |         }  /~~~/
      `----.          /       }     |        /    \__/
            `-.      |       /      |       /      `. ,~~|
                ~-.__|      /_ - ~ ^|      /- _      `..-'
                     |     /        |     /     ~-.     `-. _  _  _
                     |_____|        |_____|         ~ - . _ _ _ _ _>

eyes                眼睛
 __________________
< “我是会说话的眼睛” >
 ------------------
    
     
                                   .::!!!!!!!:.
  .!!!!!:.                        .:!!!!!!!!!!!!
    ~~!!!!!!.                 .:!!!!!!!!!UWWW$$$
      :$$NWX!!:           .:!!!!!!XUWW$$$$$$$$$P
      $$$$$##WX!:      .<!!!!UW$$$$"  $$$$$$$$#
      $$$$$  $$$UX   :!!UW$$$$$$$$$   4$$$$$*
      ^$$$B  $$$$     $$$$$$$$$$$$   d$$R"
        "*$bd$$$$      '*$$$$$$$$$$$o+#"
             """"          """""""

    ghostbusters        捉鬼敢死队
    __________________
    < “我是会说话的捉鬼敢死队” >
    ------------------
          
           
                      __---__
                    _-       /--______
               __--( /      )XXXXXXXXXXXv.
             .-XXX(   O   O  )XXXXXXXXXXXXXXX-
            /XXX(       U     )        XXXXXXX
          /XXXXX(              )--_  XXXXXXXXXXX
         /XXXXX/ (      O     )   XXXXXX   XXXXX
         XXXXX/   /            XXXXXX   \__ XXXXX
         XXXXXX__/          XXXXXX         \__---->
    ---___  XXX__/          XXXXXX      \__         /
    -  --__/   ___/  XXXXXX            /  ___--/=
    -    ___/    XXXXXX              '--- XXXXXX
       -/XXX XXXXXX                      /XXXXX
         XXXXXXXXX                       /XXXXX/
          XXXXXX      >                 _/XXXXX/
            XXXXX--__/              __-- XXXX/
             -XXXXXXXX---------------  XXXXXX-
                XXXXXXXXXXXXXXXXXXXXXXXXXX/
                  ""VXXXXXXXXXXXXXXXXXXV""
     dragon-and-cow        龙和牛
    __________________
    < “我是会说话的龙和牛” >
    ------------------
                                           ^    /^
                                          /   // 
                            |\___/|      /   //  .
                            /O  O  \__  /    //  |             *----*
                            /     /  /_/    //   |                 |
                            @___@`    /_   //    |               / 
                           0/0/|       /_ //     |                   
                       0/0/0/0/|        ///      |                 |  |
                    0/0/0/0/0/_|_ /   (  //       |           _     |  /
                 0/0/0/0/0/0/`/,_ _ _/  ) ; -.    |    _ _.-~       /   /
                             ,-}        _      *-.|.-~-.           .~    ~
                 \__/        `/      /                 ~-. _ .-~      /
             \____(oo)           *.   }            {                   /
             (    (--)          .----~-.        -`                 .~
             //__\  \__ Ack!   ///.----..<                     _ -~
            //    \               ///-._ _ _ _ _ _ _{^ - - - - ~

dragon                龙
 __________________
< “我是会说话的龙” >
 ------------------
                          /   //
           |\___/|      /   //  \
            /0  0  \__  /    //  |  
           /     /  /_/    //   |    
           @_^_@'/   /_   //    |      
           //_^_/     /_ //     |        
        ( //) |        ///      |          
      ( / /) _|_ /   )  //       |           _
    ( // /) '/,_ _ _/  ( ; -.    |    _ _.-~        .-~~~^-.
  (( / / )) ,-{        _      `-.|.-~-.           .~         `.
 (( // / ))  '/      /                 ~-. _ .-~      .-~^-.  
 (( /// ))      `.   {            }                   /        
  (( / ))     .----~-.        -'                 .~           `. ^-.
             ///.----..>                     _ -~             `.  ^-`  ^-_
               ///-._ _ _ _ _ _ _}^ - - - - ~                     ~-- ,.-~
                                                                  /.-~

加个颜色

sudo apt install lolcat

利用管道命令,让彩色的恐龙大哥说'我是龙'

cowsay -f stegosaurus '我是龙' | lolcat

1567691504617.png


获取cpu实时温度值(python)

# 打开文件  
file = open("/sys/class/thermal/thermal_zone0/temp")  
# 读取结果,并转换为浮点数  
temp = float(file.read()) / 1000  
# 关闭文件  
file.close()  

编写python文件组合输出(可自行添加)

# -*- coding: utf-8 -*-

import os


#读取温度
file = open("/sys/class/thermal/thermal_zone0/temp")

temp = float(file.read()) / 1000

file.close()

wendu = '当前温度为'+str(temp)+'!最大火力前进!'

shell = 'cowsay -f dragon '+wendu+' | lolcat'

#os.system('linux_logo')

os.system('neofetch')

os.system(shell)

1567692052227.png


设置成ssh连接以后自动执行

过修改/etc/profiles.d/motd.sh来实现:

sudo nano /etc/profiles.d/motd.sh

在里面添加

python logo.py

注意:logo.py为刚才创建的python文件名

下次登录的时候,就可以看到彩色的logo了。

raspberry ssh
  1. 一只听说树莓派一直没搞懂是啥玩意

  2. repostone 2019-09-09

    非技术的路过。

  3. 刘大喵 2019-09-06

    玩那么久了 ~ 树莓派大佬了

    1. 沉潇先生 (作者)  2019-09-07
      @刘大喵

      ?不是不是

Theme Jasmine by Kent Liao