1. Some examples of call Linux shell instructions: String cmd = "ls / home / log / daily / count * | cut -d '' -f1> / home / log / tmp_cmd"; process.system (cmd) Use the Linun Shell instruction to enter the fields in a file into another temporary file String cmd = "tail -n200 /home/log/tell.log> / home / log / tmp_tell_log"; process.system (cmd);
2. XML Version = "1.0" encoding = "gb2312"?> <% response.setContentType (" text / vnd.wap.wml; charset = GB2312 ");%> <% @ page import =" java.net. *, Java.util. *, Java. IO. * "%> <% @ page language =" java "contentty =" text / vnd.wap.wml; charset = GB2312 "%> <% DATE DATE = new Date (); string random_user = long.toString (Date .gettime ()); response.sendredirect (http://192.168.0.225/xxx.jsp?_user= " random_user);%>
3. Regular expression LS -L | GREP ^ D lists all directories in the current directory, excluding other files, only a directory.
4.Mysql database backup mysqldump -uroot -Password dbname> /Home/xxx/xxx.sql written in crontab automatic backup crontab -e00 3 * * * (/ bin / sh /Home/qianglee/mysqlback/backmysql.sh)
script:
#! / bin / sh
Export Path = $ PATH: / USR / local / bin: / usr / bin: / usr / local / sbin
Date = `DATE % Y% M% D`Yesterday =` echo "| awk '{now = systime (); p = strftime ("% y-% M-% D ", NOW-24 * 60 * 60 PRINT P} '`Echo $ DATEFILENAME =` Echo $ DATE | awk' {print "DBNAME" $ 0 ".bak"} '`Echo $ filenamememysqldump -uroot -Password dbname> / home / xxx / xxxback / $ filename