Linux Beginner Note Backup

Source: Internet
Author: User

1.VI Edit text file <1> cursor movementh/j/k/lMove the cursor to the left/bottom/top/Right one pane, respectively(Add a number before the letter, you can move a multi-lattice effect)w/b/eThe beginning of the next word/the beginning of the previous word/the tail letter of the last word<3> Quick Jump between rowsctrl+b/fThe screen moves backward one page/screen moves forward one pagectrl+u/dThe screen moves forward half page/Screen backward half page: Set Nu/nonuShow line number/hidden line number1g/g/#G/:#Article beginning/end of article/Article # # Line/Article # # line <4> Delete(from the character where the cursor is located)x/#x1 characters/#个字符DdYesDw/deTo the end of the word (including/not including spaces)d$/d^To the end of the line/to the beginningJ (Capital J)Trailing newline character (not deleted from cursor, only line break)(replace D with C, many effects that can be removed while entering the insert state) <5> UndoULast Action (multi-step undo can be added digitally) (multiple u can only switch between current and undo once)UAll operations on the current rowCtrl+rRedo (relative to undo) (non-numeric) <6> Insert (enter insert mode)IInsert from current cursorAInsert from current cursoro/oNew row below/above the current row, insertingAThe tail of the current linecw/c$/c^ Delete the cursor to the end of the word and insert/... <7> copy and pasteYyCopy entire rowyw/y$/y^Copy to end/end of Word/beginning of linePPaste<8> Find/word or? wordFind the string "word" from top to bottomn/nNavigate to Next/previous found string<9> replacement: s/old/newBasic command: The first old of the current row is replaced with the new: Add "#,#" between SRange becomes # line to # line: Add "%" between sRange becomes entire documentEnd Tim "/g"Replace more than the first, the range is replacedEnd Tim "/C"Replace all of the ranges with a confirmation (2) Insert mode can only enter text in this mode, otherwise the command is entered.  Press ESC in this mode to exit edit mode, back to command mode (3) Last line mode the command typed in command mode starts with ":" or "/" and automatically enters the bottom row mode, and you can see that the cursor is automatically moved to the end of the document. In addition to the commands listed in command mode, the bottom-line mode has the following command:: WSave: W NameSave As: WqSave and exit: q/:q!Exit 2. Ctrl+s lock terminal, unlock with ctrl+pCTRL + CAbort the program and exit the current command (exit completely)Ctrl+dEquivalent to exit, quit sessionCTRL + ZThe program goes to the background, sleeps, hangs. Restore activation with FGTabAuto-complete Command 3.tar compressed packageWith this command, the compression name extension is. tar.gz4.ls View the child of the object (ll effect is the same, but it is an alias, and some systems do not)The LS command acts on the last name of the command (file/directory, etc.), and its default value is the current position.Add '-a ' to view all files, including hidden files (add '. ' before filename) Hidden files, no-A will not be displayed)Add '-l ' to view the child and display details.-L Output Explanation:/home/cwj/documents/ls_l output interpretationL and a can be used together, plus-H system select units.The LS command adds a name, if the name is a file (file path), output the file information, but if it is a folder, the contents of the folder are output. To view the folder itself, add-d5. Folder operationsMkdir-p NameCreate a folderRm-r NameThe folder and its children are deleted (do not want to get back with shred)Cp-r Old NewCopyMV Old NewMoveNote: For a copy move delete operation, all files under the folder, not the folder, are added "\*" after the directory, otherwise there is no "\" at the end of the old. New.6. File operationTouch name. FormatCreate a file (touch also has the effect of modified time, details Web search)Rm-i NameName *.C and other ways can be implemented in bulk Delete, at this time add-I, will be deleted before deleting each (do not want to get back with shred)Cp-b Old NewCopyMV Old NewMove, old specific to file, new is a folder, new finally has a "\"Cat Old1 old2 > newMerging filesCat-n Old > newSave old plus line number as newCat-s Old > newReplace multiple lines in old with a single line of white spaceecho "string" > NameWrites "string" to "First name" (Original content Empty) ("can be changed to")Note: ">" in commands such as Cat and Echo means that the original content is erased, and if you change to ">>" it becomes appended and the original content is not cleared. 7.CD Access DirectoryCD or CD ~/Back to home directoryCD-Go back to the directory where you went before entering this directoryCd..Return to Parent DirectoryCd.. /.. Or.. /Go back to the parent directory of the parent directoryCD name"Name" of the child accessing the current directoryCd/nameAbsolute directory with "/" at the beginning of the directoryAnother: path-Related:

PWD View current path (connection path, to actual path plus option-p)

./Current Directory

8. Process commands (1) View process Ps,pstree,topPsCurrent processPS #List information for processes with PID #PS AUnder the current terminal, including other users 'Ps-aAll ProgramsPS EDisplay environment variablesPS SShow program status in signal formPS SList broken sub-programs (also listed without interruption)PS uShow program status in user-oriented formatPstree PIDShow tree relationships between processes (each process in Linux is created by a parent process), the default value of PID is 1 (init)TopShow resources used by the processHtopClass Top, but interactive, requires additional installationPgrep-u User NamePID of the process that displays the name of the user username (2) Kill process/exit processKill PIDUsing the process PID to locate the processKill-9 PIDUsing the process PID to locate the processKillall-9 NameLocating processes with process namesExitExit process (3) restricting resourcesUlimit-aDisplays the resource limits associated with the current user (the ULIMIT directive for the resource type)9. User Command WInformation about the currently logged on user and the process being executed by the WHOCurrently logged on user WhoAmI ID ID of the current userThe UID and GID of the currently logged in account and the group and user name 10. Clear Screenclear/reset11. View HelpMans nameView Help for Command nameName-helpIncluding examples, more complete contentInfo nameWith common parameters12.ln Establishing LinksLn-s Source LinkCreate a symbolic link for the folder/file source link, which is equivalent to a shortcut that stores the address of sourceln Source LinkCreating a hard link to a file source, which is equivalent to the alias link for source, prevents accidental deletion. After you create a hard link, the other updates, regardless of source or link, because it is an alias, the file index node number (inode) is the same, Use the same storage space. Any name of a file (including Source,link) is deleted without affecting access to it with a different name. If all aliases are RM, the file is actually deletedWhere Source,link are directories, specific to the file (-s can be specific to the folder)Link delete the File/folder method with RM Delete. 13. Permissionschmod who mode fileGrant access to the file's mode to WHOWho:u, G Group, o Other, a all (all, i.e. Ugo)MODE:WRX format or 7 (241) formatchmod mode fileGrant mode permission to file to all.mode:755 or WRXWRXWRX formatOther formats:chmod u+x FileAdd execute permission to the owner of filechmod 751 FileAssign read, write, execute (7) permissions to the owner of file, assign Read, execute (5) permissions to the group where the file resides, and assign permissions to other users to execute (1)chmod u=rwx,g=rx,o=x FileAnother form of the above examplechmod =r FileAssign Read permissions to all userschmod 444 FileExample abovechmod a-wx,a+r FileExample aboveChmod-ru+r DirectoryRecursively assign Read permissions to all files and subdirectories under the directory directory 14.more view file contents, paging viewMore-num NameNum lines per screen display file nameMore +/pattern NameStarting from the first pattern of nameAfter you run the more command, you can use the operation commands to read:Enter1 Rows downSpace1 Screen down=Output Current line numberVCall VI EditorQExit/pattern find patten,n down, n up less to view the contents of the file, more can not be turned upside down but canLess [option] Name-I.Ignoring the case when searching-MShow percentages similar to more-NShow line Numbers-SIf the line is too long, discard the excess part/patternSearch down, use NN to search for next (n is reverse)? patternSearch up, use NN to search for next (n is reverse)b/pagedown/EnterTurn down one pageDHalf PAGE UpU/pageupGo up one pageYUp one lineSpaceDown one line other commands to view the contents of a file:VI File nameEdit mode view, can modifyCat file nameShow all file contentsMore file namesPage display of file contentsLess file nameSimilar to more, it's better to page aheadTail file nameTo view only the trailer, you can also specify the number of rowsHead file nameYou can also specify the number of rows by viewing only the header

Linux Beginner Note Backup

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.