1. History
Linux: Linux Is Not Unix
Unix: it is the predecessor of Linux. Because of the charges, it can only be used by companies and schools. A good guy writes a Linux program after he thinks it is very good at school.
Linux core: A kernel-based operating system. Linux brothers only write the kernel (Hardware Management Program)
Linux releases: debian, slackware, suse, Hongqi, turbolinux, redhat, fedora, and mandrake (kernel-dependent tools). Peripheral dependencies are written on the Linux kernel, many management hardware tools are written based on the dependency program.
Linux version: r. x. y, r: release version, x: even number, stable version, odd number, development version, y: Number of bug fixes, e.g. 2.0.38
2 partitions:
VFS: Virtual File System. All file system interfaces can be programmed according to the interface (polymorphism)
Partition Table: records the partition information. Generally, it is located at the beginning of the corresponding partition. A maximum of four records can be recorded. Therefore, a maximum of four extended partitions can be added to the primary partition (generally used to install the system ), the table below records logical partitions (different file systems)
Format: create different file systems, that is, different storage specifications for data.
Why partition: you can mount a variety of file systems on the same hard disk, a variety of small cells, and different file systems have different small cells. Easier to manage
Windows: c :( primary partition), d :( extended partition/logical partition), e :( extended partition/logical partition)
Linux partition name: All devices are files in Linux, including character devices (such as keyboards) and block devices (such as hard disks)
--/Dev/xxyN,/dev/: Directory Name of all device files. xx: the first two letters of the partition name indicate the device type of the partition. Usually hd (IDE disk) or sd (SCSI disk ). Y: This letter indicates the device where the partition is located, which represents the hard disk number. N: indicates the partition. The first four partitions (primary and logical partitions) are from 1 to 4, and the logical partitions start from 5. For example:/dev/hda3: The third primary partition or logical partition on the first IDE hard disk,/dev/sdb6: The second logical partition on the second SCSI hard disk.
Access partition: mount is used to associate a partition to a directory. Mount partitions enable storage starting from the specified directory (called a mount point) to be used. For example: mount/dev/cdrom/mnt/cdr
At least two partitions:/partition, SWAP partition: when the hard disk is used as memory (Virtual Memory), the actual physical memory is twice
3. directory structure: google
4 boot sequence)
Load bios (hardware information)
Read MBR's config to find out the OS: find the operating system to start based on the MBR configuration.
Load the kernel of the OS: Core File started by the operating system
Init process starts: init process started
Execute/etc/rc. d/sysinit: run the command
Start other modules (etc/modules. conf): read various modules of the system
Execute the run level scripts:, startup level, start to which level, layered structure, divided into six layers, each layer does not affect each other, can be modified (/etc/inittab)
Execute/etc/rc. d/rc. local: execute the script
Execute/bin/login
Shell started ..
5 linux help
Command -- help
Man command
6 command (commonly used)
Ls: list files and directories in the current directory. ls-l: displays details. ls-R: recursively displays all files in the directory and directories in the directory.
Tree: tree display
Cd: Enter the directory. cd .. the upper path is returned.
Pwd: current path
Mkdir: Directory Creation
Rmdir: delete an empty directory.
Rm-rf: recursively force delete a directory or file, force delete without jumping out of confirmation Information
Touch: create a file
Cp: Copy, cp-r: recursive copy directory
Mv: Mobile, renamed
Vi: Text Editor (cross-platform, remote), vi file name (create or edit file)
Enter the command mode: Only commands can be typed
A: append
Switch to command mode: esc
: W disk, q exited
More: View File Content
Cat: View File Content
Tac: View File Content in reverse order
Head: view files, head-3: view the first three lines of Files
Tail: view files; tail-3: List the last three rows
Clear: clear screen
Find: find the location of the file. find/-name my *
Grep (commonly used): name of the grep string file to find the line of the corresponding string in the text file
Whereis: view who executed the command and its documentation
Echo: echo $ PATH: view PATH
Ln: link. The two files are synchronized, which is different from copy. Ln-s: Soft link, equivalent to a windows shortcut
Useradd: Add a user and add the corresponding folder in/home. By default, the group is the same as the user name, and the group name is-g.
Usermod: Modify user name,-g: Modify group name
Userdel: delete a user
Su User name: switch user
Passwd: Specifies the user password.
More/etc/passwd: All Users
More/etc/group: group information
Ls-l: displays detailed information (details ):
First: divided into-: file, l: Link, d: Directory
Second to fourth: the owner of the file/directory and the permissions of the owner
Step 5 to Step 7: permission of the file/directory owner for others in the same group
Eighth to tenth: permissions of the remaining persons
Chmod: Modify permissions, chmod u + x file name: Modify permissions of the current user, chmod g + x file name: Modify permissions of the same group, chmod 777: Advanced Operations, the first 7 indicates the user permission, the second 7 indicates the same group permission, and the third 7 indicates the remaining member permission. The second 7 indicates the read and write operations (1 indicates the permission, 0 is none.) For example, 7: 111,5: 101.
Chown: modifies the owner and chown owner file name.
Wc: counts the number of lines, characters, and wordcount of a specified text file.
Col: filter control characters
Pipeline: Send the output of one command to another as the input of another command. Command 1 | command 2 |... command n
Ls-Rl/etc | more
Cat/etc/passwd | wc
Cat/etc/passwd | grep lrj
Dmesg | grep eht0
Man bash | col-B> bash. txt
Ls-l | grep "^ d": List Directories
Ls-l * | grep "^-" | wc-l: number of files in the current directory
Wall: wall 'COMMAND ', which sends the result of command execution to everyone logging on to the shell.
Command replacement: replace 'command' with the command
Redirection: write command output to a file or read the input command
Output: ls> cmd.txt, ls> cmd.txt,> represents replace,> represents append
Input: wall <aa.txt
Export: this command is required when the environment variable is set in linux to be used by others, such as: export PATH =/home/yyz/Applications/adt-bundle-linux-x86_64-20130917/sdk/tools: $ P
ATH
Ps: Observe the following processes: ps-ef: all processes under the current user, ps-ef | grep process name
Kill: kill process, kill-9 process name, and force kill Process
Service: service management, service name start: start the service. Service name stop: Shut down service, commonly used: service iptables stop, firewall off
Wget URL: locally connect to the website (one of the functions), test
7. Build a deployment Environment
You must use command lines only because the server uses command lines only.
Service self-start: Use of the chkconfig command (startup level and firewall settings (iptables ))