疯子的自留地

当我老了,也一样写代码.不为别的,只为爱好!

Linux修改用户名

killall -u old_name
id old_name
usermod -l new_name old_name
groupmod -n new_name old_name
usermod -d /home/new_name -m new_name
usermod -c "New Full Name" new_name
id new_name

Ubuntu install cairo-dock

sudo add-apt-repository ppa:cairo-dock-team/ppa 
sudo apt-get update

Then if Cairo-Dock is already installed:

sudo apt-get dist-upgrade

else:

sudo apt-get install cairo-dock cairo-dock-plug-ins

ubuntu install synapse

To install synapse in Ubuntu 14.04, open terminal and type

sudo add-apt-repository ppa:synapse-core/ppa 
sudo apt-get update
sudo apt-get install synapse
It should install synapse in your system.

synapse is now available in Ubuntu Universe repository (See here). To install it you need to enable the universe repository . Enable it using

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install synapse

Javasript获取当前时间戳

第一种方法:

var timestamp = Date.parse(new Date());

第二种方法:

var timestamp = (new Date()).valueOf();

第三种方法:

var timestamp=new Date().getTime();

ubuntu install plank

when reinstall ubuntu and want to install the plank(a simple dock software for linux),just do these...

sudo add-apt-repository ppa:ricotz/docky
sudo apt-get update
sudo apt-get install plank 

Linux下查看磁盘空间

命令df -h能够查看磁盘各分区的小小,已用空间信息

命令du -sh foo能够查看foo目录的大小

找出大文件:du -sh *

osx下修复nginx – getgrnam (“xxx”) failed问题

在装nginx后准备访问我的home目录下某些文件,按照我在linux下的设置更改了ngijnx.confuser scofield后,重启发现报了nginx -getgrnam("scofield") failed, google后发现需要更改为user scofield staff,重启生效