(1) Search operation shortcut key for Search history command: Ctrl+r. Of course, not the command you want, you can continue Ctrl + R to search for related commands, press ENTER.
If you want to increase the number of command records saved, go to the. Bash_profile below to set the Histfilesize and histsize two parameters. (2) Move operation Ctrl + F: Move one character to the right Ctrl + B: Move one character to the left ESC + F: Move one word to the right ESC + B: Move one word to the left Ctrl + A: Jump to the beginning of the line Ctrl + E: Jump to the end of the row (3) Delete operation Ctrl + D : Delete the character under the cursor Ctrl + H: Delete a character Ctrl + U: Delete the current position character to the beginning of the line (without the character under the cursor) CTRL + K: Delete the current position character to the end of the row (contains the character under the cursor) CTRL + W: Delete the cursor to the beginning of the current word (4) command toggle CTRL + P: Find previous command CTRL + N: Find Next command
(5) Replacement
CTRL + T: replaces the current character of the cursor with one of the preceding characters
ALT + T: Swap two cursor at the current position of the word and the previous word of the cursor
ALT + U: capitalize the current position of the cursor in the word
ALT + L: Change the current position of the cursor to lowercase
ALT + C: Capitalize the first letter of a word in the current position of the cursor
(5) Other operations
Ctrl + Y: Insert recently deleted words
CTRL + C: Terminate operation
CTRL + Z: The current operation goes to the background
CTRL + L: Clear screen
CTRL +?: Undo Previous input
ALT + R: Undo Previous action
ALT + D: Delete the word after the cursor position
CTRL + ARROW key left cursor moves to the beginning of the previous word
CTRL + ARROW key right cursor moves to the end of the next word
CTRL + X jumps between the last character of the cursor and the character at which the current cursor is located
ALT + F jumps to the end of the word at the cursor position
CTRL + S: Lock the terminal
CTRL + Q: Unlocking the terminal
CTRL + C: Another line
CTRL + I: Tab-like full-complement function
CTRL + O: Repeating commands
Number of ALT + number key operations
!! : Executes the previous instruction repeatedly
!a: Repeat the previous one-led directive
!number: Repeat the previous instruction to record numbers in the history table
!-number: The first number of instructions before repeating
!$: Indicates that the last item in the previous command was obtained
You can view the man readline to get the binding settings for the default key in bash. A lot of content. Like alt-. (Note: The point) iterates over the parameters used in the previous command, alt-* expands the matching pattern of the parameters.
- Ways to view the current shell name
(1) Ps-p $$ or (2) echo "$"
- To view all the shell methods that the system has installed
Cat/etc/shells
- To change the method of the system shell, use the CHSH command
Modify the current system shell to change from bash to zsh:chsh-s/bin/zsh the other user's shell from bash to Ksh:sudo chsh-s/bin/ksh usernamehere
- Open Bash command to complement
Source/etc/bash_completion
Need to install ' most '; she will make Your Man handbook more colorful. sudo apt-get install mostexport pager=most It is recommended to configure the environment variable to do this requires modifying the/etc/profile or/etc/environment file, adding or modifying the following: PAGER = "/usr/bin/most-s" If only for a specific user, you only need to modify the ~/.BASHRC file.
- Two special variables for bash
In bash, there is a constant funcname, but one difference is that it is an array rather than a string, where the first element of the array is the name of the current function. Bash_source is also an array, but its first element is the name of the current script. This is useful when source, because in the script that is source, $ A is the name of the parent script, not the script name of the source. And Bash_source can be handy. # If The script is sourced by another scriptif [-n "$BASH _source"-a "$BASH _source"! = "$"]thendo_somethingelse # Other Wise, run directly in the Shelldo_otherfi Unfortunately, this practice will cause the script to lose some portability, because not all shells support these constants.
- Run the program in a clean bash/ksh/zsh environment
The syntax is as follows: Env-i your-program-name-here arg1 arg2 ... Example: set an environment variable syntax as follows: env Var=value/path/to/command arg1 arg2 ... # # or # # Var=value/path/to/command arg1 arg2 ...
If you do not know this command, I think you should thank me, because if you do not know, every time you enter a long list of commands to see "Permission denied" after the pain will certainly be unbearable. Sudo!! How to use sudo! Very simple. Imagine that you have just entered the following command: Apt-get Install Ranger will appear "Permission denied" unless you have logged in to an account with sufficient privileges. Sudo!! will run the previous command in the form of sudo. So the last command becomes this: sudo apt-get install Ranger
- Use Nohup to still run commands after logging out of an SSH session
The nohup command is really useful if you are using SSH to log on to other machines. So how do you use Nohup? Imagine that you telnet to another computer using SSH, you run a very time-consuming command and then quit the SSH session, but the command is still executing. And Nohup can turn this scene into a reality. For example, because of the need for testing, I sent my Raspberry Pi to download the release version. I will never give my Raspberry Pi an external monitor, keyboard, or mouse. Generally I always use SSH to connect to the Raspberry Pi from my laptop computer. If I use Raspberry Pi to download large files without nohup, I have to wait until the download is complete before I log out of my SSH session and turn off my notebook. But if so, why should I use the Raspberry Pi file? The method of using Nohup is also very simple, just enter the command to execute after nohup in the following example: Nohup wget http://mirror.is.co.za/mirrors/linuxmint.com/iso//stable/17.1/ Linuxmint-17.1-cinnamon-64bit.iso &
- Run the Linux command at a specific time (at)
The ' nohup ' command is useful when you are using SSH to connect to the server and keep the SSH logout task on top of it. Think about what to do if you need to execute the same command at a specific time? Command ' at ' to properly resolve the situation. The following are examples of ' at ' use. At 10:38 PM friat> cowsay ' Hello ' at> CTRL + D above command to run program Cowsay on Friday 10:38 P.M.. The syntax used is the append date time after ' at '. When the at> prompt appears, you can enter the command you want to run at that time. CTRL + D returns to the terminal. There are many date and time formats that require you to turn over the ' at ' manual to find more ways to use it.
- Use Htop to view and manage processes
Which command do you use to find out which processes are running on your computer? I bet it's ' ps ' and then add a different parameter to get the different output you want. Install ' Htop '! Absolutely Brief Encounter you. Htop renders the process as a list in the terminal, somewhat similar to Task Manager in Windows. You can use the combination of function keys to toggle the way you arrange and the items that are displayed. You can also kill the process directly in the htop. Simple input htop in the terminal can be run.
- Using Ranger to browse the file system
If Htop is a good helper for command-line Process Control, then Ranger is a good helper for the command line to browse the file system. You may need to install it before you use it, but once you install it, you can start her by typing the following command at the command line: Ranger in the Command-line window Ranger and some other file managers, but compared to the upper and lower structure layout, she is the left and right structure, This means that you press the LEFT ARROW key and you advance to the previous folder, while the right ARROW key switches to the next one. The Man manual Ranger before use is still worth reading, so you can use the shortcut key to operate the ranger.
- View process Usage Bandwidth-nethogs
Nethogs is a network traffic monitoring tool under a terminal that can visually display the bandwidth consumed by each process. Download: http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/download
Shell Terminal use