20165330 preparatory work 3 Linux installation and learning

Source: Internet
Author: User
Tags bz2 chmod extract zip file rar

Virtual machine Installation
    • In the installation of VirtualBox when my computer has not opened the official website, fortunately, there can be opened later, so I successfully downloaded the good VirtualBox. The following error occurred while running:
    • Error 1: The following prompt appears when you click Create virtual machine
    • Workaround (applicable to my Computer):

      (1) for the VirtualBox icon right-click Properties----compatibility;

      (2) Change the VirtualBox compatibility mode to Win7, such as:

      (3) Click OK to run on it

    • Error 2: Create a virtual computer and click on the virtual computer to appear.
    • Workaround:

      I found a lot of Baidu, feel more reliable is these two: "Can not open a new task for virtual computer" solution and VirtualBox can not open a new task for virtual machine cause and resolution, I tried the second link method but failed to cause the computer black screen. I found an uncle to help me repair, in the repair process feel the same method as in the second method, may be my improper operation, finally my Computer good virtual machine also did not have the above problem.

    • Error 3: Occurs when the command is finished installing enhancements
    • Workaround:

      I search on Baidu How to use the VirtualBox software enhancement installation, found how to use the Ubuntu virtual machine VirtualBox software enhancements installed, on this basis I followed the teacher's steps to open the Terminal input command download success.

Linux Learning

Section I.

    • Linux: is an operating system, mainly system calls and two layers of the kernel.
    • The role of the operating system in the entire computer system
    • Learning Path:

Section II

    • Terminal: This is done through a middle program called the Shell, in the graphical interface, in order for us to complete the user input and display output in a single window.
    • Common terminal simulators: Gnome-terminal,konsole,xterm,rxvt,kvt,nxterm and Eterm.
    • Shortcut keys:
Key effect
ctrl+d Keyboard input end or exit terminal
ctrl+s pause for future After pausing, press any key to resume running
Ctrl + Z put the current program in the background to run, revert to the foreground command FG
Ctrl + A moves the cursor to the input outfit, which is equivalent to the home key
ctrl+e moves the cursor to the end of the input line, equivalent to the end key
ctrl+k Delete from cursor position to end of line
alt+backspace Delete one word forward
shift+pgup Scroll terminal display up
shift+pgdn Scroll the terminal display down
Ctrl + C break or end command
Tab for command completion, complete directory, fill command parameters, etc.
ctrl+alt+f1~f6 Switch User login
ctrl+alt+f7 switch back to graphical interface
shift+n previous keyword
    • Wildcard: A special statement that has an asterisk (*) and a question mark (?) to make a fuzzy match to a string (such as a file name, parameter name).
character meaning
* Match 0 or more characters
Match any one character
[List] Match any single character in the list
.... ...
    • Man command: A common form of online software documentation in NIX or UNIX-like operating systems
    • Homework:

      Section III
    • View User: Open Endpoint enter the following command
    • Create User: Use the sudo command to create

      $ sudo adduser user name

Create a good command to switch to the newly created user

Note: The password entry for Linux does not show any content

    • User group View Method:
      • Group Command
      • View/etc/Group file
      • Add other users to the sudo user group

        By default, the newly created user is not rooted, or the sudo user group can be added to the sudo user group to gain root privileges.

    • To delete a user:
    • Linux file permissions
      • To view file permissions commands and procedures:

        $ ls-1

      • Change file owner:
        If the previous command to delete the Lilei user has been performed, recreate it here.
        Assuming that the Lilei user is currently logged in, create a new file named "Iphone6":

        $ Touch IPhone6

The visible file owner is Lilei:

Now, to change back to the Shiyanlou user identity, change the file owner to Shiyanlou using the following command:

Now check to see that the file owner was successfully modified to Shiyanlou:

    • Modify file Permissions:

Mode 1:2 binary numbers indicate:
$ echo "echo" Hello Shiyanlou "" > Iphone6
$ chmod iphone6

Mode two: Add and subtract assignment operations:
$ chmod GO-RW iphone6

Fourth quarter

    • Linux directory structure
    • FHS Standard:

      FHS defines the directory as four interactive forms, as shown in the following table, depending on whether the file system is frequently used or not, and if the user is allowed to make arbitrary changes:
    • Directory route by:
Command function
$ CD. Current directory
$ CD. Go to the top level directory
$ cd ~ Go to Home directory
$ pwd Get current path
$ cd/usr/local/bin Absolute path
$ CD. /.. /usr/local/bin Relative path
    • Basic operations for Linux files
Command function
$ Touch User Name Create a blank file
$ mkdir Mydir Create an empty directory
$ mkdir-p Father/son/grandson Create a Multilevel Catalog
$ CP Test Father/son/grandson Copy a file to the specified directory
$ cp-r Father Family Recursively replicating directories
$ RM Test Delete a file
$ rm-f Test Force Delete Files
$ rm-r Family Delete a directory
$ mkdir documents + $ MV file1 documents Move the file "File1" to the "Documents" directory
$ mv File1 myfile Rename the file "File1" to "myfile"
$ cat passwd View "passwd" file
$ cat-n passwd can display the file line number
$ more passwd Open the "passwd" file
$ tail/etc/passwd View "passwd" file
$ tail-n 1/ETC/PASSWD Just see the first few lines.
$ file/bin/ls View File types

Fifth Quarter

    • Environment variables
      • Variable: The shell variable, the so-called variable that is used in the computer to record a value (not necessarily a number, or a character or a string), and these symbols will be used in different operations processing.

        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.

Command function
$ DECLARE variable name Create a variable
$ Tmp=shiyanlou Assign a value to the TMP variable
$ echo $tmp Read the value of a variable

