Leon’s blog

关注: 开源&互联网, GTD with open source and Web

正在浏览标签为 Linux 的文章

缺省情况下Debian的时间是根据系统时间设置成UTC时间的,然后再根据用户的时区设置做相应的调整。这通常没有问题,但是当我通过VirtualBox来在虚拟机里运行Linux的时候,问题来了。

因为VirtualBox是根据它的宿主操作系统来设置虚拟机的系统时间的,而这并不是Debian想要的UTC时间,除非你正好在0时区。这时Debian再根据用户时区设置调整时区,时区相当于被被处理了两次。这是我就不知道被从东8区扔到什么地方去了。

修正办法是不让Debian再做用户时区调整,直接使用系统时间就可以了。这时候我们需要把/etc/default/rcS文件里的”UTC=yes”改成”UTC=no”。保存,重启,OK。不知道这样有没有别的什么副作用,先用着看吧。

我在使用vim的时候,偶尔会碰到vim莫名其妙的僵在那里。在界面上输入什么都没有反应。甚至Ctrl+C、Ctrl+D也没有反应。

由于不是经常发生,也就没在意。每次很麻烦的关掉putty的窗口,重新再打开putty。今天发生了好几次,很是郁闷。就想看看究竟是怎么回事,结果发现每次按下Ctrl+S就会出现这个问题。

由于以前碰到过vim有些扩展有问题,这次就也怀疑是vim扩展的问题。结果删除了所有扩展和.vimrc文件,问题依旧。通过putty登录到别的系统,也是一样的问题。直接在ubuntu的命令行,按下Ctrl+S,问题也一样!

奥,原来是Linux的一个快捷键呀,干什么用的?

原来Ctrl+S在Linux里,是锁定屏幕的快捷键。如果要解锁,按下Ctrl+Q就可以了。

好吧,接受教训吧。以后碰到问题要勤快点,越早解决越少麻烦。
现在让我记牢点这两个组合键Ctrl+SCtrl+Q

如何在Linux下拷贝一个目录呢?这好像是再如意不过的问题了。
比如要把/home/usera拷贝到/mnt/temp,我首先想到的就是

cp -R /home/usera/* /mnt/temp

但是这样有一个问题,/home/usera下的隐藏文件都不会被拷贝,子目录下的隐藏文件倒是会的。

那如何才是正确的方法呢?有人说用-a选项,有人说用find加管道。
其实没这么复杂,Google了之后,学了一招。原来只有用“.”当前目录代替“*”就好了。

cp -R /home/usera/. /mnt/temp

cheat & ztd

抢沙发

cheat sheets 是个不错的网站,在通过gem在命令行下能显示常见工具的cheat sheet。下面是ZTD的sheet的输出结果。


$cheat ztd
ztd:
  Zen Things Done (ZTD)
  aka "Minimal ZTD: The Simplest System Possible"
  For more info see
  http://zenhabits.net/2007/04/minimal-ztd-the-simplest-system-possible/
  
  The Four Habits
  ————-
  1. Collect
    * Write down any tasks, ideas, projects, or other information that pop into
    your head.
    * Get it out of your head and onto paper.
  
  2. Process
   * Make quick decisions on things in your inbox, do not put them off.
   * Do it!, Trash it, Delegate it, File it (someday/maybe), calendar for later
  
  3. Plan
    *  Each day, create a list of 1-3 Most Important Tasks (your Big Rocks for
    the day) and be sure to accomplish them.
    * Do your MITs early in the day to get them out of the way and enjoy the
    rest of the day.
  
  4. Do
    * One task at a time, without distractions.
    * This is one of the most important habits in ZTD: Select a task (preferably
    one of your MITs) and focus on it to the exclusion of all else.
  • install cheat in debiean/squeeze
    • apt-get install rubygems
    • ln -s /usr/bin/ruby1.8 /usr/bin/ruby
    • gem install cheat
    • ln -s /var/lib/gems/1.8/gems/cheat-1.2.1/bin/cheat /usr/bin/cheat