Thanksgiving. Although I have not had the habit of this holiday, but only to hear the message of Thanksgiving, can think of a picture. May everyone be well!
A preface to Learning Linux
When you choose Linux distributions, you will want to start learning Linux.
1. Install Linux of course, please go online to Google or Baidu, download Redhat Linux 5 installation CD-ROM, and then install VMware, install yourself
2. More hands, more knock orders. Only reading, not practice, everything is a cloud. The default installation Redhat 5, boot Redhat 5 is a graphical interface, but the graphical interface is best to use less, to learn Linux disadvantage, must try to use character interface, slowly accustomed. At work, using Linux, the probability of using a graphical interface is almost 0. So you go to learn the technical value of the graphical interface is almost 0, the price is not high.
How to learn Linux
1. The first thing to learn Linux is to learn the basics of Linux, this aspect I recommend Bird Brother's private dishes of the Linux basic file, which explains the Linux files, disk, network, process, etc., read this book, and a command to practice, you began to get started Linux.
2. The second thing to learn about Linux is to use Linux. Previously said that the most useful Linux is the server domain, so you have to learn the second step is to learn to set up a server, this aspect I recommend bird Brother's private dish Linux stand file, this book introduces a lot of server assumptions, there is no need to put all the server's erection steps are read. Personally think you can read the basics of setting up a server, and then see how to build a Web server, FTP server, Telnet server, SSH server. Learn how to build these servers, manage them, and choose other servers based on your personal interests and needs.
3. Advanced-programming. Here, you will only use Linux, perhaps learn a little shell programming, can learn a simple shell, write a script. But if you want to become more familiar with Linux, you need to learn Linux programming. For example, how the Linux pipeline is done, how the Linux Deamon process is implemented, and why Nohub can allow a process to run in daemon form, even if the shell is closed, the process is not closed. These, you learn the Linux environment programming, you will be enlightened. Here I recommend "UNIX Environment Advanced Programming", this book is Linux/unix programming Bible, is called the world.
4. When we got here, you can have an understanding of Linux/unix, there is a certain basis, then you will be based on your interest to choose the direction you are interested to learn, perhaps according to your direction to study (many times the work is not their own interests), master to lead the door, practice in the individual, The above steps are the most simplified steps I can think of, the more things to learn, only let beginners more confused.
The afternoon of the meeting or some harvest, quietly, to the people who do not like their own.
I. Linux Basics (II.)
-----Linux Common commands (ii)-----
3. File Search command
3.1 File Search Command locate
--Advantages:
Fast Search (in the study, to look away, enlarge a point, imagine a large amount of data or the size of a large problem)
Locate file name
--Working principle:
Search by file name in the background database
As a result, newly created files are often not searchable (disadvantage)
Solution: Wait (1 days); updatedb Command Update database
--Disadvantages:
Only search by file name (weak)--understanding is, sacrificing function to promote 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 contents of some directories are not searchable--such as the commonly used/tmp
3.2 Command Search command Whereis and which
3.2.1 Whereis
--Basic
[Root@andy ~]# 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 where the Help document is located (so the command location where is, remember that everything in Linux is file)
--Options
-B Find only executable files
-M find Help files only
[Root@andy ~]# whereis-b mkdir
mkdir:/bin/mkdir
3.2.2 which
--Basic
[Root@andy ~]# which LS
Alias ls= ' ls--color=auto '
/bin/ls
The alias (if any) is also found.
Here LS will automatically display a different color
[Root@andy ~]# which PWD
/bin/pwd
This is true without aliases, but there are no help documents
3.2.3 Other Notes
--a command that cannot be found
[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
Some types cannot be found because of the Shell's own (after learning)
--path Environment variables
The basic path of environment setting, such as 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 the absolute path--windows is also the case
Or that sentence, it's all a file.
Definition of PATH environment variable: path to System search command
Write your own program, either to write an absolute path or to put it in these path paths
3.3 Find command
The most powerful search command--just learn the basics, common usage
--Basic
Find [Search scope] [search condition] File name
[Root@andy ~]# Find/-name install.log
/root/install.log
You'll find it's very slow--it's too wide.
And the real situation will be more complicated, more slow and more stressful.
--Try to narrow the scope!
Also, if you plan to make a fuzzy match, such as Install.log.syslog. This command is not found, to do wildcard matching, wildcard is an exact match
--wildcard character
* Match any Content
[Root@andy ~]# find/root-name "install.log*"
/root/install.log.syslog
/root/install.log
? Match any one character
[] matches any one of the characters in the brackets
[Root@andy ~]# 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 terms
-
Find/root-name Install.log Search by filename
Find/root-inname Install.log is case-insensitive
-
Find/root-user Install.log Search by Owner (not used)
Find/root-nouser searches for all files that do not have an owner (commonly used)-many of which are junk files, except in two cases-the kernel creates (SYS); foreign files (such as U disk)
-
Find/var/log-mtime +10 find 10 days ago Modified files--atime file access time, Mtime modify file time, CTime change file attributes; +10 10 days ago Modified files,-10 10 days, 10 10 days (note No 10 days later, haha )--Frequently used in deletion/filtering of logs (default by day)
-
Find. -size 25k Search the current directory for 25k size files--+25 or-25 can also
[Root@andy ~]# Find. -size 25k
[Root@andy ~]# ll
total dosage of
-rw-------. 2 root 1273 November 05:32 anaconda-ks.cfg
--. 1 Root 0 November 06:05 Cangls
-rw-r--r--. 1 root root 26420 November 03:55 install.log
-rw-r--r--. 1 root root 75 72 November 03:52 Install.log.syslog
drwxr-xr-x 3 root root 4096 November 05:43 Japan
[Root@andy ~]# find-size +25 K.
/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 Anaconda-ks.cfg
./japan/cangls
[Root@andy ~]# find.-size-25m find
: Invalid-size type "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/anaconda-ks.cfg
./japan/cangls
[Root@andy ~]#
Note that MB is uppercase m,kb is lowercase k
-
Find. -inum 213123 searches for 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 is with, O is or [Root@andy ~]# find/etc-size +20k-a-size-50k/etc/selinux/targeted/m odules/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 37K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/UNPRIVUSER.PP-RW-------. 1 root 26K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/XGUEST.PP-RW-------. 1 root 24K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/VIRT.PP-RW-------. 1 root 31K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/POSTFIX.PP-RW-------. 1 root 29K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/UNCONFINEDUSER.PP-RW-------. 1 root 21K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/NAGIOS.PP-RW-------. 1 root 21K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/CUPS.PP-RW-------. 1 root 26K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/RHCS.PP-RW-------. 1 root 27K November 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/APACHE.PP-RW-------. 1 root root 42KNovember 03:46/ETC/SELINUX/TARGETED/MODULES/ACTIVE/MODULES/STAFF.PP-RW-------. 1 root 24K November 03:46/etc/selinux/targeted/modules/active/modules/samba.pp-rw-r--r--. 1 root 43K September 2011/etc/mime.types-rw-r--r--. 1 root 30K July 2014/etc/sysconfig/network-scripts/network-functions-ipv6-rw-r--r--. 1 root 27K February 2014/etc/postfix/main.cf-rw-r--r--. 1 root 40K November 03:52/etc/ld.so.cache-rw-r--r--. 1 root 23K October 2014/etc/libreport/events/report_rhtsupportattach.xml-rw-r--r--. 1 root 22K October 2014/etc/libreport/events/report_rhtsupport.xml-rw-r--r--. 1 root 28K November 2010/etc/makedev.d/01linux-2.6.x-rw-r--r--. 1 root 27K November 2010/etc/sound/events/gnome-2.soundlist
Here is to add the second command with-exec, execute the preceding result, and must add {}/;
------Summary
Find is very powerful, many functions, flexible and changeable, but also brought, the use of complex, speed is not set
3.4 grep Command
--Basic
Search string: grep [option] string file name
[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
Notice that the search is not a string-compliant file, but a corresponding string in the file--a distinction from find
--Options
-V, which contains no strings.
-I is case insensitive
--and find
Find: Finding files + full match + using wildcard matching
grep: Find string + include match + use regular expression to match
-------------------------------------------------------------------
Second, PHP and MySQL
-----Article Publishing System Practice (i)-----
Understand the PHP operation MySQL method, familiar with the PHP MySQL function
1. Demand Analysis
1.1 Background Management System
Management-List
Publish, modify, delete-Program
1.2 Front Display System
Article list, article content page
1.3 Database Design
A table can be used to store articles
(I don't want to draw a table, write a database command directly, I hope I can understand later)
Cerate TABLE article (
ID INT (one) PRIMARY KEY auto_increment,
title CHAR (m) not NULL,
author CHAR (x) not NUL L,
description VARCHAR (255) not NULL,
content TEXT is not null,
Dateline INT (one) not null DEFAULT 0
);
1.4 Project Planning
What files are needed for the project
2, Backstage management system
2.1 Creating a configuration file and initializing a file