After 10 days, learning the Linux system explaining course, during the period because there are other learning things to deal with, resulting in slower learning speed. The next learning time needs to be accelerated and devoted.
2-0 Single-user mode
Root password reset
Reboot----3 seconds to press a button to enter an interface----Select the second row, press e----Enter another interface, add a 1 at the end of the last line, and press ENTER----and then press b----to enter 1 mode successfully.
Instruction RunLevel View mode
Instruction passwd Change Password
Reboot restart after setting a new password
2-1 Rescue Mode
Another way to change the root password
2-2CD command
Cd=chang dir Change Directory
Instruction cd/tmp into the TMP directory
instruction PWD View current directory
Command CD back to the root directory
Instruction CD-Go back to the previous directory
Instruction CD ~=CD ^c =CD
CD. Go to the current directory
Cd.. Go to the previous level, equivalent to back
2-3ls command
Ls=list
View file or directory various information
Ls-i, Ls-li, Ls-a, ls-l, LS-T, etc.
2-4linux Environment variables
Alias aliases
Instruction alias s= ' ls-alt/var/' (after the alias input instruction s is equal to the input instruction ls ...) ) (current terminal is in effect)
Command alias to view the system and its own set of variable aliases
instruction which LS to view the absolute path of LS
The path directive uses
2-5 using the shortcut keys
Exit, logout, CTRL D quit terminal
Press CTRL u to clear all instructions being entered
Press CTRL k to clear the command after the cursor
Press CTRL C to break instructions in the run
Press CTRL Z to pause the process instruction FG recovery process
Press CTRL s screen to QUIESCE lock CTRL Q Recovery
Press CTRL L to clear the screen
3-1 Creating and deleting directories
instruction mkdir Creating a directory
Directive mkdir 234 created 234 directories on root/root/234/
instruction mkdir only one directory can be created at a time
Instruction man mkdir viewing the use of mkdir directives
Directive MKDIR-PV/TMP/1/2/3 creates 3 directories at a time under TMP
Directive rmdir Delete Directory can only delete empty directory
Instruction Rmdir-p 1/2/3 Delete 1, 2, 3 directories can only delete empty directories
3-2RM directive
Instruction RM Delete File
Directive RM-RFV or RM-FRV forcibly delete directories or files without prompting for error
3-3CP Copy command
Instruction cp-r Copy Directory
Instruction Df-h View system partition status
Command CP a B copy a to B
3-4 Moving and renaming MV
MV can either move files or move directories
Format MV A b move A to B or the directory A moving knife directory B
Command tree A view the branches under the A directory
3-5 File View Commands
Instruction Cat A view file a content
Command TAC A view file a content
Command more a press the ENTER key one line to view the file a in a single screen and one screen can not view
Instruction less A (IBID.), you can also use the arrow keys to view the line up and down, CTRL B or F can also, G or G can also,/a search keyword a,? A search keyword a
Command head A view file a top 10 lines
Instruction Head-2 A view only the first 2 lines
Instruction tail A view a last 10 lines
Instruction Tail-3 last 3 lines
3-6 File and Directory properties
Ls-l/A View the properties of a directory or file a
Ls-la a View a
3-7chmod command
File attribute Permissions rwx (111=7) readable writable executable
chmod changing permissions
Directive Chmod¥a Change the permissions of file A to ¥
Instruction chmod-r¥111 111 permissions for all files and subdirectories changed to ¥
Umask
3-8chown command
Directive Chown A b.txt change the genus Group of B.txt
Useradd a CREATE User A
Groupadd c Create user Group C
Directive Chown:c B.txt Change the owning group of B.txt
Directive Chown Root:root B.txt to change the group of B.txt and its owning group to root
Historical command History! Add character or number to recall
Chown-r Modify the directory under all
3-9chattr File Hidden Properties
Lsattr View current directory Special properties Lsattr-r list all lsattr-d view only the directory itself
Chattr +a 1.txt Adds a privilege to 1.txt
echo "QQ" >1.txt 1.txt empty and then write to QQ
echo "QQ" >>1.txt QQ written to 1.txt last line
Chattr-a Subtract a permission
Chattr +i Permissions
Touch 1/2.txt Create 2.txt in 1 directory
4-0 Suid of special permission
Set_uid
/etc/shadow
/usr/bin/passwd
chmod u+s/tmp/ls gives LS u+s permission S is suid or set UID
Su-, logout temporary user Switching and return. #与 $
4-1 Special Permissions Sgid
Set_gid
R=4, w=2, X=1, set_uid=4, set_gid=2, stick_bit=1
4-2 Sticky of special permission
Stick_bit
prevent others from deleting their own files (between different users)
: wq! Force Save exit
Root mode run chmod o+t join T permissions other users cannot delete
4-3find Search should
Which, Whereis, locate can search the file path, but there are certain limitations, search scope and permissions, etc.
UpdateDB Refreshing the database
Directive find/tmp/-name ' ab ' found in the TMP directory AB file (single quote is not added)
Directive find/tmp/-name "A *" to find files beginning with a (double quotation marks can be used without a single quotation mark)
Instruction find/tmp/-type D Find all directories F Find all Files
find/tmp/-mtime-10 Find files within 10 days +10 found 10 days ago (created or modified)-mmin units are minutes
find/tmp/-type F |xargs rm find all files under TMP and delete RM can be changed to other instructions with
4-4 Three Time Properties
Mtime, Atime, CTime
Date Check datetime
Atime Access Time
Mtime Create or change a time
CTime changing the original data time
Command stat A view the properties of a file
Touch a If a does not exist create a new file A, if the file exists, changes the file 3 time
M to C must be changed, C change m not necessarily changed for example, change permissions
4-5 Soft links and hard links
Soft link = Shortcut
Directive Ln-s/root/12.txt/tmp/23.txt creates a soft link in root file 12.txt under TMP called 23.txt Create a soft link with an absolute path to avoid confusion
can also do the directory of Soft link 12.txt to the directory name
Inode: Metadata record data for each file or directory core important information an inode corresponds to one or more files in turn.
Ls-i/root/a View the inode of file a
DU-SH/ROOT/A viewing the size of file a
Hard links allow multiple files to be shared with one inode at a time
Directive ln/root/a/tmp/b Let the resulting B become a avatar hard link
Hard links cannot boast partitions and cannot do directory hard links under each partition a set of separate inode partitions under a 123 partition B there are also 123
4-6 User name File
User and Group Management
CAT/ETC/PASSWD (Core configuration file)
By: Divided into 7 segments
First paragraph user name
Second paragraph password
Third Segment UID View user uid by ID command such as ID root
Fourth Group ID
The fifth paragraph explains that the normal user is empty
Sixth paragraph home directory ordinary user is/home/user name:
Seventh Shell General/bin/bash can log in also have/sbin/nologin non-login/bin/false not login
4-7 Password file
/etc/shadow Store Password
By: Divided into 9 segments
1. User Name
2. User encrypted password
3, from 1970.1.1 to the last time to change the password
4. How many days before the password can be modified
5. How long does the password expire?
6, the password expires a few days before the warning
7. How many days to delay after the password expires lock account
8. Account Life cycle
9, retention value, no use
4-8 Adding and removing user groups
Directive Groupadd a creates group A
instruction Tail/etc/group Viewing the information for a group
Instruction/etc/gshadow View the password for the group
The ID of Group B created by Groupadd-g 555 B is 555. Normal create group ID starting from 500, the ID of the group created after creating B starts with 556
Directive Groupdel A Delete Group A group is used to summarize the user group inside if there are users this group cannot be deleted. Additional groups can be deleted, basic groups can not
4-9 Adding and removing users
Directive Useradd A creates both group A and user A
Directive Useradd-u 505-g A B creates a User B uid of 505 added to the instruction in Group A can also be changed to a GID
Instruction useradd-d Specify user home directory-s Specify user shell
Useradd-m-S does not create a home directory when creating a user
Directive Userdel a deletes user A but does not delete home directories
Directive Userdel-r a deletes a home directory when user A is deleted
5-0usermod Modifying user Properties
Instruction Usermod-g 501 A user A's GID changed to 501
Useradd-g Increase user Expansion Group expansion group can be deleted
Usermod-u-g-g-d-s can be changed with
Usermod-l lock A user cannot login-u unlock
5-1password Change Password
Instruction passwd more root password
Directive passwd A change the password for user A
Instruction mkpasswd prompt does not exist to enter instructions for Yum install-y expect install expect package again enter MKPASSWD run.
Mkpasswd-l specified password length-s number of symbols----Specify number of digits-C Specify the number of primary letters C
Instruction passwd--stdin A set User A's password
Command echo "B" |passed--stdin a set User A's password to B
5-2SU Switching users
The instruction ID or whoami can be checked by the current user
Instruction Su-b switch to B user
Instruction Su-C "instruction B" a executes instruction B under a user
5-3sudo detailed
sudo root gives ordinary users the command to root without a password
More difficult to use
5-4DF command
Instruction DF View system per partition usage cannot view swap
instruction free to view swap usage
Df-h,-K,-m display sizes in different units
instruction Df-i viewing partition inode usage
5-5du command
Du view file, directory usage size unit k
Du-h,-M,-K display in different units
du-sh/a/View the size of a file or directory A (size, DU-SB, and ls-lb to see the true size)
5-6fdisk command
Instruction fdisk-l View disk condition
Instruction Fdisk/dev/sdb enters b disk (instruction parted handles disks larger than 2T) enter M to view the commands that can be manipulated and then enter N to increase the partition E for the extended partition p as the primary partition L is the logical partition (subdivision under the extended partition) Example: p-1-1-+2g (size): W Deposit exit
5-7 Disk Format MKE2FS
The disk partition must be formatted before it can be used
Cat/etc/filesystems Viewing file system formats
iso9960 disc format, Common ext2, ext3, Ext4
Directive MKFS. viewing formatting formats
Instruction MKFS.EXT4/DEV/SDB5 Format the disk SDB5 in EXT4 format
Instruction Mke2fs-t ext4-b 2048-m 1-l A/DEV/SDB1 partition 1 formatted as EXT4 format, block size 2048, reserved 1%, label a
5-8 Disk mount and Uninstall
The disk must be mounted after it is formatted to write data
Directive mount/dev/sdb5/mnt/to mount the partition 5 under the MNT
Instruction Df-t or-M view all partition formats, mount points, and more
Umount-l/DEV/SDB5 unloading SDB5 mount point
5-9 Partition Table Fstab
Set up auto mount on boot
Instruction Cat/etc/fstab then add a partition setting
or instruction Vi/etc/rc.local then add an instruction
Blkid
Mount-a
Mount-o
Linux Learning Chapter II