欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2015年11月27日 11:09:04   作者:韌還  
這篇文章主要介紹了hi 感恩節(jié)——Linux基礎(chǔ)教程之mysql和php的相關(guān)資料,需要的朋友可以參考下

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

學(xué)習(xí)Linux的前言

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

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

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

如何學(xué)習(xí)Linux

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

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

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

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

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

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

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

3、文件搜索命令

3.1 文件搜索命令locate

--優(yōu)點(diǎn):

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

locate 文件名

--工作原理:

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

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

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

--缺點(diǎn):

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

--搜索/更新配置:

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中一切皆文件)

--選項(xiàng)

-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自帶的(以后學(xué))

--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命令

最強(qiáng)大的搜索命令——這里只學(xué)習(xí)基本的、常用的用法

--基本

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

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

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

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

——盡量縮小范圍!

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

--通配符

* 匹配任意內(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天當(dāng)天(注意沒有10天后,哈哈)——常用于日志的刪除/篩選中的(默認(rèn)按天)

-

find . -size 25k 在當(dāng)前目錄下搜索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 在當(dāng)前目錄按照i節(jié)點(diǎn)搜索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很強(qiáng)大,功能很多,靈活多變;同時帶來了,使用復(fù)雜,速度不好定

3.4 grep命令

--基本

搜索字符串:grep [選項(xiàng)] 字符串 文件名

[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ū)分

--選項(xiàng)

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

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

--與find

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

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

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

二、PHP與MySQL

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

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

1、需求分析

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

管理-列表

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

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

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

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

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

(我不想畫表格,直接寫數(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 項(xiàng)目規(guī)劃

項(xiàng)目需要什么文件

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

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

相關(guān)文章

  • Shell腳本實(shí)現(xiàn)批量生成nagios配置文件

    Shell腳本實(shí)現(xiàn)批量生成nagios配置文件

    這篇文章主要介紹了Shell腳本實(shí)現(xiàn)批量生成nagios配置文件,本文使用配置文件模板加上文件替換的方法實(shí)現(xiàn)批量生成配置文件,需要的朋友可以參考下
    2015-07-07
  • linux使用select實(shí)現(xiàn)精確定時器詳解

    linux使用select實(shí)現(xiàn)精確定時器詳解

    本文講述如何使用select實(shí)現(xiàn)超級時鐘。使用select函數(shù),我們能實(shí)現(xiàn)微妙級別精度的定時器。同時,select函數(shù)也是我們在編寫非阻塞程序時經(jīng)常用到的一個函數(shù)
    2013-11-11
  • Linux中Vi和Vim編輯器用法詳解

    Linux中Vi和Vim編輯器用法詳解

    本文詳細(xì)講解了Linux中Vi和Vim編輯器的用法,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-06-06
  • vtune自動化安裝腳本

    vtune自動化安裝腳本

    這篇文章主要介紹了vtune自動化安裝腳本,需要的朋友可以參考下
    2014-04-04
  • bash腳本中-e、&和&&的使用

    bash腳本中-e、&和&&的使用

    bash腳本里面經(jīng)常會看到-e、&和&&,你知道它的用法嗎,本文主要介紹了bash腳本中-e、&和&&的使用,具有一定的參考價值,感興趣的可以了解一下
    2024-02-02
  • Shell命令批量修改圖片文件名

    Shell命令批量修改圖片文件名

    這篇文章主要介紹了Shell命令批量修改圖片文件名,本文使用for循環(huán)、awk、sed等命令實(shí)現(xiàn)批量修改圖片文件名,需要的朋友可以參考下
    2014-12-12
  • Linux du命令查看文件夾大小并按降序排列

    Linux du命令查看文件夾大小并按降序排列

    這篇文章主要介紹了Linux du命令查看文件夾大小并按降序排列,需要的朋友可以參考下
    2015-11-11
  • bash shell獲取當(dāng)前腳本的絕對路徑(pwd/readlink)

    bash shell獲取當(dāng)前腳本的絕對路徑(pwd/readlink)

    有時候,我們需要知道當(dāng)前執(zhí)行的輸出shell腳本的所在絕對路徑,本文主要介紹了bash shell獲取當(dāng)前腳本的絕對路徑,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • linux定時任務(wù)crontab 實(shí)現(xiàn)每秒執(zhí)行一次的方法

    linux定時任務(wù)crontab 實(shí)現(xiàn)每秒執(zhí)行一次的方法

    linux crontab 命令,最小的執(zhí)行時間是一分鐘。這篇文章主要介紹了linux定時任務(wù)crontab 實(shí)現(xiàn)每秒執(zhí)行一次的方法,需要的朋友可以參考下
    2018-03-03
  • Linux Vim 實(shí)用命令詳解

    Linux Vim 實(shí)用命令詳解

    這篇文章主要介紹了Linux Vim 實(shí)用命令,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-09-09

最新評論