Linux Command & shell tips (2)
1, locale
默认情况下 Ubuntu 是 utf8 的 locale, 如:
liu@dog:$ locale -a C en_AG en_AU.utf8 ... ... zh_CN.utf8 zh_SG.utf8
但某些情况下程序以GBK的Locale运行,则需要启用 zh_CN.GBK 这样的locale。 此时会报错:
$: export LC_ALL=zh_CN.gbk warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk): No such file or directory
解决方法:
1) 修改/var/lib/locales/supported.d/local文件,在文件中添加zh_CN.GBK GBK
2) sudo dpkg-reconfigure locales
然后locale -a:
liuzhr@dog:/data/mq_tcp$ locale -a C en_AG en_AU.utf8 en_BW.utf8 ... ... POSIX zh_CN.gbk zh_CN.utf8 zh_SG.utf8
2, 不重启服务清空日志
xxx@dog:/data/logs # echo "" > apache-access_2011101110.log
3, MySQL 没有权限的情况 (系统是Ubuntu 10.04 LTS):
The error message in /var/log/mysql/error.log:
/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 110821 9:46:07 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 110821 9:46:07 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name ./ibdata1 InnoDB: File operation call: 'open'. InnoDB: Cannot continue operation. 110821 9:46:39 [Note] Plugin 'FEDERATED' is disabled.
Fix resolution: Edit /etc/apparmor.d/usr.sbin.mysqld , 将mysql-datadir 加入进去,如:
/data/mysqldata/ r, /data/mysqldata/** rwk,
4, 如果 Ubuntu 不能启动怎么办? 答案是试试 boot-repair (Ubuntu 9.10 or later)。 这个问题与 grub2 有关,参考 Ubuntu 社区的 grub2 文档。
6, 如何在分区之间复制,还保持文件权限不变?
su root; find / -xdev -print0 | cpio -pa0V /mnt/temp
参考:How to move your filesystem to a new hard drive
7, 如何压缩Linux分区的大小? 参考:Reducing VMDK Size 其中包括使用Gparted做分区复制。
8, Install Eclipse IDE:
http://colinrrobinson.com/technology/install-eclipse-ubuntu/
9, proxy through ssh tunnel:
ssh -CnfND 8080 your-ssh-server.com
Recent Comments