Note: Not all types of variable names are available, the variable name can only be English letters, numbers, or underscores, and cannot begin with a number.

    • Environment variables:
      • Classification:
        1. The current shell process private user-defined variables, such as the TMP variable we created above, are only valid in the current shell.
        2. The built-in variables of the Shell itself.
        3. An environment variable exported from a custom variable.
      • Linux variables:
        1. Permanent: Need to modify the configuration file, the variable is permanently effective;
        2. Temporary: Using the Export command-line declaration, the variable is invalidated when the shell is closed.
    • The lookup path and order of the command:
Command function
$ echo $PATH View the contents of the PATH environment variable
$ gedit hello_shell.sh Create a shell script file
$ chmod 755 hello_shell.sh Add executable permissions to a file
$./hello_shell.sh Execute script
    • To add a custom path to the "path" environment variable:

      $ path= $PATH:/home/shiyanlou/mybin

    • To modify and delete an existing variable:
      • Modify:

        $ path= $PATH
        $ echo $path
        $ path=${path%/home/shiyanlou/mybin}# or use wildcards to represent any number of any character
        $ path=${path%
        /mybin}

      • Delete:

        $ unset Temp

    • About Searching for files
      Search-related commands are commonly used with whereis,which,find and locate.

$whereis who

$ locate/etc/sh

$ locate/usr/share/*.jpg

$ which man

$ sudo find/etc/-name interfaces

    • Homework:

      Sixth quarter
    • Zip file suffix
*.zip
> file suffix description
Zip program Packaging compressed Files
*.rar RAR program compressed file
*.7z 7zip Program compressed Files
*.tar tar program packaged, uncompressed file
*.gz gzip Program (GNU Zip) compressed Files
*.xz XZ Program compressed file
*.bz2 bzip2 Program compressed Files
*.tar.gz tar packaging, gzip compressed files
*.tar.xz tar package, XZ program compressed file
*.tar.bz2 tar package, bzip2 program compressed file
*.tar.7z tar package, 7z program compressed file
    • Zip Compression Packager
    • Package folder
    • [] set compression level and view level
      • Create an encrypted package

        p>$ zip-r-e-o Shiyanlou_encryption.zip/home/shiyanlou

    • extract zip file
      • Extract Shiyanlou.zip to the current directory

        $ unzip shiyanlou.zip

      • Use Quiet mode to extract files to the specified directory

        $ unzip-q shiyanlou.zip-d ziptest

      • Viewing the contents of a compressed package

        $ unzip-l shiyanlou.zip

    • rar Packaging compression command
    1. Installing RAR and Unrar tools

      $ sudo apt-get update
      $ sudo apt-get install rar unrar

    2. Create a compressed package or add a file to a compressed package from a specified file or directory

      $ RM *.rar
      $ rar a shiyanlou.rar.

    3. To delete a file from the specified compressed package file

      $ rar d Shiyanlou.rar. ZSHRC

    4. View unresolved files

      $ rar L Shiyanlou.rar

    5. Extracting RAR files using Unrar

      $ unrar x Shiyanlou.rar

    • Tar Tools
    1. Create a tar Package

      $ TAR-CF Shiyanlou.tar ~

    2. Package a file (-x parameter) to the existing directory of the specified path (-c parameter)

      $ du-h Shiyanlou.tar

    3. Unpack

      $ TAR-ZXVF Something.tar

    • Homework:


      Seventh Quarter
    • To view disk and directory capacity

      $ df
      Common parameters:
      $ du-h #同--human-readable to improve the readability of the information in K,m,g.
      $ du-a #同--all Displays the size of all files in the directory.
      $ du-s #同--summarize only displays totals, listing only the last added value.

    • Disk Management
    1. To create a virtual image file using the DD command

      $ dd If=/dev/zero of=virtual.img bs=1m count=256
      $ du-h virtual.img

    2. Format the disk with the MKFS command (we are here to create the virtual disk image ourselves)

      $ sudo mkfs.ext4 virtual.img

    3. Mount a disk to a directory tree using the Mount command

      $ sudo mount

    4. Uninstalling mounted disks using the Umount command

      Command format sudo umount mounted device name or mount point, such as:
      $ sudo umount/mnt

PS: Because of problems with our environment (the Linux kernel used in the environment did not add support for Loop device at compile time), you will not be able to mount a successful

    1. Partitioning a disk using Fdisk

      $ sudo fdisk-l

    2. Enter disk partition mode

      $ sudo fdisk virtual.img

Eighth Quarter

    • Built-in commands

      The built-in commands are actually part of the shell program, which contains some of the simpler Linux system commands that are written in the bash source Builtins and are identified by the shell program and run inside the shell program, usually in Linux When the system loads the runtime, the shell is loaded and resides in system memory. and parsing the internal command shell does not need to create a child process, so it executes faster than an external command. For example: History, CD, Exit and so on.

    • External command

      External commands are part of the utilities in a Linux system, because the utility is usually powerful, so it contains a large number of programs that are not loaded into memory with the system when the system is loaded, but instead call memory when needed. Although it is not included in the shell, its command execution process is controlled by the shell. External commands are installed outside of bash, usually on/bin,/usr/bin,/sbin,/usr/sbin, and so on. For example: LS, vi and so on.

    • Type command to differentiate whether the command is built-in or external

      $ type command name
      XXX is a shell builtin//If the result is so then this is built-in command
      XXX is/usr/sbin/xxx//If the result is this, then this is a built-in command.

    • Help commands
    1. Help command: ZSH has built-in and does not have the Enable command, we can go into bash and have the command built into bash

      $ bash
      Help LS//for built-in commands
      LS--help//For out-of-build commands

    2. Man command: No distinction between built-in and external commands

      Mans LS

    3. Info command: Bash comes with commands

      Info ls

20165330 preparatory work 3 Linux installation and learning

Related Article

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.