20165223 Linux Installation and command Getting Started

Source: Internet
Author: User
Tags bz2 parent directory rar oracle vm virtualbox vm virtualbox

Pre-job 3:linux installation and command entry one, VirtualBox and Ubuntu installation

By learning to practice the installation of Ubuntu graphics tutorials based on VirtualBox virtual machines, I began to learn the installation of virtual machines, as per the tutorial step-by-step try to install.

Installing VirtualBox

I first clicked into the VirtualBox official website, but only saw the 5.2.6 and 5.1.322 versions, so first try to put 5.2.6 down, want to try to see if it can be installed properly. However, things were not as satisfactory, and there were some minor obstacles in the installation process.

    • Download speed is very slow when the website is installed

    • In the official website by the tutorial download 5.2. Version 6 is downloaded in the official website according to the tutorial 5.2. The 6 version was inexplicably changed to 5.2.7 and an unknown error occurred during installation.

Because I really do not know what is the problem, so I found on the Internet 5.2. The 6 version of the installation package was re-downloaded and installed once, this time after a little problem has been successfully installed VirtualBox.

    • After installing the Oracle VM VirtualBox on a Windows 7 64-bit system, you are ready to mount the system in the virtual machine, discovering that only the 32-bit option in the Virtual machine system option does not have a 64-bit option, by querying because the CPU is not turned on virtualization.

      The solution is also not difficult, after reviewing the data learned that simply restart the WIN10 computer, enter the BIOS to set up CPU virtualization, the menu under the configuration of the Intel virtual technology State from [Disable] switch to [Enable To

Install Ubuntu

After asking a few students, I learned that the official website of the Ubuntu download is not stable and slow, open and error hints, so in the help of students to find another stable and convenient way, and finally successfully installed Ubuntu.

    • Download Install package address: Download Ubuntu
Ii. Learning Linux Basic commands (1) Learn the ingenious Linux command learning method

Through reading and learning about the ingenious Linux Command Learning blog, I have learned some knowledge about Linux and how to use various commands.

    • Linux operating system

Linux is an operating system that differs from windows, and understands that Linux operating systems include system calls and kernel Layer two in computer systems, as shown in.

    • Ubuntu Important shortcut keys
Shortcuts function
Ctrl+alt+t Open Terminal
Ctrl+shift+t New tab page
Alt+n Switch to nth tab in terminal
Tab Command completion in terminal
↑ and ↓ Toggle Command History
CTRL + C Interrupt program Run
    • Linux commands
command [options] [arguments] //即command [选项] [参数]
    • Man command

manis an abbreviation for manual, usually using man man commands to view Help, where important options are man -k used to search for keywords, find commands, equivalence commands for a, propos and man -f cmd can be used after a command is found to view the command basic function, equivalent command for whatis .

    • Cheat command

Use the address given by the teacher to download the prompt I can't open ... May be the installation package is damaged, so there is no self-installation for in-depth discussion, just in the experimental building trial.

The Cheat command is an interactive cheat sheet application that is distributed to Linux command line users under the GNU General Public License. It provides a display of Linux command use cases, including all of the options and short but understandable features of the command.

--quoting from the Ingenious Linux Command Learning Act

    • Other core commands

find: Find the location of the file in the system

locate: Quick version of Find

grep: Full-text retrieval of files

whereisand which : see where the command tools are used

Summary: After careful reading of the basic blog, I feel the long way to learn Linux, but also to stimulate my curiosity, there are so mysterious complex and beautiful language waiting for me to learn to dig, I should work harder to learn this language.

(2) Autonomous Learning in experimental building

Laboratory Building address: Experimental building

Introduction to the Experiment 1 Linux system

    • experimental content : Linux main components, history profile, main characters, Linux and Windows differences, Linux learning methods
    • Experimental Results : Learn more about the Linux operating system, understand the following features of the Linux platform:
      • Mostly free
      • For open source free software, users can modify customization and redistribution, some software quality and experience lack
      • More secure than Windows systems
      • Operation requires only one keyboard can be done, once mastered will save a lot of time

Experiment 2 basic concepts and operation

  • Linux Desktop Environment : can be freely customized, most of the users are using kde,gnome,xfce,lxde and so on. The lab building is currently using the XFCE desktop environment.
  • Terminal concept : essentially corresponds to the/dev/tty device on Linux, the default provides 6 pure command line interface of the terminal "terminal" to let users login. , on the physical machine can be used [Ctrl]+[Alt]+[F1]~[F6] to switch, using the [Ctrl]+[Alt]+[F7] switch back to the graphical interface.
  • Shell: The command parser , which refers to the "user interface" software, which is the intermediate program for users to communicate with the system and the scripting language of the control system.

    A shell in the ordinary sense is a program that can accept user input commands. It is called a Shell because it hides the underlying details of the operating system. The graphical user interface under the same Unix/linux GNOME and KDE are sometimes referred to as "virtual shells" or "graphic shells."

  • Basic commands

    touch: Create File

    cd: Enter a directory

    pwd: View the current directory

  • Shortcut keys
    Tab: Complete command, directory, command parameters

    Ctrl+c: Forcibly terminates the current error program

    Ctrl+d: keyboard input end or output terminal

    Ctrl+s: Pause the current program and press any key to resume operation

    Ctrl+z: Keep the current program running in the background

    fg: Background Run program recovery foreground

    Ctrl+a: The cursor moves to the input wardrobe, equivalent to the Home key

    Ctrl+e: The cursor moves to the end of the input line, equivalent to the End key

    Ctrl+k: Delete from the cursor position to the end of the line

    Alt+Backspace: Delete a Word forward

    Shift+PgUp: Scrolls the terminal display up

    Shift+PgDn: Scrolls the terminal display down

    : History, resuming a previous level of command

  • Common wildcard characters

    *: Match 0 or more characters

    ?: matches any one character

    [list]: matches any single character in the list

    [!list]: Matches characters other than any single character in the list

    [c1-c2]: Match any single word in c1-c2 such as: [0-9] [A-z]

    {string1,string2,...}: Match string1 or string2 (or more) one string

    {c1..c2}: Match all characters in c1-c2 such as {1..10}

  • Homework
    • Output graphic text using the banner command

    • Output graphic text using the Printerbanner command (where - w print width is specified)

    • Output graphic text using the toilet command

      installation command:

      sudo apt-get update

      sudo apt-get intsall toilet

    • Output graphic text using the Figlet command

      installation command:

      sudo apt-get update

      sudo apt-get intsall figlet

Experiment 3 User and file Rights management

  • View user

    who command common parameters

    parameters
    -a print all that can be printed
    -d print dead process
    -m with AM I,mom likes
    -q print current number of logged on users and user name
    -u Print current logged on user login information
    -r print run level
  • Create user

    su <用户名>: Switch user, require user password

    su -l <用户名>: Switch user, environment variable will change

    sudo adduser <用户名>: Add a new user

  • View user groups

    • Method 1: Using groups commands

    • Method 2: View /etc/group files directly

    • Users need to join the sudo group in both ways to gain root privileges

  • Delete User

    sudo deluser <用户名> --remove-home

  • View File Permissions

    • File type: Linux everything is file.

    • File permissions: A directory with Read and Execute permissions to open and view internal files, and a directory with write permission to allow other files to be created in it.

    • Common usage of LS command

Parameters Description
Ls Lists and displays the files in the current directory
-A Show except. (current directory) and: (Top level directory), including hidden files (under Linux). The file that starts with is a hidden file)
-al View the full properties of a directory
-dl< Directory name > Show all file sizes
-assh Where small s for the display file size, large s to sort by file size, other ways to sort available man command query
    • Change file Owner

      sudo chown <新所有者> <文件名>

    • Modify file Permissions

      • Method 1: Binary digit representation

