LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 585|回复: 8

终端怎么样才能不显示系统信息?

[复制链接]
发表于 2011-3-20 18:39:31 | 显示全部楼层 |阅读模式
每次打开lxterminal就会显示系统信息,因为系统没那么快,想取消这个的显示,要怎么弄呢?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2011-3-22 21:20:15 | 显示全部楼层
我这一直没有这个,要怎么显示能告诉我一下不?谢谢
回复 支持 反对

使用道具 举报

发表于 2011-3-22 21:53:08 | 显示全部楼层
同2楼......
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-3-22 22:00:05 | 显示全部楼层
其实我也不知道是怎么弄上去的,知道了就不会来问了。我装的是archbang,装完以后终端就带那些信息了。只是觉得慢,又没必要,桌面上conky已经显示了这些信息了。
回复 支持 反对

使用道具 举报

发表于 2011-3-22 22:14:51 | 显示全部楼层
Post by crazyrain;2131584
我这一直没有这个,要怎么显示能告诉我一下不?谢谢


将如下内容保存为 /usr/bin/archbey  可执行

~/.bashrc 内容:
archbey -c white


  1. #!/usr/bin/env python2
  2. #
  3. # archey [version 0.1-11]
  4. #
  5. # Maintained by Melik Manukyan <melik@archlinux.us>
  6. # Distributed under the terms of the GNU General Public License v3.
  7. # See http://www.gnu.org/licenses/gpl.txt for the full license text.
  8. # Modified for ArchBang -sHyLoCk
  9. # System information tool for Archlinux written in python.

  10. # Import libraries
  11. import os, sys, subprocess, optparse, re
  12. from subprocess import Popen, PIPE
  13. from optparse import OptionParser
  14. from getpass import getuser
  15. from time import ctime, sleep

  16. # Display [Comment/Uncomment to Enable/Disable information.]
  17. display = [
  18. 'os', # Display Operating System
  19. 'hostname', # Display Machine Hostname
  20. 'kernel',  # Display Kernel Version
  21. # 'battery', # Display Battery Usage [Requires 'acpi']
  22. 'uptime',  # Display System Uptime
  23. 'wm',  # Display Window Manager
  24. # 'de', # Display Desktop Environment
  25. 'packages', # Display Number of Packages Installed
  26. 'ram', # Display RAM Usage
  27. 'cpu', # Display CPU Model
  28. 'sh', # Display Current Shell
  29. # 'fs:/boot', # Display /boot Partition Usage
  30. # 'fs:/home', # Display /home Partition Usage
  31. # 'fs:/MOUNT/POINT', # Display * Partition, Edit To Your Needs
  32. 'fs:/' # Display / Partition Usage
  33. ]
  34. # Array containing Values
  35. result = []

  36. # Options
  37. if __name__=='__main__':
  38. parser = OptionParser(usage='%prog [-c COLOR] [-s, --screenshot]', description='To customize the info displayed on archey, edit "/usr/bin/archey" directly and look for the display array. Note: Archey can only allow up to 15 fields.', version="%prog 0.1.11")
  39. parser.add_option('-c',
  40.   action='store', default='blue', type='choice', dest='color', choices=('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'), help='choose a color: black, red, green, yellow, blue, magenta, cyan, white [Default: blue]')
  41. parser.add_option('-s', '--screenshot',
  42.   action='store_true', dest='screenshot', help='take a screenshot')
  43. (options, args) = parser.parse_args()

  44. # Define colors
  45. colorscheme = '%s' % options.color
  46. colors = {'black': '0', 'red': '1', 'green': '2', 'yellow': '3', 'blue': '4', 'magenta': '5', 'cyan': '6', 'white': '7'}
  47. for key in colors.keys():
  48. if key in colorscheme: colorcode = colors[key]   
  49. color = '\x1b[1;3%sm' % colorcode
  50. color2 = '\x1b[0;3%sm' % colorcode
  51. clear = '\x1b[0m'

  52. # Define processes for identifying Desktop Environmentss, Window Managers, Shells.
  53. de_dict = {
  54. 'gnome-session': 'GNOME',
  55. 'ksmserver': 'KDE',
  56. 'xfconfd': 'Xfce'}
  57.            
  58. wm_dict = {
  59. 'awesome': 'Awesome',
  60. 'beryl': 'Beryl',
  61. 'blackbox': 'Blackbox',
  62. 'compiz': 'Compiz',
  63. 'dwm': 'DWM',
  64. 'enlightenment': 'Enlightenment',
  65. 'fluxbox': 'Fluxbox',
  66. 'fvwm': 'FVWM',
  67. 'icewm': 'IceWM',
  68. 'kwin': 'KWin',
  69. 'metacity': 'Metacity',
  70. 'musca': 'Musca',
  71. 'openbox': 'Openbox',
  72. 'pekwm': 'PekWM',
  73. 'ratpoison': 'ratpoison',
  74. 'scrotwm': 'ScrotWM',
  75. 'wmaker': 'Window Maker',
  76. 'wmii': 'wmii',
  77. 'xfwm4': 'Xfwm',
  78. 'xmonad': 'xmonad'}

  79. sh_dict = {
  80. 'zsh': 'Zsh',
  81. 'bash': 'Bash',
  82. 'dash': 'Dash',
  83. 'fish': 'Fish',
  84. 'ksh': 'Ksh',
  85. 'csh': 'Csh',
  86. 'jsh': 'Jsh',
  87. 'tcsh': 'Tcsh'}

  88. # Find running processes.
  89. def xmonadfix(str):
  90. if re.compile("xmonad").match(str): return "xmonad"
  91. return str
  92. p1 = Popen(['ps', '-u', getuser()], stdout=PIPE).communicate()[0].split('\n')
  93. processes = map(xmonadfix, [process.split()[3] for process in p1 if process])
  94. p1 = None

  95. # Print coloured key with normal value.
  96. def output(key, value):
  97. output = '%s%s:%s %s' % (color, key, clear, value)
  98. result.append(output)

  99. # RAM Function
  100. def ram_display():
  101. raminfo = Popen(['free', '-m'], stdout=PIPE).communicate()[0].split('\n')
  102. ram = ''.join(filter(re.compile('M').search, raminfo)).split()
  103. used = int(ram[2]) - int(ram[5]) - int(ram[6])
  104. output ('RAM', '%s MB / %s MB' % (used, ram[1]))

  105. # Screenshot Function
  106. screen = '%s' % options.screenshot
  107. def screenshot():
  108. print 'Taking shot in',
  109. list = range(1,6)
  110. list.reverse()
  111. for x in list:
  112.    print '%s..' % x,
  113.    sys.stdout.flush()
  114.    sleep(1)
  115. print 'Say Cheeze!'
  116. subprocess.check_call(['scrot'])

  117. # Operating System Function
  118. def os_display():
  119. arch = Popen(['uname', '-m'], stdout=PIPE).communicate()[0].rstrip('\n')
  120. os = 'ArchBang - "Symbiosis" %s' % (arch)
  121. output('OS', os)

  122. # Kernel Function
  123. def kernel_display():
  124. kernel = Popen(['uname', '-r'], stdout=PIPE).communicate()[0].rstrip('\n')
  125. output ('Kernel', kernel)

  126. # Hostname Function
  127. def hostname_display():
  128. hostname = Popen(['uname', '-n'], stdout=PIPE).communicate()[0].rstrip('\n')
  129. output ('Hostname', hostname)

  130. # CPU Function
  131. def cpu_display():
  132. file = open('/proc/cpuinfo').readlines()
  133. cpuinfo = re.sub('  +', ' ', file[4].replace('model name\t: ', '').rstrip('\n'))
  134. output ('CPU', cpuinfo)

  135. # Uptime Function
  136. def uptime_display():
  137. fuptime = int(open('/proc/uptime').read().split('.')[0])
  138. day = int(fuptime / 86400)
  139. fuptime = fuptime % 86400
  140. hour = int(fuptime / 3600)
  141. fuptime = fuptime % 3600
  142. minute = int(fuptime / 60)
  143. uptime = ''
  144. if day == 1:
  145.   uptime += '%d day, ' % day
  146. if day > 1:
  147.   uptime += '%d days, ' % day
  148. uptime += '%d:%02d' % (hour, minute)
  149. output('Uptime', uptime)

  150. # Battery Function [Requires: acpi]
  151. def battery_display():
  152. p1 = Popen(['acpi'], stdout=PIPE).communicate()[0].lstrip()
  153. battery = p1.split(' ')[3].rstrip('\n')
  154. output ('Battery', battery)

  155. # Desktop Environment Function
  156. def de_display():
  157. de = 'None found'
  158. for key in de_dict.keys():
  159.   if key in processes: de = de_dict[key]
  160. output ('Desktop Environment', de)

  161. # Window Manager Function
  162. def wm_display():
  163. wm = 'None found'
  164. for key in wm_dict.keys():
  165.   if key in processes: wm = wm_dict[key]
  166. output ('Window Manager', wm)

  167. # Shell Function
  168. def sh_display():
  169. sh = os.getenv("SHELL").split('/')[-1].capitalize()
  170. output ('Shell', sh)

  171. # Packages Function
  172. def packages_display():
  173. p1 = Popen(['pacman', '-Q'], stdout=PIPE)
  174. p2 = Popen(['wc', '-l'], stdin=p1.stdout, stdout=PIPE)
  175. packages = p2.communicate()[0].rstrip('\n')
  176. output ('Packages', packages)

  177. # File System Function
  178. def fs_display(mount=''):
  179. p1 = Popen(['df', '-TPh', mount], stdout=PIPE).communicate()[0]
  180. used = [line for line in p1.split('\n') if line][1]
  181. used = used.split()[3]
  182. total = [line for line in p1.split('\n') if line][1]
  183. total = total.split()[2]
  184. type = [line for line in p1.split('\n') if line][1]
  185. type = type.split()[1]
  186. if mount == '/': mount = '/root'
  187. fs = mount.rpartition('/')[2].title() + " FS"
  188. part = '%s / %s (%s)' % (used, total, type)
  189. output (fs, part)

  190. # Run functions found in 'display' array.
  191. for x in display:
  192. call = [arg for arg in x.split(':') if arg]
  193. funcname=call[0] + '_display'
  194. func=locals()[funcname]
  195. if len(call) > 1:
  196.   func(arg)
  197. else:
  198.   func()

  199. # Array containing values.
  200. result.extend(['']*(16 - len(display)))

  201. ###### Result #######
  202. print """%s
  203. %s               +               
  204. %s               #                %s
  205. %s              ###               %s
  206. %s             #####              %s
  207. %s             ######             %s
  208. %s            ; #####;            %s
  209. %s           +##.#####            %s
  210. %s          +##########           %s
  211. %s         ######%s#####%s##;         %s
  212. %s        ###%s############%s+        %s
  213. %s       #%s######   #######        %s
  214. %s     .######;     ;###;`".      %s
  215. %s    .#######;     ;#####.       %s
  216. %s    #########.   .########`     %s
  217. %s   ######'           '######    %s
  218. %s  ;####                 ####;   %s
  219. %s  ##'                     '##  %s
  220. %s #'                         `#  
  221. %s """ % (color, color, color, result[0], color, result[1], color, result[2], color, result[3], color, result[4], color, result[5], color, result[6], color, color2, color, result[7], color, color2, color, result[8], color, color2, result[9], color2, result[10], color2, result[11], color2, result[12], color2, result[13], color2, result[14], color2, result[15], color2, clear)

  222. if screen == 'True':
  223. screenshot()

