佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > hi 感恩節(jié)——Linux基礎(chǔ)教程之mysql和php

hi 感恩節(jié)——Linux基礎(chǔ)教程之mysql和php

熱門標簽:AI電銷 呼叫中心市場需求 服務(wù)外包 地方門戶網(wǎng)站 鐵路電話系統(tǒng) Linux服務(wù)器 百度競價排名 網(wǎng)站排名優(yōu)化

感恩節(jié)。雖然一直沒有過這個節(jié)日的習慣,但僅僅是聽到感恩的消息,都能想到一幅幅畫面。愿大家安好!

學習Linux的前言

選擇了Linux發(fā)行版本,你就會想如何開始學習Linux了。

1.當然是安裝Linux了,請上網(wǎng)自行g(shù)oogle或者百度,下載redhat linux 5的安裝光盤,然后再安裝vmware,自行安裝

2.多動手,多敲命令。只看書,不實踐,一切都是浮云。默認安裝redhat 5,啟動redhat 5是帶有圖形界面的,但是圖形界面最好少用,對學習Linux不利,一定要盡量用字符界面,慢慢習慣。而工作中,使用Linux,使用圖形界面的概率幾乎是0。所以你去學習圖形界面的技術(shù)價值,幾乎為0,性價比不高。

如何學習Linux

1.學習Linux的第一件事情是學習Linux基礎(chǔ),這方面我推薦鳥哥的私房菜的Linux 基礎(chǔ)文件,里面講解了Linux的文件,磁盤,網(wǎng)絡(luò),進程等,看懂了這本書,并且一個個命令去實踐,你就開始入門Linux了。

2.學習Linux的第二事情就是用Linux。前面說過,Linux的最大用處是服務(wù)器領(lǐng)域,所以你要學的第二步是學會架設(shè)服務(wù)器,這方面我推薦鳥哥的私房菜Linux 架站文件,這本書介紹了很多服務(wù)器的假設(shè),沒有必要把全部服務(wù)器的架設(shè)步驟都看完。個人覺得可以先看完架設(shè)服務(wù)器的基礎(chǔ),然后再看看如何搭建web服務(wù)器,ftp服務(wù)器,telnet服務(wù)器,ssh服務(wù)器。學會這幾個服務(wù)器的搭建,管理,再根據(jù)個人興趣和需要選擇其他服務(wù)器的搭建。

3.進階——編程。到了這里,你只是會用Linux而已,或許學會少許shell編程,能夠?qū)W會簡單的shell,編寫腳本。但是你要進一步熟悉Linux,就要學會Linux編程。例如,Linux的管道是怎么做,Linux的deamon進程是如何實現(xiàn)的,為什么nohub可以讓一個進程可以以daemon形式運行,即使關(guān)閉了shell也不會讓這個進程也被關(guān)閉。這些,你學會了Linux環(huán)境編程,你就豁然開朗了。這里我推薦 《UNIX環(huán)境高級編程》,此書是Linux/Unix編程的圣經(jīng),堪稱驚世之作。

4.到了這里,你就可以對Linux/Unix有所了解,已經(jīng)有一定的基礎(chǔ)了,接下來你就要根據(jù)你的興趣去選擇你感興趣的方向去學習,或許要根據(jù)你的工作方向去學習(很多時候工作不是自己的興趣),師父領(lǐng)進門,修行在個人,以上的學習步驟是我能想到的最簡化的步驟,學習的東西越多,只會讓初學者更迷茫。

下午開題會議還是有所收獲,悄悄的,就變向那個不喜歡自己的人了。

一、Linux基礎(chǔ)(二)

-----Linux常用命令(二)-----

3、文件搜索命令

3.1 文件搜索命令locate

--優(yōu)點:

搜索速度快(在學習中,要把眼光放遠、放大一點,設(shè)想數(shù)據(jù)量很大的情況或是規(guī)模很大的問題的情況)

locate 文件名

--工作原理:

在后臺數(shù)據(jù)庫按文件名搜索

所以,新創(chuàng)建的文件往往搜索不到(缺點)

解決辦法:等(1天);updatedb命令更新數(shù)據(jù)庫

--缺點:

只能按照文件名搜索(功能弱)——理解就是,犧牲功能提升速度

--搜索/更新配置:

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"

第一行就是說,是否執(zhí)行下列的更新規(guī)則

后面是不搜索這些文件夾/文件

所以有時候有些目錄中的內(nèi)容搜索不到的——比如常用的/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 只查找可執(zhí)行文件

