The first week experiment report of information security system design

Source: Internet
Author: User
Tags posix touch command

I. Learning Objectives

1. Ability to install Linux operating system independently

2. Basic commands to be proficient in using Linux systems

3. Proficient in using Linux User management commands/system-related commands/file directory related commands/packaging compression related commands/Compare merge related commands/network-related commands, etc.

Second, how to learn Linux

Third, the Linux terminal

1.Terminal (terminal)

Usually when we use Linux, we do not deal directly with the system, but through a middle program called Shell, in order to achieve in the graphical interface let us in a window to accept user input and display output, Linux The system also provides a program called Terminal Emulator (Terminal), the following several more common terminal simulators, such as Gnome-terminal,kconsole,xterm,rxvt,kvt,nxterm and Eterm, At present, the terminal program in our experiment is the xfce-terminal that comes with XFCE desktop environment. It is important to note, however, that there is a difference between the terminal (Terminal) and the console (consoles).

2.Shell

Usually in the graphical interface to the actual experience is not the difference between the different versions of the terminal emulator, and most of the shell (shell), the shell has a core, here is the kernel refers to the unix/linux core

3. Command-line Operation experience

Shortcut keys: (1) Use the TAB key to complete the command, when you forget the full name of a command can only enter the beginning of its part and then press the TAB key can be prompted or help finish

(2) [Ctrl + C] When you inadvertently entered an unknown command on the Linux command line, or the wrong use of a command, resulting in unexpected situation in the terminal, using CTRL + C key to forcibly terminate the current program

Keys

Role

Ctrl+d

Keyboard input end or exit terminal

Ctrl+s

Tentative current program, pause and press any key to resume operation

Ctrl+z

Put the current program in the background to run, revert to the foreground commandfg

Ctrl+a

Move the cursor to the input wardrobe equivalent to the Home key

Ctrl+e

Moves the cursor to the end of the input line, equivalent to the End key

Ctrl+k

Remove from cursor position to end of line

Alt+Backspace

Delete a word forward

Shift+PgUp

Scroll the terminal display up

Shift+PgDn

Scroll down the terminal display

4. Basic operation and structure of Inux file

Use the touch command to create a blank file, about the Touch command, which is mainly to change the time stamp of the existing file (for example, the last access time, last modified time), but it does not add any parameters, only specify a file name, You can create a blank file for the specified file name (without overwriting a file that already has the same name), or you can specify the timestamp of the file at the same time, and more about the usage of the Touch command, which will be covered in the next file search. Use the CP (copy) command to copy a file or directory to the specified directory. Copy the previously created "test" file to the "/home/shiyanlou/father/son/grandson" directory: Use the RM (remove files or directories) command to delete a file or directory: Use MV ( Moveor rename files) command, move file (cut). Move the file "File1" to the "documents" directory MV source directory file destination directory

Standard input and output: when we execute a shell command line normally will automatically open three standard files, namely standard input file (stdin), default corresponding to the terminal's keyboard, standard output file (STDOUT) and standard error output file (stderr), All two files correspond to the screen being redirected to the terminal so that we can see the output directly. The process will get input data from the standard input file, output normal output data to the standard output file, and send the error message to the standard error file.

For example, we want to see the passwd files that were copied from the "/etc" directory.

The types of files under Linux are not judged by the file suffix, we usually use the file command to see the type of the files

5. Environment variables and search files

To explain the environment variables, you have to understand what the variables are, and exactly what they should be, the so-called variables are symbols that are used in a computer to record a value (not necessarily a numeric or a character or a string), and these symbols will be used in different arithmetic processing. Usually a variable is a one-to-many relationship with a value, you can assign a value to another variable by reading its value, or you can assign a value to any variable directly. For ease of operation and processing, most programming languages distinguish between the types of variables used to record data types, such as numeric values, characters, or strings. The variables in the Shell are basically the same, there are different types (but not specifically specifying the type name), you can participate in the operation, scoped. The scope of a variable is the valid range of a variable (such as a function, a source file, or a global scope), where there can be only one variable with the same name. Once left, the variable is invalid, as if the variable does not exist in general. In all Unix and Unix-like systems, each process has its own set of environment variables, and by default, when a process is created, it is explicitly specified in the process creation, and it inherits most of the environment settings of its parent process. The shell program also runs on the operating system as a process, and most of the commands we run in the shell will run as a child process of the shell.