复制代码
回复 支持 反对

使用道具 举报

发表于 2011-3-22 22:17:05 | 显示全部楼层
Post by archcwj;2131543
每次打开lxterminal就会显示系统信息,因为系统没那么快,想取消这个的显示,要怎么弄呢?


~/.bashrc 修改为 (仅供参考)


  1. if [ -f /etc/bash_completion ]; then
  2.     . /etc/bash_completion
  3. fi
  4. export PS1='\[\e[1;31m\][\T][$(date +%D)][W$(date +%W)]\[\e[1;34m\][\u@\h:\w]\[\e[0m\]\n\$ '
  5. #export PS1="\[\033[s\]\[\033[1;\$((COLUMNS-24))f\]\033[1;33m[\$(date +%T)][\$(date +%D)][W\$(date +%W)]\[\033[u\]\[\e[1;31m\][\$(date +%T)][\$(date +%D)][W\$(date +%W)]\[\e[1;34m\][\u@\h:\w]\[\e[0m\]\n>"
  6. export PS2=">>"

  7. if [ -e ~/.bash_profile ] ; then
  8.     source ~/.bash_profile
  9. fi
  10. if [ -e /etc/profile.d/bash-completion.sh ] ; then
  11.     . /etc/profile.d/bash-completion.sh
  12. fi

