Information Security system design basics second week study summary (i)

Source: Internet
Author: User
Tags class operator first string save file

Basic Experiment Report of C language programming under Linux

Learning tasks

1. Familiar with the development environment under the Linux system

2. Familiar with the basic operation of VI

3. Familiar with the basic principles of the GCC compiler

4. Familiar options for using the GCC compiler

5. Be familiar with GDB debugging technology

6. Familiarity with makefile fundamentals and grammatical norms

7. Mastering the generation of static and dynamic libraries

Learning content

1. Shortcut keys

2. Vim

3. GCC

4. gdb

5. Make and Makefile

Learning process Recording

First PartFirst section First: moving the cursor

H left, J down, k up, L right

Section Two: the entry and exit of Vim

<ESC>: Make sure you're in normal mode

: q! Exit editor (discard changes)

Section three: deletion of text edits

x key; Delete the character at the cursor position.

Section Fourth: Inserting text edits

I key: Inserts text at the cursor.

Section Fifth: Adding text edits

A key: Adds text at the end of the line.

Section Sixth: Editing files

Use a file that can be changed (into the Vim editor): Shell input: Vim tutor< carriage return >

Vim: Start Vim editor; Tutor: The name of the file you wish to edit

wq< Enter;: Save exit

Section Two: Delete class commands

DW: Delete the word where the cursor is located

Second, section Two: more Delete commands

S $: Deletes from the cursor to the end of the current line. (entire line after the current position)

Section II: About Commands and objects

Operator

Action

D (delete operator)

W from the current cursor's current position until the beginning of the next word, excluding its first character

E from the current cursor's current position until the end of the word, including the last character

$ from current cursor current position until end of current line

Section Fourth: Using counts to specify actions

Add a number before the action to make it repeat so many times

such as: 2w (the cursor moves forward two words), 3e (the cursor moves forward to the end of the third word), 0 (move the cursor to the beginning of the line)

Section Fifth: Using counts to remove more

Enter a number when using the operator to make it repeat multiple times

such as: d2w (delete two uppercase letters of the word)

Format of modified commands in normal mode: operator (operator) [number] (numbers that can be appended, number of Delegates) motion (action)

The second section sixth: operation of the whole line

DD: Delete the entire current line (2DD: Delete two rows)

Section seventh: Undo Class Commands

U: Undo the modification of the whole line; u: Undo Last executed Command

Ctrl +r: Undo Revocation

Section three: Placing class commands
    1. The input DD will be deleted by a row and will be saved in a register of vim
    2. P Key: After placing the last deleted content in the cursor
Section Two: Replace class commands

R key: Replace the character at the cursor position

Section three: Changing class commands

Ce key: Change text until the end of a word (CW key is similar)

Third, section Fourth: using C to change more

Change class operator Operation format: c [number] Motion

such as: CW; change the word; C $ change the entire line after the cursor

Chapter IV: Positioning and Document status
    1. Ctrl+g: Displays a status line that displays the currently edited file name and the cursor position (line number)
    2. G key: Causes the current cursor to jump directly to the last line of the file.

GG key: Causes the current cursor to jump directly to the first line of the file.

    1. Enter the previous line number +g, back to the forward
Section four: Search class commands

/+ string: Finds the string in the current file

    1. N: Finds the same string, which can be found in the same direction;
    2. N: Find the same string in the opposite direction
    3. Replace/: Reverse Find string
    4. Ctrl+o: Back to the previous position;

Ctrl+i: Jump to a newer location

After the search reaches the end of the file, it automatically resumes the search from the file header

Section IV: Finding pairs of parentheses

%: Find pairs of parentheses),],}

(The cursor should be in the parentheses where you want to find it)

Section Fourth: Replacement commands

Replace the first string in a line with old as the new string, type: s/old/new

Replace all strings in a row with old as new string, type: s/old/new/g

Replace the first string in two lines with the new string old, enter: #, #s/old/new/g (#, #代表的是替换操作的若干行中收尾的行号)

Replace the first string in the file with the old string new, enter:%s/old/new/g

Full-text substitution is to ask the user to confirm that each replacement needs to add a C flag:%S/OLD/NEW/GS

Section V: Methods for executing external commands within VIM

: command: Cursor moves to the bottom of the screen to enter commands