6. File Packaging and decompression

Before you talk about the Unzip tool on Linux, it is important to understand the following commonly used compressed package file formats. On Windows, our most common is the three kinds of *.zip,*.rar,*.7z suffix of the compressed files, and in Linux above the common commonly used in addition to the above three kinds, there are *.gz,*.xz,*.bz2,*.tar,*.tar.gz,*.tar.xz, *TAR.BZ2, briefly described below:

File suffix name

Description

*.zip

Zip program to package compressed files

*.rar

RAR Program Compressed files

*.7z

7zip Program Compressed Files

*.tar

Tar program packaging, uncompressed files

*.gz

Gzip (GNU Zip) compressed files

*.xz

XZ Program Compressed Files

*.bz2

BZIP2 Program Compressed Files

*.tar.gz

Tar packaging, gzip program compressed files

*.tar.xz

Tar packaging, XZ program compressed files

*tar.bz2

Tar package, BZIP2 program compressed files

*.tar.7z

Tar pack, 7z program compressed files

We should also pay attention to the compatibility problem when using unzip to extract files, but here we are not concerned about the above problem, but the problem of Chinese encoding, usually the Windows system created on the compressed file, if there is a document containing Chinese or Chinese as the file name of the GBK by default or other encoding, and Linux above the default is UTF-8 encoding, if not add any processing, the direct decompression can appear in Chinese garbled problem (sometimes it will automatically help you handle), in order to solve this problem, we can specify the encoding type when extracting. Keep file attributes and follow links (symbolic links or soft links), sometimes we use tar to back up files when you restore to other hosts you want to keep the properties of the file (-p parameter) and the source file that the backup link points to instead of the link itself.

7. File system operations and Disk Management

Create a virtual disk

Introduction to the DD command (partly explained from the DD (Unix) wiki))

ddcommand is used to convert and copy files, but its replication differs from cp . Before mentioning a very important point about Linux, everything is files , on Linux, hardware device drivers (such as hard disk) and special device files (such as /dev/zero and /dev/random ) are like ordinary files, as long as the respective drivers to achieve the corresponding function, DD You can also read from and/or write to these files. This dd can also be used in tasks such as backing up the boot sector of the hardware, obtaining a certain amount of random data, or empty data. ddprograms can also process data during replication, such as converting a byte order, or swapping between ASCII and EBCDIC encodings.

ddCommand-line statement differs from other Linux programs because it has a command-line option format 选项=值 , rather than a more standard --选项 值 or -选项=值 . The dd default is read from the standard input and written to the standard output, but can be changed with the options (input file if , input files) and of (output file).

Mount a disk to a directory tree using the Mount command

Before a user opens a file on a Linux/unix machine, the file system that contains the file must first mount the action, at which point the user executes the mount instruction to mount the file system. It is usually used on USB or other removable storage devices, while the root directory needs to remain mounted at all times. And because the Linux/unix file system can correspond to a file and not necessarily a hardware device, you can mount a file containing the file system to the directory tree.

The mount instruction of the Linux/unix command line tells the operating system that the corresponding file system is ready to be used, and that the file system corresponds to a specific point (called a mount point). Mounted files, directories, devices, and special files can be used by users.

8. Control of command execution order

What a pipeline is, a pipeline is a communication mechanism that is typically used for inter-process communication (or network communication via a socket), which is represented by the output (stdout) of each of the preceding processes as input to the next process directly (stdin).

