20165302 preparatory work 3 Linux installation and learning

Source: Internet
Author: User

Linux system Installation

I had some minor problems when I installed VirtualBox,

My computer can only set 32-bit Ubuntu version, but the tutorial said to choose 64-bit, I through the Baidu query learned to do BIOS settings, set up can be checked 64-bit

Ubuntu installation is relatively smooth

Linux Learning Notes

Introduction to Linux systems and basic concepts and operations

    • Operating system: The operating system is a large-scale software system, its function is complex, the system is huge.
    • Operating system features: Provide a shell for the user and provide system calls to the programmer
    • Shell: The difference in the actual experience in the graphical interface is the software < command parser that is provided to the user to use the interface, and the program that can accept users ' input commands.
    • Shortcut keys
shortcut Keys function
[Tab] Command completion
[Ctrl + C] Forcibly terminates the current program, but does not cause the terminal to exit
[Ctrl+d] Keyboard input end or exit terminal
[Ctrl+s] Pause the current program, pause and press any key to resume running
    • Wildcard characters: to blur a character, find a folder, use it instead of one or more real characters, or use wildcards instead of one or more real characters when you don't know the true character or lazy input full name.

Common wildcard characters

    • *: Match 0 or more characters
    • ?: matches any one character
    • [List]: matches any single character in the list
    • [C1-C2]: Match any single word in c1-c2 such as: [0-9] [A-z]
    • {String1,string2,...}: (or more) one string
    • {C1.. C2}: Matches all characters in c1-c2 such as {1..10}

Man command:

The Help documentation is included (the learning focus is 1, 2, 3. ):

    • is the normal Linux command, is the system call, the operating system provides the service interface, is the library function C language function

User and file Management

    • Who am I: View users
    • Groups < user name > or cat/etc/group: See which user groups you belong to
    • Exit or Ctrl+d: Exit the current user
    • sudo usermod-g sudo < username;: Add other users to the sudo group
    • sudo adduser < user name;: Create user
    • Su-l < user name: Toggle Login User
    • sudo deluser < user name >--remove-< directory;: Delete user

User groups: A collection of users that share some resources and permissions while owning a private resource

Highest privilege: root privilege, root privileges can be obtained by sudo command

Read permissions: You can use cat < file name > to read file contents

    • Output files in the current directory in a longer format (view file permissions): Ls-l
    • Show except ".", "..." All except the hidden files: ls-a
    • View the full properties of a directory: LS-DL < directory name >
    • Create a new ... File: Touch ...
    • Modify file owner to Shiyanlou:sudo chown Shiyanlou ...
    • Modify Permissions: chmod700 (order corresponds to RWX) ... or chmod GO-RW (+/-) ...

Linux directory structure

FHS defines the two-tier specification, the first layer is what file data should be placed in each directory below, and the second tier is defined for subdirectories of the/USR and/var directories.

    • Catalog Form

Command function
Touch < file name > Create a new blank file, without any parameters, specify only one file name, creating a blank file with the specified file name
mkdir < directory name > You can create an empty directory
Mkdir-p < directory name > Create parent Directory
CP < file name > < directory name > Copy files to this directory
Cp-r or-r < directory name > Copy Directory
RM < file name > deleting files
Rm-r or-r < directory name > Delete Directory
Rm-f < file name > Force Delete
MV < file names > < directories > Move files to the directory
MV < filename 1> < filename 2> Modify file name
Cat < file name > Print file contents to Terminal (positive order display) (plus-n Display line number)
Tac < file name > Print file contents to terminal (reverse display) (plus-n Display line number)
NL < file name > Add line numbers and print
More and less Paging through files
Tail-n < digital > < files > View the tail lines of a file
Head-n < digital > < files > View the first few lines of a file

File packaging and compression

    • RAR RAR Program Compressed files
    • Zip Zip program to package compressed files
    • 7z 7zip Program Compressed files
    • Tar tar program packaged, uncompressed files
    • GZ gzip Program (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 package, XZ program compressed files
    • TAR.BZ2 tar package, BZIP2 program compressed files
    • tar.7z tar package, 7z program compressed files

Common commands:

Zip:

Package: Zip something.zip Something (directory please add-r parameter)

Unpacking: Unzip Something.zip

Specify path:-d parameter

Tar

Package: TAR-ZCVF Something.tar Something

Unpacking: TAR-ZXVF Something.tar

Specify path:-C parameter

File system operations and Disk Management

    • DD Command:
      DD command for converting and copying files
      DD; You can also read files or write to these file DD programs, or you can process data at copy time, such as converting a byte order, or swapping between ASCII and EBCDIC encoding.
      Note: the command line option format is option = value

    • DD is read from the standard input by default and is written to standard output, but can be changed with the option if (input file, input files) and the of (output file, export files).

DF: View the capacity of the disk

Du-h: View the capacity of a directory and render it in a more readable manner

Du-a: Displays the size of all files in the directory

Du-s: Shows the synthesis of the final file capacity

Du-h-D 0 ~ (View level 1 directory only);d u-h-D 1 ~ (view 2 levels only): View directory

DD of=test bs=10 count=1 (or dd If=/dev/stdin of=test bs=10 count=1): Output from standard input to file with dd command

DD If=/dev/stdin of=/dev/stdout bs=10 count=1 output to standard output

DD If=/dev/stdin of=test bs=10 count=1 conv=ucase: Converts the output English character to uppercase and then writes the file

DD If=/dev/zero of=virtual.img bs=1m count=256: Create an empty file with a capacity of 256M from the/dev/zero device

sudo mkfs.ext4 virtual.img: Virtual disk image formatted as EXT4 file system

sudo mount: Use mount to view mounted file systems

Mount-o loop-t virtual.img/mnt: Mount Virtual disk image to/mnt directory

Mount-o Loop--ro virtual.img/mnt (or Mount-o loop,ro virtual.img/mnt): Mount in read-only mode

sudo unmount/mnt: Use the unmount command to unload a mounted disk sudo fdisk-l

20165302 preparatory work 3 Linux installation and learning

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.