rwx(i.e. a "7"): Three groups of permissions per file are fixed to owner, user group, other user

      • Method 2: Add and subtract assignment operations

chmod go-rw <用户名>, where G, O and U represent group, others, and user,+, respectively, to increase and remove the corresponding permissions

    • The difference between AddUser and Useradd

      • Useradd create user only, created with passwd < username > Set new user's password

      • AddUser can create a user, create a directory, create a password (prompting you to set) this series of actions

      • Useradd, Userdel This kind of operation is more like a kind of command, the execution is finished to return. And adduser more like a program, users need to do their own input, determine a series of operations.

    • Homework

      Use the following instructions to add a user loutest, use sudo to create the file/opt/forloutest, set to user loutest can read and write.

      sudo adduser loutest

      sudo usermod -G sudo loutest

      sudo touch /opt/forloutest

      chmod 600 /opt/forloutest

      ll /opt/forloutest

Experiment 4 Linux directory structure and file basic operation

    • experimental content : Linux file organization directory structure. Relative paths and absolute paths. Move, copy, rename, edit, and so on to the file.
    • Directory structure
      • FHS Standard

    • Four forms of interaction of the catalogue

  • Directory path
    • Path
      cd: Switch Directories
      -: Last Directory
      : Current user's home directory
      pwd: Gets the absolute path
    • Absolute path
      cd /usr/local/bin
    • Relative path
      cd ../../usr/local/bin
  • new file : touch Create a new blank file, if creating a blank file named Test, because you do not have permissions in other directories, you need to cd ~ switch back to the user's /home/用户名 directory first

  • Create a new directory: Create mkdir A new directory, use the parameters, and, -p if the parent directory does not exist at the same time, use mkdir -p father/son/grandson a multi-level directory (which is useful when installing the software and configuring the installation path)

  • To copy a file :cp test<文件名> father/son/grandson<路径>

  • Copy directory : To cp -r father family successfully replicate the directory, you need to add the-R or-R parameters to indicate recursive replication

  • Delete file : Use rm text Delete file, force delete parameter withrm -f text

  • Delete directory : rm -r family orrm -R family

  • Move file : mv 源目录文件 目的目录 , use the mv command to move the file (cut)

  • Rename file : mv 旧的文件名 新的文件名 , rename Batch Rename

  • To view files :

