1:echo "$pwd"|passwd $username --stdin #设置username的密码
2:mysql -uroot -e "select db,user from mysql.db">db.txt #将结果输入到db.txt文件中
3:linux下删除一个特殊的文件!(就是特殊)
[root@node1 xliu]# touch a.java
[root@node1 xliu]# ll -i a.java
160660 -rw-r--r-- 1 root root 0 Aug 9 18:52 a.java
[root@node1 xliu]# find . -inum 160660 -exec rm -i {} \;
rm: remove regular empty file `./a.java'? y
[root@node1 xliu]# touch b.java
[root@node1 xliu]# ll -i b.java
160660 -rw-r--r-- 1 root root 0 Aug 9 18:53 b.java
[root@node1 xliu]# touch c.java
[root@node1 xliu]# ll -i *.java
160660 -rw-r--r-- 1 root root 0 Aug 9 18:53 b.java
160661 -rw-r--r-- 1 root root 0 Aug 9 18:53 c.java
[root@node1 xliu]# find . -inum 160661 -exec rm -f {} \;
[root@node1 xliu]# find . -inum 160660 -exec rm -f {} \;
[root@node1 xliu]# ll *.java
ls: *.java: No such file or directory
4:安装好php5后,逐个安装php扩展,可以成功安装,用phpinfo()来测试,可以显示
但是执行php -v时有warning提示:
[root@node1 xliu]# /usr/local/php5/bin/php -v
PHP Warning: PHP Startup: Unable to load dynamic library './/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/pdo.so' - .//usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so' - .//usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/mysqli.so' - .//usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so' - .//usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.2.4 (cli) (built: Jun 1 2011 21:20:11)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies
原因:php.ini中的extension_dir没有被注释掉,又新增加一行
extension_dir ="***"的设置!故会产生上面的错误!
解决方法:
./configure --prefix=/usr/local/php5
--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/mysql5
--with-freetype-dir --with-zlib
--with-png-dir --with-iconv
--with-libxml-dir --with-jpeg-dir
--with-curl --with-gd=/usr/local/gd2
--enable-ftp --enable-zip --enable-mbstring
--with-mcrypt=/usr/local/libmcrypt
--with-config-file-path=/usr/local/xncenter/confcenter
--enable-pdo=shared --with-pdo-mysql=shared
--with-sqlite=shared --with-pdo-sqlite=shared
注意一点:在安装mcrypt的时候,要先安装mcrypt的依赖包,libmcrypt!
安装如下:
checking for mcrypt support... yes, shared
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for mcrypt support... yes, shared
checking for libmcrypt version... >= 2.5.6
checking for mcrypt_module_open in -lmcrypt... no
checking for mcrypt_module_open in -lmcrypt... no
configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.
安装过程如下:
tar jxvf libmcrypt-2.5.8.tar.bz2
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt
make
make install
5:查询机器上安装的软件名:
[root@IDC-D1599 liuxiaojie]# rpm -q libgcc --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n'
libgcc-4.1.2-42.el5.i386.rpm
libgcc-4.1.2-42.el5.x86_64.rpm
6:Linux机器上安装squid关于文件描述符的问题
67552:2010/12/14 15:08:20| client_side.cc(2692) WARNING! Your cache is running out of filedescriptors
74241:2010/12/14 15:20:40| httpAccept: FD 14: accept failure: (23) Too many open files in system
原因:文件描述符被用光
解决方法:
6.1:在/usr/include/bits/types.h
中加入:#define _ _FD_SETSIZE 65536
6.2:在/etc/security/limits.conf最后加入:
* soft nofile 65536
* hard nofile 65536
6.3:编译squid时加入
--with-filedescriptors=65536,就算有这个指定,如果没有1中设置,还是会出上面的问题
6.4:执行echo 65536 > /proc/sys/fs/file-max
7:php.ini配置文件查询:
[root@IDC-D-1008 www]# php --ini
Configuration File (php.ini) Path: /vhost/Apache2Conf/
Loaded Configuration File: /vhost/Apache2Conf/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
8:记录命令执行的时间
export HISTTIMEFORMAT="%F %T "
这样会在history前面添加时间
这个是针对当前shell的,如果想长期有效写进bashrc里
允许后history显示如下:
130 2012-05-09 11:48:18 export HISTTIMEFORMAT="%F %T "
131 2012-05-09 11:48:19 w
132 2012-05-09 11:48:23 ls
133 2012-05-09 11:48:25 history
9:压缩一个目录,排除中间的某个目录
tar zcvf mysql5.5.17.tar.gz /data/mysql/ --exclude=data
##注意 --exclude后面的排除目录后不能带/ ,否则不起作用
10:cron job不运行,
解决方法:
10 2 * * * sh /home/scritps/hello.sh>>/home/scripts/cronlog 2>&1这种方式就会把该脚本在作为cron job工作时的日志信息都写到/home/scripts/cronlog文件中,我们就可以根据日志的提示进行处理了
11: nginx+php 扩展问题
12:计算两个数,其中有一个是小数
阅读(1919) | 评论(0) | 转发(0) |