-m 只查找?guī)椭募?/p>

[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環(huán)境變量

環(huán)境設(shè)定的基本路徑,比如上述(/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

它使我們可以不用絕對路徑來輸入命令——windows也是這樣的

還是那句話,都是文件

path環(huán)境變量的定義:系統(tǒng)搜索命令的路徑

自己寫的程序,要么命令都寫絕對路徑,要么放在這些path路徑中

3.3 find命令

最強大的搜索命令——這里只學習基本的、常用的用法

--基本

find [搜索范圍] [搜索條件] 文件名

[root@andy ~]# find / -name install.log
/root/install.log

會發(fā)現(xiàn)速度很慢——范圍太大

而且真實情況會更加復(fù)雜,有可能速度更慢,壓力更大

——盡量縮小范圍!

而且,如果打算進行模糊匹配,比如install.log.syslog。這個命令是查不到的,要進行通配符匹配,通配符是完全匹配

--通配符

* 匹配任意內(nèi)容

[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   不區(qū)分大小寫

-

find /root -user install.log  按照所有者搜索(不常用)

find /root -nouser 搜索所有沒有所有者的文件(常用)——這種文件很多是垃圾文件,但是有兩種情況除外——內(nèi)核創(chuàng)建的(sys中);外來文件(比如U盤)

-

find /var/log -mtime +10  查找10天前修改的文件——atime 文件訪問時間,mtime 修改文件時間,ctime 改變文件屬性;+10 10天前修改的文件,-10 10天內(nèi),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節(jié)點搜索213123的文件——常常搭配ls -i使用

-復(fù)雜操作

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加入第二條命令,執(zhí)行前面的結(jié)果,而且必須加{} /;

------總結(jié)

就是find很強大,功能很多,靈活多變;同時帶來了,使用復(fù)雜,速度不好定

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

注意,搜索到的不是符合字符串的文件,而是文件中相應(yīng)的字符串——與find區(qū)分

--選項

-v 取反,即不包含字符串的

-i 不區(qū)分大小寫

--與find

find:找文件+完全匹配+使用通配符匹配

grep:找字符串+包含匹配+使用正則表達式匹配

-------------------------------------------------------------------

二、PHP與MySQL

-----文章發(fā)布系統(tǒng)實踐(一)-----

理解php操作mysql的方法,熟悉掌握php的mysql函數(shù)

1、需求分析

1.1 后臺管理系統(tǒng)

管理-列表

發(fā)布,修改,刪除-程序

1.2 前臺展示系統(tǒng)

文章列表,文章內(nèi)容頁

1.3 數(shù)據(jù)庫設(shè)計

一個表即可,用于存放文章

(我不想畫表格,直接寫數(shù)據(jù)庫命令好了,但愿以后的我看得懂)

CERATE 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 項目規(guī)劃

項目需要什么文件

2、后臺管理系統(tǒng)

2.1 創(chuàng)建配置文件和初始化文件

您可能感興趣的文章:
  • Linux基礎(chǔ)知識99問(五)
  • Linux基礎(chǔ)知識99問(四)
  • Linux基礎(chǔ)知識99問(二)
  • Linux基礎(chǔ)知識99問(一)
  • Linux下PHP+MYSQL+APACHE配置過程 (摘)
  • linux下安裝apache與php;Apache+PHP+MySQL配置攻略
  • linux php mysql數(shù)據(jù)庫備份實現(xiàn)代碼
  • linux下apache、mysql、php安裝配置詳細筆記
  • linux基礎(chǔ)之Shell Script入門介紹
  • linux安裝全中文管理面板教程(php+mysql)

標簽:銅川 仙桃 衡水 蘭州 湖南 崇左 湘潭 黃山

巨人網(wǎng)絡(luò)通訊聲明:本文標題《hi 感恩節(jié)——Linux基礎(chǔ)教程之mysql和php》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    玉树县| 东光县| 罗定市| 城步| 肃南| 措勤县| 灯塔市| 阳江市| 密山市| 曲沃县| 桐梓县| 新宁县| 大理市| 邵东县| 应用必备| 林州市| 新津县| 盘锦市| 万载县| 古丈县| 师宗县| 太原市| 平潭县| 长春市| 丹东市| 新竹市| 乡城县| 桑日县| 邳州市| 临江市| 思茅市| 三门峡市| 资溪县| 云浮市| 宁河县| 临澧县| 井陉县| 宣城市| 澄迈县| 湖南省| 兴国县|