Hi
It turns out today is Thanksgiving. Although has not been the habit of this holiday, but only to hear the news of Thanksgiving, can think of a picture. May everyone be well!
The afternoon open the topic meeting still has the harvest, quietly, changes to the person who does not like oneself.
First, the Linux Foundation (ii)
-----Common commands for Linux (ii)-----
3. File Search command
3.1 File Search Command locate
--Advantages:
Fast Search (in the study, to look far, zoom in a little, imagine a large amount of data or a large-scale problem situation)
Locate file name
--Working principle:
Search by file name in background database
As a result, newly created files are often not searchable (cons)
Workaround: Wait (1 days);updatedb command to update the database
--Disadvantages:
can only search by file name (weak function)--understanding is, sacrificing function speed
--Search/Update configuration:
Vi/etc/updatedb.conf
Get
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_pi Pefs 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"
The first line means that the following update rules are executed
After these folders/files are not searched
So sometimes the content in some directories is not searchable-like the usual/tmp
3.2 Command Search command Whereis and which
3.2.1 Whereis
-Basic
[[email protected] ~]# Whereis ls
LS:/bin/ls/usr/share/man/man1p/ls.1p.gz/usr/share/man/man1/ls.1.gz
The directory where the command can be searched and the directory of its Help document (so where is the command, keep in mind that everything in Linux is file)
--Options
-B Find only executable files
-M only find help files
[Email protected] ~]# whereis-b mkdir
mkdir:/bin/mkdir
3.2.2 which
-Basic
[[email protected] ~]# which LS
Alias ls= ' ls--color=auto '
/bin/ls
Aliases (if any) are also found.
Here LS will automatically display a different color
[email protected] ~]# which PWD
/bin/pwd
This is true without an alias, but there are no help documents
3.2.3 Other Instructions
--Command not found
[[email protected] ~]# 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
[[email protected] ~]# where CD
-bash:where:command not found
Some types are not found because the shell comes with it (learn later)
--path Environment variables
The basic path of the environment setting, such as the above (/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
It allows us to enter commands without an absolute path.--windows is the same thing.
Or that sentence, it's all papers.
Definition of PATH environment variable: The path of the system search command
Write your own program, or command to write an absolute path, or put it in these path paths
3.3 Find command
The most powerful search command-only basic, common usage is learned here
-Basic
Find [Search scope] [search criteria] File name
[Email protected] ~]# Find/-name Install.log
/root/install.log
You'll find it's slow--it's too wide.
And the real situation will be more complex, possibly slower and more stressful.
--try to narrow the range!
And, if you're going to do fuzzy matching, like Install.log.syslog. This command is not to be found, wildcard matches are matched, and wildcard characters are exactly
--wildcard characters
* Match any Content
[Email protected] ~]# find/root-name "install.log*"
/root/install.log.syslog
/root/install.log
? Match any one character
[] matches any one of the characters in brackets
[Email protected] ~]# find/root-name "*[asdf]?"
/root/anaconda-ks.cfg
/root/.viminfo
/root/japan
/root/japan/anaconda-ks.cfg
Be aware that find is an exact match, be careful
--Search criteria
-
Find/root-name Install.log Search by file name
Find/root-inname Install.log Case insensitive
-
Find/root-user Install.log Search by Owner (not used)
Find/root-nouser search for all files without owners (commonly used)-many of these files are junk files, except in two cases-kernel-created (SYS); foreign files (e.g. USB flash drives)
-
Find/var/log-mtime +10 found 10 days ago modified file--atime file access time, Mtime modify file time, CTime change file attributes; +10 10 days ago Modified file, 10 10 days, 10 10 days (note No 10 days After, haha)--often used in delete/filter of log (default by day)
-
Find. -size 25k searches the current directory for 25k-sized files--+25 or 25 can also
[Email protected] ~]#find.-size 25k
[email protected] ~]# LL
Total Dosage 48
-RW-------. 2 root root 1273 November 05:32 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 November 06:05 Cangls
-rw-r--r--. 1 root root 26420 November 03:55 Install.log
-rw-r--r--. 1 root root 7572 November 03:52 install.log.syslog
Drwxr-xr-x. 3 root root 4096 November 05:43 Japan
[[email protected] ~]# find. -size +25k
./install.log
[[email protected] ~]# 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
[[email protected] ~]# find. -size-25m
Find: Invalid-size type ' m '
[[email protected] ~]# 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
[Email protected] ~]#
Note that the MB is uppercase m,kb is lowercase k
-
Find. -inum 213123 searches 213123 of files in the current directory according to the I node--often paired with Ls-i
-Complex operations
Find/etc-size +20k-a-size-50k Here's-A is with,-o Yes or
[Email protected] ~]# 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 {} \;
[Email protected] ~]#find/etc-size +20k-a-size-50k-exec ls-lh {} \;
-RW-------. 1 root root 37K November 03:46/etc/selinux/targeted/modules/active/modules/unprivuser.pp
-RW-------. 1 root root 26K November 03:46/etc/selinux/targeted/modules/active/modules/xguest.pp
-RW-------. 1 root root 24K November 03:46/etc/selinux/targeted/modules/active/modules/virt.pp
-RW-------. 1 root root 31K November 03:46/etc/selinux/targeted/modules/active/modules/postfix.pp
-RW-------. 1 root root 29K November 03:46/etc/selinux/targeted/modules/active/modules/unconfineduser.pp
-RW-------. 1 root root 21K November 03:46/etc/selinux/targeted/modules/active/modules/nagios.pp
-RW-------. 1 root root 21K November 03:46/etc/selinux/targeted/modules/active/modules/cups.pp
-RW-------. 1 root root 26K November 03:46/etc/selinux/targeted/modules/active/modules/rhcs.pp
-RW-------. 1 root root 27K November 03:46/etc/selinux/targeted/modules/active/modules/apache.pp
-RW-------. 1 root root 42K November 03:46/etc/selinux/targeted/modules/active/modules/staff.pp
-RW-------. 1 root root 24K November 03:46/etc/selinux/targeted/modules/active/modules/samba.pp
-rw-r--r--. 1 root root 43K September 2011/etc/mime.types
-rw-r--r--. 1 root root 30K July 2014/etc/sysconfig/network-scripts/network-functions-ipv6
-rw-r--r--. 1 root root 27K February 2014/etc/postfix/main.cf
-rw-r--r--. 1 root root 40K November 03:52/etc/ld.so.cache
-rw-r--r--. 1 root root 23K October 2014/etc/libreport/events/report_rhtsupportattach.xml
-rw-r--r--. 1 root root 22K October 2014/etc/libreport/events/report_rhtsupport.xml
-rw-r--r--. 1 root root 28K November 2010/etc/makedev.d/01linux-2.6.x
-rw-r--r--. 1 root root 27K November 2010/etc/sound/events/gnome-2.soundlist
This is to add the second command with-exec, execute the preceding result, and must be {}/;
------Summary
Is find is very powerful, a lot of functions, flexible, at the same time brought, the use of complex, the speed is not fixed
3.4 grep Command
-Basic
Search string: grep [Options] string file name
[[email protected] ~]# 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
Note that the search is not a string-compliant file, but a corresponding string in the file--to distinguish from find
--Options
-V to reverse, that is, a string that does not contain
-I is case insensitive
--With Find
Find: Find file + exact match + use wildcard match
grep: Find string + include match + use regular expression match
-------------------------------------------------------------------
Second, PHP and MySQL
-----Article Release System practice (i)-----
Understand PHP operation MySQL method, familiar with the MySQL function of PHP
1. Demand Analysis
1.1 Backend Management System
Management-List
Publish, modify, delete-Program
1.2 Front desk Display system
Article list, article content page
1.3 Database Design
A table for storing articles
(I don't want to draw a table, just write the database command Well, I hope I can understand later)
Cerate TABLE article (
ID INT (one) PRIMARY KEY auto_increment,
Title CHAR (+) is not NULL,
Author CHAR () not NULL,
Description VARCHAR (255) is not NULL,
Content TEXT not NULL,
Dateline INT (one) not NULL DEFAULT 0
);
1.4 Project Planning
What documents are required for the project
2. Backstage Management system
2.1 Creating configuration files and initialization files
Noon meeting, no nap ... Go back to reading early and sleep.
It turns out today is Thanksgiving-linux basics continue &mysql and PHP