Command effect
Cat Positive sequence display print file contents to standard output (terminal), plus -n parameter display line number
Tac Reverse print file contents to standard output (terminal)
nl Add line numbers and print cat -n a more professional line number than the Print command
More and less Paging through files for reading files
Head and tail View only the first few lines of a file (default is 10 lines, show all in less than 10 lines), and tail lines
View File types Using the File command
    • Homework

Create a homework directory, build a file named 1.txt~10.txt, and delete the 1.txt~5.txt

Experiment 5 environment variables and file lookup

    • Experimental content: Experiment 5 contains a lot of content, let me benefit, the last "experimental Rain" also makes me very surprised and interested. The experimental content mainly includes the function and usage of environment variables, and several methods of searching files.
    • Job: Find all files in the/etc/directory that end with. List

Challenge 1: Finding files

Learning here, I met the first small challenge, opened up really is a summary of the first 5 experiments, I divided into the following three steps to complete the challenge.
Introduced

    • Title: There is a very important document (Sources.list) but you forget where it is, you vaguely remember it in the/etc/directory, now you want to find out this file, and then set it to be accessible to you, but other users cannot access

    • Target: Locate the Sources.list file, change the file owner to self (Shiyanlou), and modify the permissions to only read and write to yourself.

    • Answer:

      sudo find /etc/ -name sources.listFind the specified file address

      sudo chown shiyanlou /etc/apt/sources.listChange file owner to Shiyanlou

      chmod 600 /etc/apt/sources.listChange permissions using the binary method

      ll /etc/apt/sources.listView Results

Lab 6 file Package and decompression

    • Experiment content: Introduce the compression/decompression tools commonly used on Linux, mainly explain the use of Zip,rar,tar
    • Linux Common compressed package file format
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

Emphasis is on zip, rar, tar format

    • Common parameters
Parameters Description
-R Recursive packaging contains the entire contents of subdirectories
-Q Quiet mode, which does not output information to the screen
-O The output file must be followed by the package output filename
-X Exclude the last zip file created, prevent duplicate packaging, only use absolute path
-E To create an encrypted compressed package
-L Convert LF to CR+LF, excluding no line-wrapping issues

Also use parameter-[1-9], which means that the compression level is 1-9, 1 means the fastest compression but the volume is large, and 9 represents the smallest but the longest. Examples are as follows:

zip -r -9 -q -o shiyanlou_9.zip /home/shiyanlou -x ~/*.zip

zip -r -1 -q -o shiyanlou_1.zip /home/shiyanlou -x ~/*.zip

  • Zip packaging and Unzip decompression
    • Zip

      • Package folder:zip 打包输出文件名.zip 被打包目录
    • Unzip

      • Unzip to current directory:unzip 压缩文件名.zip

      • Unzip to the specified directory:unzip -q 压缩文件名.zip -d ziptest

      • To view the contents of a compressed package:unzip -l 压缩文件名.zip

  • rar Packaging and Unrar decompression
    • rar package

      • Create a package or add a file to a compressed package from a specified file or directory: rm *.rar , rar a package output File name. rar

      • Note: The rar command parameter does not have "-", otherwise it will be error

      • Delete a file from the specified package file: rar d compressed file name. rar. zshr C

      • View unresolved files: rar L compressed file name. rar

    • Unrar decompression

      • full path decompression:

      unrar x shiyanlou.rar

      • Remove Path decompression:

      mkdir tmp

      unrar e shiyanlou.rar tmp/

  • Tar packaging and compression

    • Tar decompression and compression are the same command, just different parameters, the use of more convenient
    • Tar Packaging:tar -zcvf something.tar something
    • Tar decompression:tar -zxvf something.tar
    • Specify the path:-C 参数

      compressed file format Parameters
      *.tar.gz -Z
      *.tar.xz -j
      *tar.bz2 -j
  • Job: Create a file named Test, packaged in zip and tar, and then extracted to the/home/shiyanlou directory
    • Answer:
      Package and decompress using zip and unzip:

      Package and decompress with tar:

  • Summarize

    file format decompression method
    *.tar Unzip with TAR–XVF
    *.gz Unzip with gzip-d or Gunzip
    . tar.gz and . tgz Unzip with TAR–XZF
    *.bz2 Use bzip2-d or unzip with BUNZIP2
    *.tar.bz2 Unzip with TAR–XJF
    *. Z Unzip with Uncompress
    *.tar. Z Unzip with TAR–XZF
    *.rar Unzip with Unrar E
    *.zip Unzip with unzip

Lab 7 file system operations vs. Disk Management

    • Experimental content: The use of df,du,mount command and disk-related knowledge learning, this section is relatively easy, mostly conceptual knowledge points, a lot of new concepts need further understanding.
    • Job: Find the top 10 files in the current directory that occupy the most.
Iii. Summary

This experiment is the most difficult of three preparatory experiments, the main purpose is to let us know more about the basic operation of Linux, I do in the actual practice of some operating skills, but also feel the magic of Linux, and stimulate my interest in learning. I hope I can learn the language well in this semester.

20165223 Linux Installation and command Getting Started

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.