Course outline {
* 1 File Processing Command [ls, CP, MV, RM, Cat, Ln]
* 2 permission management command [chmod U + r g-w o = x, chown, chgrp, umask]
* 3 File SEARCH Command [which, find, locate, updatedb, grep]
* 5 compression and decompression commands [gzip, gunzip, tar, zip, Bzip2
* 6 network communication command [write, wall, ping, ifconfig]
* 4 HELP Command [Man, info, whatis apropos, help]
* 7 system shutdown command
* 8 shell application skills
}
File naming rules and Command Format {
1). All characters except/are valid. But don't bother yourself! A B; the file starting with. Is a hidden file !!!
Command Format: Command-option Parameters
For example: ls-La/etc Description: two special directories... represent the parent directory of the current directory and the current directory respectively !!
}
File Processing Command {
#1
Ls, CD [command path: Shell built-in command], PWD [/bin/pwd], touch [/bin/touch], CP [/bin/CP], MV...
-- 1 * command name: ls 2 * command Original Definition: List 3 * command path:/bin/LS 4 * execution permission: All Users 5 * Function Description: Display directory files
Syntax: ls option [-AlD] [file or directory]
-L displays details. -D. view directory properties. Ls-ld: Give it a try! It's just this directory ..
Expand common knowledge 『
Root: {/sbin and/usr/sbin}
All users: {/bin and/usr/bin}
Bin-binary/usr-user/sbin-Super binary
* ** LS-l {drwxr-XR-x 2 HP 4096 dlinux
Part 1 {
File Type D directory
-Binary files
L soft link file link
Rwx R-x r-x
Owner U group G others o
User Group others
(Owner can transfer)
}
Part 2 {2-number of hard links}
Third, Part 4 {
HP
Owner Group
}
Part 5 {
4096-File Size [not very accurate, mark the size of the Directory itself, not the total size of the Directory] data block (512 bytes in 1 unit)
Organization and management of data, each OS has its own, such as NTFS, ext3...
The smallest unit for storing data is data blocks !!
File direction... At least one data block must be occupied during storage. (You have to make a chair for 60, 200, or two for 600 !)
What do you do? The smaller the data block, the smaller the access speed. The larger the data block, the larger the access space.
What do you do and how much data block is suitable... Sometimes !!
}
Part 6 {creation time or last modification time! }
Part 7: file directory name
』
----------------
#2 CP [copy]
Copy common files using CP/etc/xady/test
CP-r/home/Neil/test copy directory
#3 mV [function: Cut/rename]
MV file1 file3 change name
MV file1/tmp cut
MV file1/tmp/file3 cut + change name
#4 RM delete file rmdir (delete empty directory (only ))
Rm file1: delete the file (with a prompt), Rm-F file1 (no prompt, forced, but this is dangerous !)
Rm-r file2: Delete the directory [special question, note] Rm-RF file3 (directory name)
#5 view the file content in cat [whether it is a long file or not]
* More page-based display of File Content
{(Space/F) display next page enter display next line Q/Q exit}
* Head-num [view the first few lines of the file. The default value is 10.]
* Tail-num [file name] [-F dynamic display]
#6 ln-s [source file] [target file]
-S soft link
The ACL for Soft link files is special. lrwxrwxrwx --> 10 (very small, just a symbolic link) points to the source file.
The soft connection file type is L
: Similar to Windows shortcuts! Soft connection across file systems !!
**
Ln [source file] [target file] "hard link"
A hard link is equivalent to a copy, but it is different from a copy. (The difference is synchronous update)
CP-p... can retain the original time value
Echo "this is a test"> file2
If you delete the source file, the hard link is still synchronized!
--------- Why can I synchronize updates? --------
The kernel only recognizes numbers 1 2 3 4... and a B c d...
Each file has a digital ID.
In Linux, users and users must have uid, processing, group, and group ID.
To process a process, the process must have a PID and a digital identifier. The kernel processes the object based on the identifier.
The digital ID of the file is inode.
The kernel must have an identifier for any processing method.
Each file must have an I node. If it does not exist, it cannot be accessed!
The hard link has the same inode as the source file, so you can synchronize updates!
** ---- You need to know that the data stored in the Linux File System is actually divided into two parts: inode and data. Inode stores data attributes (such as rwx ),
Data stores data. A hard link adds a tag to the same data in inode. The tag is deleted when it is deleted,
So the hard link can be opened.
Different partition file systems are different... hard links are not cross-file systems.
------------------------------------------------------
Permission Handling Command {
Chmod U + R
G-W
O = x
U-owner
G-group
O-Other people can chmod g = rwx file1
The authorization method is simple, intuitive, and good!
Rwxr-XR -- corresponding to number 754
Chmod numeric file name
Rwx in-depth understanding {
/Home/HP/file1
// Home/HP 777
/Home/HP/file1 000, but now you can delete this file!
}
File
R-cat, more, Head, tail
W-Echo, Vi. [This does not mean you can delete this file]
X-command, script
Directory
R-ls
W-touch, mkdir, RM can create and delete files in this directory
X-CD
CHOWN command {the owner can be changed
Users of the nobody System
Chown nobody file1
-- Chgrp: Change the group --
}
Add User {
Useradd
Passwd
}
When creating files and directories, you have a default permission {
Umask and umask-S can view the default file permissions
0022 first 0-Special Permission bit
022-user permission bits [permission mask value] 777-022 = 755
755-111 = 644
644 default Linux permission rules;
The file created by default cannot be granted the executable x permission.
If you must change it, you can change it to 750. You think it is reasonable!
Umask 027 can be changed !!
}
File SEARCH Command :{
#1 which
Function Description: displays the directory where system commands are located. [aliases can be displayed differently.]
Example: $ which ls
Whereis [the difference is that you can see the location of the help document where the command is located]
#2 find
Command path:/usr/bin/find
Syntax: Find [search path] [Search Keyword]
Function Description: searches for files or directories.
-1-
Example:
$ Find/etc-name init * find the file starting with init in the/etc directory
$ Find/-size + 204800 search for file blocks larger than MB in the root directory = B
Greater than: +, less than:-, equal to: Do not write + ,-;
$ Find/-user SAM: Find the file whose owner is Sam in the root directory
Find principle-save system resources as much as possible
-2-
#1-day ctime, atime, mtime
#2-minute Cmin, Amin, mmin
C-change indicates that the file property has been modified, owner, group, and permission.
A-Access access
M-Modify: indicates that the file content has been modified.
-Inner, + exceeds
Find/etc-mmin-120
We just talked about four find options, but there are no more than 40! Learn to read documents!
-3-connector-A and logic and-O or logic or
$ Find/etc-ctime-1 search for files and directories with properties modified within 24 hours under/etc
$ Find/etc-size + 163840-a-size-204800 search for files larger than 80 mb and smaller than MB in/etc
$ Find/etc-name init *-a-type F [binary file]
$ Find/etc-name init *-a-type L [Soft link file]
-Type file type F binary file l soft link file d directory
Connector find...-exec command {}\;
{} Find Query Result \ Escape Character [ls \ ls]
$ Find/etc-name inittab-exec LS-l {}\;
Search for the inittab file in/etc and display its details
$ Find/test-name testfile3-exec RM {}\;
$ Find/etc-name inittab-OK ls-l {}\; can you ask-OK?
$ Find/etc-name inittab-a-type F-exec LS-l {}\;
The file name is very strange. rm ---abc rm "a B"
$ Find.-inum 16-exec RM {}\;
Bytes ------------------------------------------------------------------------------------------
#3 locate [search for Linux-specific file databases quickly]
Syntax: locate [Search Keyword] Function Description: Find a file or directory example: $ locate file ** list all file-Related Files
#4 updatedb execution permission: Root Syntax: updatedb Function Description: Create a database example for the entire system directory file: # updatedb
#5 grep Function Description: Search for matching strings in the file and output an example: # grep FTP/etc/services
}
Help Command {
#1 man [more will be called]
Example: $ man ls: view the help information of the LS command
$ Man services: view the help information of the configuration file services]
If all of them exist, the configuration file will be given priority.
There are multiple types of help: the first is the command, and the fifth is the configuration file.
MAN 5 passwd man passwd MAN 1 passwd
#2 info [Linux exclusive, slightly different from man's representation]
Syntax: info [any keyword]
Example: $ info ls: view the help information of the LS command
#3 whatis apropos
Command path:/usr/bin/whatis apropos/usr/sbin/makewhatis
Execution permission: all user, all user, Root
Syntax: whatis apropos [any keyword]
Function Description: Get Brief description of the index.
Example: $ whatis ls
$ Apropos fstab
Equivalent to man-K
Help Command: whatis
Example: # Make whatis
Create a database for whatis and apropos search. When the two commands are incorrect, the whatis database is not created.
#4 help [view the help of shell built-in commands]
Hardware-kernel-shell
Man bash [just a built-in command] tells you which built-in commands are available in the current Shell
}