20175327 "Information Security System Design Basics," the first week of learning summary
Learning content summary
Familiar development environment under Linux
- Why was Linux
- Linux is an operating system, that is, the system calls and kernel that two
- Linux command
command [options] [arguments]
acting on the different command arguments, options distinction instruction
- man command
man -k
It can be combined withgrep
multi-keyword search- Equivalent command
apropos
man -f cmd
View command of the basic functions, equivalent towhatis
- cheat command
- hot key
ctrl+c
End program In
Ctrl+d
a keyboard input or exit end terminal
Ctrl+s
tentative current program, press any key to resume operation after a pause
Ctrl+z
the current program running in the background, the command to return to the foreground fg
Ctrl+a
move the cursor to the first input line, is equivalent to the Home key
Ctrl+e
to move the cursor to the end of the input line, corresponding to the end key
Ctrl+k
to delete the line from the end of the cursor position
Alt+Backspace
forward delete a word in
Shift+PgUp
the terminal display scrolls up
Shift+PgDn
the displays scroll down terminal
- Shell used a wildcard
*
Match zero or more characters
?
match any one character
[list]
of any single character match list of
[!list]
matching characters other than any single character in the list of
[c1-c2]
any single character matches the c1-c2 as: [0-9] [az]
{string1,string2,...}
matches or sring1 string2 (or more) one string
{c2..c2}
matches all characters c1-c2 as in {1..10}
who am i
View user command- who commands other commonly used parameters
-a
Print can print all
-d
print dead processes
-m
with am i, mom likes
-q
to print the number of users currently logged on user name and
-u
print the currently logged on user login information
-r
print run level
- who commands other commonly used parameters
su <user>
Switch to the user user,su<cmd>
to run the cmd command privilege level,su - <user>
switch users while switching environment variables will followgroups <user>
Command that the user belongs to which groupusermod
Command for the user to add user groups,deluer
delete usersls -l
Check the file permissionscd
Command to switch directories:.
the current directory,..
represent the parent directory,-
a directory on said~
generally indicates the current user's "home" directory. Usepwd
command to obtain the current location path (absolute path)mkdir(make directories)
Command creates an empty directory, create a directory can also be specified privilege attributes, and-p
parameters, and create parent directorycp(copy)
Command to copy a file or directory to the specified directory, copy the directory additional parameters-r
- Use
rm
the command to delete a file or directory, delete the directory additional parameters-r
- Use
mv
command, move file (shear),
rename file, rename batch, to achieve the rename - Use
cat
,tac
and thenl
command to view filescat
for the positive sequence display,tac
reverse the display,nl
command, add line numbers and print - Use
more
andless
command tab to view the file, the default display only one screen contents opens, displaying the progress of the current reading (percentage) at the bottom end. You can useEnter
the key to scroll down one line, use theSpace
keys to scroll down a screen, press theh
display help,q
quit - Use
head
andtail
command to view the files, only to see the first few lines (the default is 10 lines, all less than 10 lines are displayed) and the end of a few lines, you can also add -n parameter, followed by the number of rows file
Command to view the type of filedeclare
Command to create variables- Environment variables related commands:
set
display all current Shell environment variables, including its built-in environment variables (related to Shell appearance, etc.), user-defined variables and export environment variables
env
display environment variables associated with the current user, you can also make the specified command running in the environment
export
display derived from Shell environment variable to the variable, it can also be exported as environment variables custom variables - Variables Review:
${变量名#匹配字串}
scratch backward match began, delete data in line with the shortest match string
${变量名##匹配字串}
from scratch backward match began, delete data in line with the longest matching string of
${变量名%匹配字串}
forward start from the tail match, delete data in line with the shortest match of the string
${变量名%%匹配字串}
from the tail to before the start of matches, the longest match string data is deleted in line with
${变量名/旧的字串/新的字串}
the first string in line with the old string is replaced with a new string
${变量名//旧的字串/新的字串}
will comply with all the old string strings replaced with a new string - Linux file compression formats:
*.zip
ZIP packaged compressed files
*.rar
rar program compressed file
*.7z
7zip program compressed files
*.tar
tar packaged, uncompressed file
*.gz
the gzip (GNU zip) compressed files
*.xz
xz program compressed files
*.bz2
bzip2 program compressed file
*.tar.gz
tar package , gzip file compression program
*.tar.xz
tar package, xz compressed program files zip
Compression packing procedure,zip -r -q -o shiyanlou.zip /home/shiyanlou
-r parameter represents the recursive package contains the entire contents of subdirectories, -q parameter represents the quiet mode, which does not output information, -o to the screen, represents the output file, to be followed later in the package output file name. Use the du command to view the file size back pack, -e parameter to create an encrypted archive,-l
parameter conversion formats to make them open without problems under Windowsunzip
Command unzip the zip file,-d
represents the path (does not exist will be created automatically),-l
not only extract the archive to view the content,-o
specify the encoding typerar
Compression packing command,rar a shiyanlou.rar
compressed files (usinga
parameter to add a directory ~ to an archive file, if the file does not exist it will be created automatically),rar d shiyanlou.rar .zshrc
delete a file from the specified archive file,rar l shiyanlou.rar
view does not extract the files,unrar x shiyanlou.rar
full path decompression,unrar e shiyanlou.rar tmp/
remove decompression pathtar
Packaging tool,tar -cf shiyanlou.tar ~
create a tar package,-c
it represents the creation of a tar package file,-f
used to specify the file name created, the file name must note immediately-f
after the parameters,-v
the parameters in a visual way output of packed files. The above will be automatically removed indicates an absolute path/
, you can also use the-P
reserved symbol absolute path, unpack a file (-x
parameter) to specify the path of an existing directory (-C
parameters) to see only puzzling package file-t
parametersdf
Command to view disk capacity, plus-h
converted into a form able to readdu
Command to view the capacity-d
parameter specifies the directory to see the depth (grade 0 ~ ~ 1 directory)dd
Command is used to copy files and converting,bs(block size)
to specify the block size (Default is Byte, may be assigned as 'K', 'M', 'G' units, etc.),count
is used to specify the number of blocksbs(block size)
Is used to specify the block size (Default is Byte, may be assigned as 'K', 'M', 'G', and other units), count specifies the number of blocksdd
Command to create a virtual image file,dd if=/dev/zero of=virtual.img bs=1M count=256
mkfs
Command to format the disk, the commandsudo mkfs.ext4 virtual.img
is formatted as ext4 file systemsudo mount
View Host already mounted file system, the command formatmount [options] [source] [directory]
, common operationsmount [-o [操作选项]] [-t 文件系统类型] [-w|--rw|--ro] [文件系统源] [挂载点]
,umount
command unload the mounted disksudo umount /mnt
fdisk
Partitioning the disk, view the hard disk partition table informationsudo fdisk -l
, enter partition modesudo fdisk virtual.img
- With a
type
view, built-in command to
xxx is a shell builtin
the external command
xxx is /usr/sbin/xxx
command is the name of the alias command set
xxx is an alias for xx --xxx
help
Builtin command can only help information for display. It has a substantially external command parameters--help
so that it can help to give the correspondingman
No built-in and external commands distinctioncut
Command, print a field of each linegrep
Command, find the matching string in the format in the text or in stdingrep [命令选项]... 用于匹配的表达式 [文件]...
wc
Command, simple little tool countsort
Sort commanduniq
To re-ordertr
Command can be used to delete some text in a text message- Use
tee
command while redirected to a plurality of files, except that the addition to the need to redirect the output files need to print the information terminal - Permanent redirect, use the
exec
command - Using a set / dev / null complete shielding mask command output command output
2. familiar with the basic operation of vi
Reference: https://blog.csdn.net/xie_xiansheng/article/details/78413306
3. be familiar with the basic principles of gcc compiler
Process GCC compiler program: source files (* .c) -> pretreatment (pre-processor) -> compiler (Compiler) -> Assembler (assembler) -> Link (Linker) -> executables
Consider a simple hello.c source file, i.e., the output code is a helloworld. To show through several different steps gcc compiler process:
The first step: ~ gcc -E hello.c -o hello.i This is about the source file preprocessor, which is mainly a number of macro substitution, not will check syntax, -E parameter allows the compilation process to stop gcc back at the end of the pretreatment.
Step two: ~ gcc -c hello.i -o hello.o This step does some syntax checking, .i file compiled into object files.
The third step: ~ gcc hello.o -o hello The third step is the final step, the target link to an executable file, the last hello is custom build the executable file name.
Modular GCC compiler program: Code: ~ gcc denpend.c hello.c -o hello
4. familiar with common gcc compiler options
Reference: https://blog.csdn.net/arackethis/article/details/43370307
The skilled use gdb debugger technology
1) Start GDB
GDB or Hello Hello gdbfile
2) display the program
list, or L
. 3) break point
break (b) main () // function entrance
break (b) 11 // line number
break (b) hello.c : 14 // specific file line number
after the break (b) 12 if i = 10 // if statement satisfies the break point at line number
4) acquires information of the breakpoint
info BREAK
. 5) remove the breakpoint
delete 13 (No break )
6) run a program
rUN (R & lt)
. 7) to step (not enter Functions)
Next (n-)
. 8) to step (entering subroutine)
sTEP (S)
. 9) and continue the
continue (C)
10) See variable
print ( p) i (variable name)
11) run the program to the end of the current function
Finish
12 is) monitoring variables
watch i (variable name)
13) exits GDB
quit (Q)
6. makefile familiar with the basic principles and Syntax Specification
7. grasp generation and invoke methods of static and dynamic libraries
Reference: https://blog.csdn.net/hua12134/article/details/88381929
8. Almost appreciated C program simulation module, the principle of the modular decomposition "high cohesion, low coupling"
高内聚:
如果类中的方法是一组相关的行为,则称该类是高内聚的,反之成为低内聚的。
高内聚便于类的维护,而低内聚不利于类的维护。
迭代器模式中,对于高内聚低耦合原则的使用会有很好的解释。
低耦合:
就是尽量不要让一个类有太多其他类的实例引用,以避免修改系统的其中一部分会影响到其他部分,
中介者模式中,就会体会到这个低耦合原则的必要性。
9.了解链接的概念
参考:https://blog.csdn.net/u011857683/article/details/81044856
教材学习中的问题和解决过程
xxx
xxx
代码调试中的问题和解决过程
xxx
xxx
课后作业中的问题和解决过程
XXX
XXX
本周代码托管截图
其他(感悟、思考等,可选)
xxx
xxx