then enter! Command: Allow external shell commands to be executed

Such as::! ls;:! Dir

Section II: More information on saving files

: W Test: Save entire file as file name as test

:!del Test: Delete the test file under MS-DOS

:!rm Test: Delete the test file under Unix

Section Five: a Selective Save command

Save part of the file in Visual mode: v motion:w FILENAME

    1. Move cursor
    2. Press the V key, move the cursor, highlight the text
    3. Press: Key, the bottom of the screen appears: ' <, ' >
    4. Enter W Test (test is a file name that is not used), enter
    5. Use:! Dir or:! LS View the stored file
Section Fourth: Extracting and merging files

To insert the contents of another file into the current file, enter: R finename

Example: R test Extracts the file named Test that you created earlier, and puts it behind the cursor

: R!dir can read the output of the dir command and place it behind the cursor position of the current file

Section Sixth: Opening class commands

O: Open a new line above the cursor and enter insert mode

O: Open a new line below the cursor and enter insert mode

The Sixth section Second: additional class commands

A: Insert text after cursor position

A: Inserting text after the end of the line where the cursor is located

E: You can move the cursor to the end of the word

Section Sixth: Another version of the permutation class command

Capital R goes into replacement mode and can replace multiple characters consecutively until it returns to normal mode

Sixth section IV: Copy and paste text

Use V to enter visual mode, then use operator y to copy the text and paste with P.

Sixth v.: Setting class command options

Input: Set XXX can set XXX options:

' IC ' ignorecase ' ignores letter case when searching

' Is ' ' incsearch ' shows partial assignment when finding a phrase

' HLs ' hlsearch ' highlights all the matching phrases

Option name can be either full version or abbreviated version

Disable Ignore case:: Set Noic

Remove the highlight of the match:: Nohlsearch

Ignore letter case only on one lookup:\c:/ignore\c< carriage return >

Section Seventh: Getting Help information

To start the Help system:

1.

2.<f1> Key

3.help< Carriage Return > Example: Enter help cmd to find the cmd command.

Input ctrl-w can jump between windows

Enter:q< return > to close the Help window

Section Seventh: Creating a startup script
    1. Start editing vimic file:: Edit ~/.vimic (Unix System)
    2. Read the contents of the Vimic sample file:: R $VIMRUNTIME/vimic_example.vim
    3. Save File:: Write

(Get syntax highlighting)

The seventh section of the third Lecture: complete function

command line completion with ctrl-d and <TAB>

Add:

1. Make sure VIM is not running in compatibility mode:: Set NOCP

2. Add a space, and a starting part of an existing file name, and press the <tab> key to complete the file name

Part IIGcc

GNU CC (referred to as GCC) is the GNU project in accordance with the ANSI C standard of the compilation system

    • Preprocessing: Gcc–e hello.c–o hello.i;gcc–e Call CPP
    • Compilation: Gcc–s hello.i–o hello.s;gcc–s Call CCL
    • Compilation: Gcc–c hello.s–o hello.o;gcc-c Call as
    • Link: gcc hello.o–o hello; gcc-o call ld

In the first three steps, the GCC parameter is "ESc", and the corresponding input file suffix is "ISO"

the GCC section, along with the textbook Learning section, is written on another blog.Part IIIGdb

The basic commands are:

    • GdB Programm (Start gdb)
    • B Set Breakpoints (4 breakpoints are set: Line breakpoint, function breakpoint, conditional breakpoint, temporary breakpoint)
    • Run starts running the program
    • BT Print function Call stack
    • P View variable values
    • C continue running from the current breakpoint to the next breakpoint
    • N Single Step operation
    • S Single Step operation
    • Quit Quit GDB
    • A few other debug commands that I think should be mastered are:
      • Change of display tracking variable value
      • Until jump out of the loop
      • Finish Jump function
      • Help

Problems encountered

1. Static library? What is a static library?

2. Where are the development tools and resources located?

How to solve the

Find related Blogs, write more detailed

Build and use static libraries and dynamic libraries in Linux under GCC

Http://blog.chinaunix.net/uid-23592843-id-223539.html

Other

Blog is really too long, divided into two parts written, this part is in the experimental building experimental content.

Information Security system design basics second week study summary (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.