hiphp
原來今天是感恩節。雖然一直沒有過這個節日的習慣,但僅僅是聽到感恩的消息,都能想到一幅幅畫面。願你們安好!node
下午開題會議仍是有所收穫,悄悄的,就變向那個不喜歡本身的人了。mysql
1、Linux基礎(二)linux
-----Linux經常使用命令(二)-----ios
三、文件搜索命令git
3.1 文件搜索命令locate正則表達式
--優勢:sql
搜索速度快(在學習中,要把眼光放遠、放大一點,設想數據量很大的狀況或是規模很大的問題的狀況)shell
locate 文件名數據庫
--工做原理:
在後臺數據庫按文件名搜索
因此,新建立的文件每每搜索不到(缺點)
解決辦法:等(1天);updatedb命令更新數據庫
--缺點:
只能按照文件名搜索(功能弱)——理解就是,犧牲功能提高速度
--搜索/更新配置:
vi /etc/updatedb.conf
獲得
PRUNE_BIND_MOUNTS = "yes"
PRUNEFS = "9p afs anon_inodefs auto autofs bdev binfmt_misc cgroup cifs coda configfs cpuset debugfs devpts ecryptfs exofs fuse fusectl gfs gfs2 hugetlbfs inotifyfs iso9660 jffs2 lustre mqueue ncpfs nfs nfs4 nfsd pipefs proc ramfs rootfs rpc_pipefs securityfs selinuxfs sfs sockfs sysfs tmpfs ubifs udf usbfs"
PRUNENAMES = ".git .hg .svn"
PRUNEPATHS = "/afs /media /net /sfs /tmp /udev /var/cache/ccache /var/spool/cups /var/spool/squid /var/tmp"
第一行就是說,是否執行下列的更新規則
後面是不搜索這些文件夾/文件
因此有時候有些目錄中的內容搜索不到的——好比經常使用的/tmp
3.2 命令搜索命令whereis和which
3.2.1 whereis
--基本
[root@andy ~]# whereis ls
ls: /bin/ls /usr/share/man/man1p/ls.1p.gz /usr/share/man/man1/ls.1.gz
能搜索到命令的目錄以及其幫助文檔的目錄(因此命令所在位置where is ,同時要牢記,linux中一切皆文件)
--選項
-b 只查找可執行文件
-m 只查找幫助文件
[root@andy ~]# whereis -b mkdir
mkdir: /bin/mkdir
3.2.2 which
--基本
[root@andy ~]# which ls
alias ls='ls --color=auto'
/bin/ls
還會查到別名(若是有的話)。
這裏ls會自動顯示不一樣的顏色
[root@andy ~]# which pwd
/bin/pwd
沒有別名就仍是這樣,但沒有幫助文檔
3.2.3 其餘說明
--找不到的命令
[root@andy ~]# which cd
/usr/bin/which: no cd in (/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@andy ~]# where cd
-bash: where: command not found
有些類型是找不到的,緣由是shell自帶的(之後學)
--path環境變量
環境設定的基本路徑,好比上述(/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
它使咱們能夠不用絕對路徑來輸入命令——windows也是這樣的
仍是那句話,都是文件
path環境變量的定義:系統搜索命令的路徑
本身寫的程序,要麼命令都寫絕對路徑,要麼放在這些path路徑中
3.3 find命令
最強大的搜索命令——這裏只學習基本的、經常使用的用法
--基本
find [搜索範圍] [搜索條件] 文件名
[root@andy ~]# find / -name install.log
/root/install.log
會發現速度很慢——範圍太大
並且真實狀況會更加複雜,有可能速度更慢,壓力更大
——儘可能縮小範圍!
並且,若是打算進行模糊匹配,好比install.log.syslog。這個命令是查不到的,要進行通配符匹配,通配符是徹底匹配
--通配符
* 匹配任意內容
[root@andy ~]# find /root -name "install.log*"
/root/install.log.syslog
/root/install.log
? 匹配任意一個字符
[] 匹配中括號中的任意一個字符
[root@andy ~]# find /root -name "*[asdf]?"
/root/anaconda-ks.cfg
/root/.viminfo
/root/japan
/root/japan/anaconda-ks.cfg
要注意,find是徹底匹配,要當心
--搜索條件
-
find /root -name install.log 按照文件名搜索
find /root -inname install.log 不區分大小寫
-
find /root -user install.log 按照全部者搜索(不經常使用)
find /root -nouser 搜索全部沒有全部者的文件(經常使用)——這種文件不少是垃圾文件,可是有兩種狀況除外——內核建立的(sys中);外來文件(好比U盤)
-
find /var/log -mtime +10 查找10天前修改的文件——atime 文件訪問時間,mtime 修改文件時間,ctime 改變文件屬性;+10 10天前修改的文件,-10 10天內,10 10天當天(注意沒有10天后,哈哈)——經常使用於日誌的刪除/篩選中的(默認按天)
-
find . -size 25k 在當前目錄下搜索25k大小的文件——+25或-25也能夠
[root@andy ~]# find . -size 25k
[root@andy ~]# ll
總用量 48
-rw-------. 2 root root 1273 11月 26 05:32 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 11月 26 06:05 cangls
-rw-r--r--. 1 root root 26420 11月 25 03:55 install.log
-rw-r--r--. 1 root root 7572 11月 25 03:52 install.log.syslog
drwxr-xr-x. 3 root root 4096 11月 26 05:43 japan
[root@andy ~]# find . -size +25k
./install.log
[root@andy ~]# find . -size -25k
.
./.tcshrc
./anaconda-ks.cfg
./cangls
./install.log.syslog
./.bash_profile
./.bash_logout
./.bash_history
./.bashrc
./.viminfo
./.cshrc
./japan
./japan/anaconda-ks.cfg
./japan/cangls
[root@andy ~]# find . -size -25m
find: 無效的 -size 類型「m」
[root@andy ~]# find . -size -25M
.
./.tcshrc
./anaconda-ks.cfg
./cangls
./install.log.syslog
./.bash_profile
./.bash_logout
./.bash_history
./install.log
./.bashrc
./.viminfo
./.cshrc
./japan
./japan/anaconda-ks.cfg
./japan/cangls
[root@andy ~]#
注意Mb是大寫的M,kb是小寫的k
-
find . -inum 213123 在當前目錄按照i節點搜索213123的文件——經常搭配ls -i使用
-複雜操做
find /etc -size +20k -a -size -50k 這裏的-a是與,-o是或
[root@andy ~]# find /etc -size +20k -a -size -50k
/etc/selinux/targeted/modules/active/modules/unprivuser.pp
/etc/selinux/targeted/modules/active/modules/xguest.pp
/etc/selinux/targeted/modules/active/modules/virt.pp
/etc/selinux/targeted/modules/active/modules/postfix.pp
/etc/selinux/targeted/modules/active/modules/unconfineduser.pp
/etc/selinux/targeted/modules/active/modules/nagios.pp
/etc/selinux/targeted/modules/active/modules/cups.pp
/etc/selinux/targeted/modules/active/modules/rhcs.pp
/etc/selinux/targeted/modules/active/modules/apache.pp
/etc/selinux/targeted/modules/active/modules/staff.pp
/etc/selinux/targeted/modules/active/modules/samba.pp
/etc/mime.types
/etc/sysconfig/network-scripts/network-functions-ipv6
/etc/postfix/main.cf
/etc/ld.so.cache
/etc/libreport/events/report_RHTSupportAttach.xml
/etc/libreport/events/report_RHTSupport.xml
/etc/makedev.d/01linux-2.6.x
/etc/sound/events/gnome-2.soundlist
-
find /etc -size +20k -a -size -50k -exec ls -lh {} \;
[root@andy ~]# find /etc -size +20k -a -size -50k -exec ls -lh {} \;
-rw-------. 1 root root 37K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/unprivuser.pp
-rw-------. 1 root root 26K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/xguest.pp
-rw-------. 1 root root 24K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/virt.pp
-rw-------. 1 root root 31K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/postfix.pp
-rw-------. 1 root root 29K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/unconfineduser.pp
-rw-------. 1 root root 21K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/nagios.pp
-rw-------. 1 root root 21K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/cups.pp
-rw-------. 1 root root 26K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/rhcs.pp
-rw-------. 1 root root 27K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/apache.pp
-rw-------. 1 root root 42K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/staff.pp
-rw-------. 1 root root 24K 11月 25 03:46 /etc/selinux/targeted/modules/active/modules/samba.pp
-rw-r--r--. 1 root root 43K 9月 23 2011 /etc/mime.types
-rw-r--r--. 1 root root 30K 7月 22 2014 /etc/sysconfig/network-scripts/network-functions-ipv6
-rw-r--r--. 1 root root 27K 2月 20 2014 /etc/postfix/main.cf
-rw-r--r--. 1 root root 40K 11月 25 03:52 /etc/ld.so.cache
-rw-r--r--. 1 root root 23K 10月 16 2014 /etc/libreport/events/report_RHTSupportAttach.xml
-rw-r--r--. 1 root root 22K 10月 16 2014 /etc/libreport/events/report_RHTSupport.xml
-rw-r--r--. 1 root root 28K 11月 11 2010 /etc/makedev.d/01linux-2.6.x
-rw-r--r--. 1 root root 27K 11月 12 2010 /etc/sound/events/gnome-2.soundlist
這裏是用-exec加入第二條命令,執行前面的結果,並且必須加{} /;
------總結
就是find很強大,功能不少,靈活多變;同時帶來了,使用複雜,速度很差定
3.4 grep命令
--基本
搜索字符串:grep [選項] 字符串 文件名
[root@andy ~]# grep "size" anaconda-ks.cfg
#part /boot --fstype=ext4 --size=200
#part swap --size=4000
#part /home --fstype=ext4 --size=2000
#part / --fstype=ext4 --grow --size=200
注意,搜索到的不是符合字符串的文件,而是文件中相應的字符串——與find區分
--選項
-v 取反,即不包含字符串的
-i 不區分大小寫
--與find
find:找文件+徹底匹配+使用通配符匹配
grep:找字符串+包含匹配+使用正則表達式匹配
-------------------------------------------------------------------
2、PHP與MySQL
-----文章發佈系統實踐(一)-----
理解php操做mysql的方法,熟悉掌握php的mysql函數
一、需求分析
1.1 後臺管理系統
管理-列表
發佈,修改,刪除-程序
1.2 前臺展現系統
文章列表,文章內容頁
1.3 數據庫設計
一個表便可,用於存放文章
(我不想畫表格,直接寫數據庫命令好了,希望之後的我看得懂)
CREATE TABLE article(
id INT(11) PRIMARY KEY AUTO_INCREMENT,
title CHAR(100) NOT NULL,
author CHAR(50) NOT NULL,
description VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
dateline INT(11) NOT NULL DEFAULT 0
);
1.4 項目規劃
項目須要什麼文件
二、後臺管理系統
2.1 建立配置文件和初始化文件
中午開會,沒有睡午覺。。。早點回去看書睡覺了