标签 linux 下的文章


sudo update-alternatives --config editor

There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    10        manual mode

Press <enter> to keep the current choice[*], or type selection number:

Non-interactive solution for setting vim as default editor:

sudo update-alternatives --set editor /usr/bin/vim.basic


On CentOS, you can change this value by adding the following line to your ~/.bashrc:

$ export EDITOR=`which name_of_editor`

Source the file to implement the changes:

$ source ~/.bashrc

sudo update-alternatives --set editor /usr/bin/vim.basic

The aim: to make checking system resource usage a little more accessible, ideally with historical data thrown into the mix for some added context.

Two years on and the fruits of that redesigned effort are finally available to sample, albeit through a new app called (aptly enough) GNOME Usage.


A new version of Usage is set to be released alongside GNOME 3.28 in March, and, accordingly, will be available to install in Ubuntu 18.04 LTS.

But how’s the app looking?

Well, don’t get too excited. Despite being in development for a while the app doesn’t quite deliver on the lure of the early mock-ups. For instance, it doesn’t provide historical data (yet) or offer any stats on power usage.

Effectively Usage 3.28 only tells you what your computer is doing right now — a job the regular System Monitor app and CLI apps like top can do too.

That said, it’s nice enough. Even at this early stage it’s clear to see that Usage is well placed as user friendly alternative to GNOME System Monitor. Through the use of colorful graphs you can quickly see how system resources like RAM, CPU and network are being used.

GNOME Usage wants to relay all of the information the GNOME System Monitor tool does, but in a more modern and easier to parse manner, with less emphasis on interfering with processes, and more on inferring what they’re up to.

This first version is able to relay the following information:

  • Processor Usage
  • Memory usage
  • Network usage
  • Storage usage

It also lets you:

  • Filter processes by name
  • Browse & visualise storage

GNOME developers will hate me for saying it but Usage sort of reminds me of a mobile system resource app in that it’s designed to relay system information in a manner that’s instantly digestible. CLI tools like top and other process monitoring tools aren’t indecipherable, but understanding what they show requires a couple of minutes of orientation.

Usage is promising and I look forward to seeing it mature.

(Of course, nothing competes with the sheer system monitor bling of Deepin System Monitor!)
Reiteratium Disclamerium

Now, lest anyone misunderstand: Usage is not replacing System Monitor. Development on System Monitor is continuing (indeed, there are nice improvements coming in GNOME 3.28). They are two apps that do similar things, but in different ways, aimed at different users.

Got it? Get it? Good.
Install GNOME Usage on Ubuntu

If you’re running the Ubuntu 18.04 daily builds then you can try Usage out for yourself by installing it from Ubuntu Software.


修改阿里云CentOS Linux服务器的主机名(实例名)


vi /etc/hosts


vi /etc/sysconfig/network



hostname 新主机名





nohup ./program >/dev/null 2>log &


nohup ./program >/dev/null 2>&1 &






可以用来指定需要重定向的标准输入或输出。例如,将某个程序的错误信息输出到log文件中:./program 2>log这样标准输出还是在屏幕上,但是错误信息会输出到log文件中。另外,也可以实现0,1,2之间的重定向。2>&1:将错误信息重定向到标准输出。



在CentOS 6更新后,不可避免的会在启动选项中产生多个内核选项,一个内核文件大概占100兆左右(一般100M以下),可以使用以下命令进行删除多余的内核.


# uname -a


# rpm -qa | grep kernel


#yum remove kernel-2.6.32-71.el6.i686
#yum remove kernel-devel-2.6.32-71.el6.i686


在默认情况下,linux终端输出的文字并不是彩色的。那么,如果想让linux输出彩色文本,那么应该怎么做呢? `echo -e

  • 红色:31
  • 绿色:32
  • 黄色:33
  • 蓝色:34
  • 洋红:35
  • 青色:36
  • 白色:37
  • 黑色:38