复制代码
回复 支持 反对

使用道具 举报

发表于 2011-3-22 22:18:25 | 显示全部楼层
如果进不了X, 添加如下内容到 ~/.xinitrc
  1. #!/bin/sh
  2. # $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
  3. userresources=$HOME/.Xresources
  4. usermodmap=$HOME/.Xmodmap
  5. sysresources=/etc/X11/xinit/.Xresources
  6. sysmodmap=/etc/X11/xinit/.Xmodmap
  7. # merge in defaults and keymaps
  8. if [ -f $sysresources ]; then
  9.     xrdb -merge $sysresources
  10. fi
  11. if [ -f $sysmodmap ]; then
  12.     xmodmap $sysmodmap
  13. fi
  14. if [ -f $userresources ]; then
  15.     xrdb -merge $userresources
  16. fi
  17. if [ -f $usermodmap ]; then
  18.     xmodmap $usermodmap
  19. fi
  20. # Start the window manager:
  21. exec ck-launch-session openbox-session
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2011-3-22 23:48:15 | 显示全部楼层
原来那些信息是根据
~/.bashrc 内容:
archbey -c white
来的,所以我把  archbey -c white 注释掉,然后终端就不显示系统信息了。
回复 支持 反对

使用道具 举报

发表于 2011-3-24 11:24:27 | 显示全部楼层
我也把archbey -c white注释掉了,开启终端显示这个信息有些影响速度,注释掉后瞬间即开。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表