Linux command line shortcuts

  
 

Begin to talk about the difference between the number of history records and the HISTSIZE” and

by default, the values ​​of HISTFILESIZE and HISTSIZE are both 500, indicating that 500 command records can be recorded.

HISTFILESIZE indicates the number of commands recorded in the file. HISTSIZE indicates the number of commands recorded in memory.

When we execute the command on the shell command line, the most recent HISTSIZE command is saved. In the memory you can use the up and down cursor or ctrl + p, ctrl + n up and down to find the command.

When exiting the shell, the HISTFILESIZE command is saved to the history command file. The next time you log in to the shell, it will read the command memory from the history command file.

When the network is interrupted, etc. When an exception occurs, you will find the previous history command. The next time you log in, you can't find the last history command with the up and down cursors, so you should exit normally or send the probe package to keep the shell online.

If you want to increase the number of history commands saved, you can manually modify the values ​​of the HISTFILESIZE and HISTSIZE variables in ~/.bash_profile.

Search Operation Shortcuts

Search History Command Shortcuts: Ctrl + r It matches the history by keyword. After execution, it will prompt: (reverse-i-search)`&rsquo ;:

Enter the keywords you remember to match. If the command you need is displayed, press Enter to select the command; if not, enter a more precise keyword to match.

Mobile Action Shortcuts

Ctrl + f– Move one character to the right, of course most people use → Ctrl + b– to move one character to the left, most people use ← ESC + f&ndash ; Move a word to the right, MAC is recommended to use ALT + → ESC + b– Move a word to the left, MAC is recommended to use ALT + & larr; Ctrl + a & ndash; Jump to the beginning of the line Ctrl + e & ndash; Jump to the end of the line < Br>

Delete operation shortcuts

Ctrl+d– Delete a character to the right Ctrl + h– Delete a character to the left Ctrl + u– Delete the current position character to the beginning of the line (when the password is entered incorrectly) Use this) Ctrl + k– Delete the current position character to the end of the line Ctrl + w– Delete from the cursor to the beginning of the current word

Command switching operation shortcut

Ctrl + p– Previous command You can also use ↑ Ctrl + n– the next command, you can also use ↓

Other action shortcuts

Ctrl + y– Insert the most recently deleted word Ctrl + c– Ctrl + d– The current operation goes to the background Ctrl + l & ndash; Clear screen (sometimes Look good)

Let's finish these shortcuts and answer the questions at the beginning. I believe everyone has tried it. The ctrl+a shortcut will return the cursor to the beginning of the line.

Copyright © Windows knowledge All Rights Reserved