Linux. Basic instruction Notes

Source: Internet
Author: User


Command: StartX into the graphical interface shut–h now immediately shut down reset reset but the best use of fullreset more complete, no leakage traces

Shut–r now restart the computer reboot now restart the computer

Logout Log off User su– switch Administrator identity

Root is the most privileged administrator (System administrator)

VI Editor

2. Input I, enter insert mode

3. Enter the ESC key (upper left corner) to enter command mode

Command: ls: View all files in the current directory

Ls-l: Production View all file details under current directory

/The role of the directories under the root directory

usr folder where file default installation location is stored

Root to store the root user's related files

Home to store the relevant files for ordinary users

A directory where the bin holds common commands (such as, copy, delete, etc.)

Sbin commands to be used with a certain permission

MNT mounts the CD-ROM and floppy drive directories by default

ETC Storage Configuration related files

var holds a number of frequently changing files

Boot-related files (not bootable (Linux) if deleted)

Command CD switch directory cd/switch to root directory

☆pwd current directory (PATH)

Useradd Specific User: Add a user (only a new user can be added with root privileges)

passwd specific User: Set a password for the new user (after passwd, if the user is not added, the system will assume that you are setting a password for the current user)

Userdel User name: Delete User (deleted name, keep write file)

userdel-User name: Delete user and user home directory


Specify run level command 0 shutdown

1 Single User

2 Multi-user state with root privileges no NETWORK service

Users can modify more than 3 user states have network services

Level 4 system not used reserved to user (not currently used)

5 graphical interface

6 restart

Enter the Vi/etc/inittab command to pop up the ID: Number: Initdefault Change the number

To resolve the method of modifying the error configuration

1. When entering the Grub boot interface, enter E

2. Select the second line and enter E

3. Enter 1 at the end to indicate a single user level of 1th

4. Press "B" key to restart

5. Normal change back

Common command pwd show current working directory CD change Directory

LS lists files and directories ls-a show hidden files

LS-L Displays long list expressions can also be ls-al

mkdir Creating a directory rmdir deleting a directory

Touch Create empty file CP Copy command

MV move file and change file name rm Delete files and directories

Rm-f Force Delete rm-rf* Delete all content R recursive F mandatory

ln establishes a symbolic connection Ln–s source target

Ln–s/etc/inittab [Inittab pointing to actual file/etc/inittab]

More display of file contents with pagination

Less displays the contents of the file with pagination

grep queries the text for content

丨 (vertical) Pipeline command (the key next to shift+ carriage return) means: Give the result of the previous command to | (vertical) The command handling

grep usage grep "to retrieve Content" A.java. File name

Grep–n "To retrieve content" A.java. Exact to a specific line lookup

Man is like God, he knows everything.

If you are looking in multiple files, write each file (including the file path) directly. Separated by a space

Query for file existence find

Full scan of files to look for, such as Find/-name

Find/root/-name to find the file. Find in the root directory specifically

REDIRECT Command

The contents of the Ls–l>a.txt list are written to the file A.txt (overwrite write, not created)

The contents of the Ls–al>>aa.txt list are appended to the end of the file Aa.txt

In Linux, all users must belong to a group, not independent of the group, and each file has the concept of owner, group, and other groups. And one user can be in more than one group at a time.

Command: Groupadd group name. ---adding Groups to Linux

View all group information in Linux Vi/etc/group can be edited

Cat/etc/group can only see

Useradd–g the group name user name. Create a user and assign the user to a specified group

View all user information in Linux vi/etc/passwd

cat/etc/passwd

chmod >>>along (Folder/file) to modify folder/file permissions

USERMOD–G Group name User name modify the group in which the user is located

Ls–ahl can see the owner of the file

Chown User name File name Modify the file owner

CHGRP Group name File name modify the group in which the file is located

Code explanation

Xiaoming:x:501:502:/home/xiaoming:/bin/bash

User name password The shell parser used in the directory where the user is located

501 means user id,502 represents the group ID of the user

-R W–r--R--/user name user group

①②③④

1 File types

2 Permissions of the file owner on the file

3 Permissions for this file in the same group as the file

4 Permissions of other groups of users on this file

File type

R: Readable with 4 indication

W: writable, denoted by 2

x: Executable, denoted by 1


Linux partition

Total Cdef Four partitions, c primary partition, Def as extended partition, where F is logical partition

Primary partition + Extended partition ≤4

The extended partition cannot be used directly, it needs to be partitioned into logical partitions, and there is no limit to the number of logical partitions.

Linux users, regardless of a few partitions, to which directory to use, it is in the final analysis of only one root directory.

Command: FALISK–L View partition

df/boot/viewing the partition where the boot directory resides

umount/boot/Interrupt boot directory and hard drive mount, boot down to empty

mount/dev/sda1/text/the partition of the hard drive to the specified folder

Dev represents the device, the SD in the SDA1 represents the SCSI hard disk (HD represents the IDE hard disk), a represents the first drive, and 1 represents the first partition,

DF and df-h are used to view partitions

find-size+1000000k query for 1G of memory on-line files

TCP IP

Command history recently used historical command

History 5 Recently used five commands

! 5 Perform a command with a history number of 5

! LS executes the last command that starts with "LS"

TCP/IP Model:

Application Application Layer

Transport Transport Layer

IP network layer

Link Link Layer

Windows Check IP command ipconfig

Trace route command tracert + URL/target ip/domain name (3 of 1 can be)

To view the routes passed through the site

Test whether two IP is unblocked ping destination IP

Under Linux/unix, view the IP status command. Ifconfig

Loop (IP is loop without network) 127. Any value (except full 0 and all 1) eg 127.0.01

Subnet: Usually the same IP address in front of the network number, all belong to the same subnet

Like 192.168.0.1 and 192.168.0.2.

The subnets are connected by routers

Gateway: Internet Cafes network connection, all through a gateway out.


This article from the "11601463" blog, reproduced please contact the author!

Linux. Basic instruction Notes

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.