Pipelines are also classified as anonymous and named pipes (this will not discuss the use of system calls to create and use pipelines in the source program, which is actually the same mechanism as the command line's pipeline in the kernel). When we use some filter programs, we often use anonymous pipes, which are represented in the command line by the | delimiter, which we have used many times in the previous content. A named pipe is simply a named pipe, usually a named pipe in the source program. Below we will use some common "filter programs" that can be used to help you get used to the plumbing. Often, we can only enter a command at the terminal at a time, press ENTER to execute, after the completion of the execution, we then enter the second command, and then press ENTER to execute ... You may encounter the following usage scenarios: I need to install a software using Apt-get, and then run the installed software (or command tool) immediately after installation, and it happens that your host has not replaced the software source has not updated the software list

9. Common Text Processing commands

Command not all you will often use, but they are very practical, skilled, can alleviate a lot of work, such as the use of mouse operations in the gedit copy paste assignment paste, the contents of two files into a file, which originally only need a command to complete.

10. Data Flow Redirection

Before we learn more about Linux redirection, we need to know some basic things, before we have mentioned that Linux default provides three special devices for terminal display and output, respectively stdin (standard input, corresponding to your input at the terminal), stdout (standard output, Corresponds to the output of the terminal), stderr (standard error output, corresponding to the output of the terminal).

File descriptor

Device files

Description

0

/dev/stdin

Standard input

1

/dev/stdout

Standard output

2

/dev/stderr

Standard error

File Descriptor: The file descriptor is formally a non-negative integer. In fact, it is an index value that points to the record table in which the kernel opens a file for each process maintained by the process. When a program opens an existing file or creates a new file, the kernel returns a file descriptor to the process. In programming, some of the underlying programming often revolves around file descriptors. However, the concept of file descriptors is often applied only to operating systems such as UNIX and Linux.

There is also a symbol--it can be used as a previous command at the same time.

11. Regular expression, grep pattern matching command, sed flow editor, awk Text Processing language

Regular Expressions , also known as formal representations, formal representations, regular expressions, regular expressions, conventional representations (English: Regular expression, often abbreviated in code as regex, RegExp, or RE), is a concept of computer science. A regular expression uses a single string to describe and match a series of strings that conform to a certain syntactic rule. In many text editors, regular expressions are often used to retrieve and replace text that conforms to a pattern.

The rep command is used to print the matching pattern string in the output text, which uses regular expressions as criteria for pattern matching. grep supports three regular expression engines, specified by three parameters, respectively:

Parameters

Description

-E

POSIX extended regular expression, ERE

-G

POSIX basic regular expression, BRE

-P

Perl Regular Expressions, PCRE

But in most cases where you have not learned the Perl language, you will only be using ERE and BRE, so we will not discuss some of the regular expression syntax specific to Pcre (where most of the content is overlapping, so you don't have to worry about missing out on how much important stuff)

Before using a regular expression with the grep command, first describe its common parameters:

  

parameter

  
  

description

  

-B

To match a binary file as text

-C

Number of statistics in pattern matching

-I.

Ignore case

-N

Displays the line number of the line containing the matched text

-V

Reverse selection, output unmatched row contents

-R

Recursive matching Lookup

-A N

n is a positive integer that indicates the meaning of after, and the following n rows are listed in addition to the matching rows

-B N

n is a positive integer that represents the meaning of the Before and lists the preceding n rows in addition to the matching rows.

--color=auto

Set the match in the output to automatic color display

Note: The color of grep is set by default in most distributions, and you can specify or modify the GREP_COLOR environment variable by parameter.

The full name of the SED tool in the Man Handbook is "Sed-stream editor for Filtering and transforming text", meaning that the stream editor is used to filter and convert text.

In the Linux/unix world, the tools that dare to be called editors, mostly non-daogaoyizhang, such as the "Vi/vim (Editor of God)", "Emacs (God's editor)", "Gedit", are the editors. The biggest difference between sed and above is that it is a non-interactive editor, so let's start by introducing the SED editor.

Awk is an excellent text processing tool, one of the most powerful data processing engines available in Linux and UNIX environments. Its name comes from its founder Alfred Aho (Alfred Aihou), Peter Jay Weinberger (Peter Wimberg) and Brian The first letter of the Wilson Kernighan (Blaine Collingham) surname. In the AWK programming language, the three-bit creator has formally defined it as "style scanning and processing language." It allows you to create short programs that read input files, sort data, manipulate data, perform calculations on input, and generate reports, as well as countless other features. In the simplest sense, awk is a programming language tool for working with text.

On most Linux distributions, we're actually using the GNU version of Gawk (GNU Awk,awk), in our environment Ubuntu, which is provided by default is Mawk, but we can usually use the awk command directly (the awk language interpreter), Because the system has created a symbolic link that awk points to Mawk.

Software Installation under 12.Linux

The first week experiment report of information security system design

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.