===================linux Basic Instruction ========================================Cat-b Displays line numbers equal to NLMore press B to page UP press Q to exit press the Space page by page, press ENTER line to turn less pagedown page down PageUp up? Find string Example:? Casehead-n Specifies the number of rowsTail=================== Management of users and user groups ========================================User's add delete and modify Useradd useradd-c "Zhangsan" Zhangsan this is not yet available, you must give the password passwd Zhangsan prompt for a new password and repeat confirmation Userdel Zhangsan Delete User Groupadd gp1 Add user group gpasswd gp1 set password groupdel gp1 Delete user newgrp root Switch User group switch needs to fill in the effect before password switching drwxr-xr-x. 2 add4 add4 4096 APR 13:08 ABC2 after switching effect drwxr-xr-x. 2 add4 root2 4096 Apr 13:08 ABC2 switch User su root needs to enter a password Cat/etc/group View user group Add user to user group [email protected]/]# usermod-g Gpall ADD5 View Current User group [[email protected]/]# groups Add5add5:gpallThe /etc/passwd file is one of the most important files involved in user management work. But a lot of them now encrypt the password to store this/etc/shadowBulk Add user Useradd Aa1,aa2,aa3 but need to also add password modifications per user/etc/passwd another way user001::600:100:user:/home/user001:/bin/bashuser002: : 601:100:user:/home/user002:/bin/bashuser003::602:100:user:/home/user003:/bin/bashuser004::603:100:user:/home/ User004:/bin/bashuser005::604:100:user:/home/user005:/bin/bashuser006::605:100:user:/home/user006:/bin/bash========== Example =========================Store encrypted accounts in/etc/shadow add1:!! : 16917:0:99999:7:::add2::16917:0:99999:7:::add3:!! : 16917:0:99999:7:::add4:$6$lloldtdh$lxoqmjnypxj.sgmwblaaq6wqyisd/r9tkiinzj7dzvr/ euotfmpfbnvfgwppksdj09olydvg6yylduod/k31n/:16917:0:99999:7:::add5:$6$gn42rzjh$ Xhxmbaxrhkotnqm9cyqirmviskrww2j0arler92yj/tnr4b1xd/2vm7vt46wpoi/dlkbyf0o8y/nuomotpqoo/:16917:0:99999:7::: In/etc /PASSWD Deposit Account Add1:x:1001:1001::/home/add1:/bin/bashadd2:x:1002:1002::/home/add2:/bin/bashadd3:x:1003:1003::/home /add3:/bin/bashadd4:x:1004:1005::/home/add4:/bin/bashadd5:x:1005:1008::/home/add5:/bin/bash batch Change password slightly troublesome ================== other instructions ======================= The command w is displayed by Title: Current time, machine uptime, number of logged-in users, system load information. Who view online users [[[email protected]/]# W 13:22:53 up ten days, 15:50, 7 users, load average:0.00, 0.01, 0.05USER TTY from [email protected] IDLE jcpu PCPU whatroot tty1 15apr16 8day s 0.12s 0.11s-bashroot pts/0 120.36.84.225 12:27 17:17 0.11s 0.11s-bashadd4 pts/1 120.36.84.225 13:02 14:21 0.02s 0.01s bashroot pts/2 120.36.84.225 13:04 15:17 0.01s 0.01s-bashadd4 PTS/3 120.36.84.225 13:15 1:41 0.03s 0.10s sshd:add4 [priroot pts/4 120.36.84.225 13:21 5.00s 0.03s 0. 01s wadd5 pts/5 120.36.84.225 13:22 3.00s 0.00s 0.00s-bash[[email protected]/]# whoroot tty1 2016-04-15 21:39root pts/0 2016-04-26 12:27 (120.36.84.225) add4 pts/1 2016-04-26 13:02 (120.36. 84.225) Root pts/2 2016-04-26 13:04 (120.36.84.225) add4 pts/3 2016-04-26 13:15 (120.36.84.225) Root Pts/4 2016-04-26 13:21 (120.36.84.225) add5 pts/5 2016-04-26 13:22 (120.36.84.225) = =========================== disk Use =============================DF Command-A: List all file systems, including system-specific/proc and other file systems;-k: Display the file system in the capacity of Kbytes ;-m: Display the file system in the capacity of MBytes ;-h: gbytes, MBytes, Kbytes and other formats are displayed by people who are easier to read;- H : The carry modewith m = k substituted m=1024x768k;- T : Displays the file system type, along with the filesystem name of the partition (for example, Ext3), also listed;-I: No hard disk capacity, but the number of inode to display[[email protected] etc]# DF Filesystem 1k-blocks used Available use% mounted on/dev/vda1 20509428 1882124 17719776 10%/Devtmpfs 499644 0 499644 0%/devtmpfs 508452 0 508452 0%/dev/shmtmpfs 508452 25956 482496 6%/runtmpfs 508452 0 508452 0%/sys/fs/cgrouptmpfs 1016 0 101692 0%/run/user/0tmpfs 101692 0 101692 0%/run/user/1004tmpfs 10169 2 0 101692 0%/run/user/1005du command Understanding can also be viewed using space, but unlike the DF command, the Linux du command is a view of the space used for file and directory disks,-A: List all files and directory capacity, because the default is only the number of files under the directory. -h: Displayed in a more readable capacity format (G/M);-S: Lists the total, not the capacity of each directory;- S : Does not include totals under subdirectories, and is somewhat different from-S. -K: List capacity display with Kbytes ;-m: List capacity display with MBytes ;Fdiskfdisk is a disk partition table operation tool for Linux. -L: Outputs all partition contents of the device after the output. If there is only fdisk-l, the system will list the partitions of the device that can be searched in the whole system. [[email protected] etc]# fdisk-ldisk/dev/vda:21.5 GB, 21474836480 bytes, 41943040 sectorsunits = sectors of 1 * 512 = 5 Bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): + bytes/512 bytesdisk label T Ype:dosdisk identifier:0x000566ed Device Boot Start End Blocks Id System/dev/vda1 * 2048 41941319 20969636 LinuxFormat Disk MKFS [-t file System format] Appliance file name options and parameters:-T: can take file system format, such as Ext3, ext2, VFAT, etc. (System support will be effective)fsck disk Check disk mount with dismount Linux disk mount using the Mount command, uninstall using the Umount command. [[email protected] ~]# mount/dev/hdc6/mnt/hdc6[[email protected] ~]# Dfumount [-FN] Appliance file name or mount point VI Editor Press I to enter edit mode, start editing text: Wq Leave vi= after storage==================vi Editor using ================================Move the cursor method h or LEFT arrow key (←) The cursor moves left one character J or down ARROW key (↓) cursor moves down one character K or up ARROW key (↑) cursor moves up one character L or right arrow key (→) The cursor moves one character to the right if you put your right hand on the keyboard , you will find that the HJKL are arranged together, so you can use the four buttons to move the cursor. If you want to move multiple times, such as moving down 30 lines, you can use the "30j" or "30↓" combination of keys, that is, plus the number of times you want to do (number), press the action! [Ctrl] + [F] screen "down" to move a page, equivalent to [PAGE DOWN] key (common) [Ctrl] + [B] screen "Up" to move a page, equivalent to [PAGE UP] key (common) [Ctrl] + [d] screen "down" move half page [Ctrl] + [u] screen "Up" move half page + cursor moves to the next column of non-whitespace-cursor moves to the previous column of non-whitespaceN<space> that n means "number", for example 20. When you press the number and then press the SPACEBAR, the cursor moves the n characters of the line to the right. For example 20<space>, the cursor moves 20 character distances to the back. 0 or function key [Home] This is the number "0": Move to the front of the line prompt (common) $ or function key [end] move to the last face of this line prompt (common) H cursor moves to the top of this screen the first character of the line m cursor moves to the center of this screen line The first character L cursor moves to the bottom of the screen the first character of the line G moves to the last line of this file (commonly used) NG n is a number. Move to the nth row of this file. For example 20G will move to the 20th line of this file (can match: Set NU) GG moved to the first line of this file, equivalent to 1G Ah! (common) n<enter> n is a number. Move the cursor down n rows (common) search and replace/word look under the cursor for a string called Word. For example, in the file search Vbird This string, you can enter/vbird! (Common) Word looks for a string above the cursor with a string name of Word. n this n is the English key. Represents the action of repeating the previous search. For example, if we have just executed/vbird to search for Vbird this string, then pressing N will continue to search down the next string named Vbird. If the Vbird is executed, then pressing N will continue to search for the string named Vbird! n this n is the English key. In contrast to N, the previous search action for "reverse". For example/vbird, pressing N means "up" to search for Vbird. Using/word with N and n is extremely helpful! Can let you repeat to find some of the keywords you search! : n1,n2s/word1/word2/g N1 and N2 are numbers. Look for the string word1 between N1 and N2, and replace the string with Word2! For example, search for vbird between 100 and 200 rows and replace it with Vbird: ": 100,200s/vbird/vbird/g". (common): 1, $s/word1/word2/g look for the word1 string from the first line to the last line, and replace the string with Word2! (common): 1, $s/word1/word2/gc look for the word1 string from the first line to the last line, and replace the string with Word2! and display the prompt character before the substitution to the user to confirm (confirm) whether need to replace! (common) Delete, copy and paste X, x in a line of words, X is to delete a character (equivalent to the [Del] key), X to delete a character (equivalent to [backspace] is the backspace bar) (commonly used) NX N is a number, successive backward delete n characters. For example, I want to delete the 10 characters consecutively, "10x". DD Delete the entire row (commonly used) NDD n is a number on which the cursor is located. Delete the down n column where the cursor is located, for example 20DD to delete 20 columns (common) d1g Delete all data from the first row of the cursor, DG deletes all data d$ the last row of the cursor, to the last character of the row d0 that is the number 0, the cursor is deleted to the row of the The first character yy the row on which the copy cursor resides (commonly used) Nyy n is a number. The Down n column where the copy cursor is located, for example, 20yy copies 20 columns (common) y1g all the numbers in the column to the first column of the replication cursorAll data from the column of the YG copy cursor to the last column y0 copy the character of the cursor to all data at the beginning of the line y$ copy the character of the cursor to the end of the line, p p is to paste the copied data on the next line of the cursor, p is a row on the cursor! For example, I currently have the cursor on line 20th and have copied 10 rows of data. When P is pressed, the 10 rows of data will be affixed to the original 20 lines, i.e. 21 lines. But what if we press P? Then the original 20th Guild was pushed into 30 rows. Common J combine the cursor column and the next column of data into the same column C to repeatedly delete multiple data, for example, delete 10 rows down, [10CJ]u Restore the previous action. Common [Ctrl]+r redo the last action.] (common) this u and [ctrl]+r are very common instructions! One is recovery, the other is redo once ~ Use these two function keys, your editor, hey! Very happy!. Don't doubt it! This is the decimal point! To repeat the meaning of a previous action. If you want to repeat the deletion, repeat the paste, and so on, press the decimal point "." It's all right! (common) Part II: General mode switch to edit mode available button description Enter INSERT or replace edit mode i, I enter insert mode: I is "insert from the current cursor place", I is "insert at the first non-whitespace space in the line at present". (common) A, a into insert mode: A is "insert from the next character where the cursor is currently located", and A is "starting at the last character of the line where the cursor is located." O, O Enter insert mode: This is the case of the English letter O. o Insert a new line at the next line where the cursor is currently located; o Insert a new line on the previous line where the cursor is currently located! R, r, enter replace mode: R will only replace the one character of the cursor at a time, R will always replace the text of the cursor until the ESC is pressed, and (commonly) the above buttons will appear in the lower left corner of the VI screen "--insert--" or "-- The word "replace--". The action is known by the name!! In particular, we mentioned above, you want to enter characters in the file, be sure to see the lower left corner of INSERT or REPLACE to enter Oh! [ESC] Exit edit mode, back to normal mode (common) Part III: General mode switch to instruction column mode available button descriptionCommand column storage, departure, etc. instructions: W write the edited data to the drive file (Common): w! If the file property is read-only, the archive is forced to be written. However, in the end can be written, or with you on the file permissions related Ah! : Q Departure VI (Common): q! If you have modified the file, do not want to store, use! Do not store files for forced departures. Note that the exclamation point (!) in VI, often has the meaning of "mandatory" ~:WQ storage after leaving, if: wq! Then leave the (common) ZZ after forcing the store. This is the uppercase Z! If the file does not change, then do not store away, if the file has been changed, then save and leave! : w [filename] saves the edited data to another file (similar to a new file): R [FileName] in the edited data, read into the data of another file. The "filename" file is also appended to the cursor line: n1,n2 w [filename] stores the contents of N1 to N2 as the filename file. :! Command temporarily leaves VI to command column mode to perform command display results! For example ":! Ls/home "You can see in VI the file information under/home with LS output! ===================vi Editor End ================================Yum Front-end package management based on RPM to automatically process dependency relationships crap, just start using it. Yum Install <package_name>yum remove @kde-desktop
Basic Linux Knowledge