Efficient linux Command Line operations

Source: Internet
Author: User

Linux Command Line efficient Operation Method Introduction: it is very difficult for beginners to operate the linux system on the text interface. However, if you have mastered some methods, the linux operation efficiency in the command line is much higher than that in the Desktop linux system. Next we will briefly describe the efficient operations in the command line from the following aspects. 1. Directory switch common directory switch command: cd. If frequent switch is performed under several directories, cd is very cumbersome. Of course, if the switch is between two directories, you can try this command: cd-, if there are more than three directories to switch back and forth, you can try the following command group. Pushd: this command is usually used to add a directory to the stack, add a record to the top of the Directory stack, and switch to this directory. If the pushd command does not add any parameters, the two directories at the top of the record Stack are switched to dirs: this command is used to view the directory information in the current stack. For example, the current/home directory contains three sub-directories (dir1, dir2, dir3). Now you need to switch back and forth between these three directories through pushd, [root @ localhost home] # pushd dir1 # The dir1 directory is added to the stack and switched to the dir1 directory/home/dir1/home ~ [Root @ localhost dir1] # dirs-v # view the directory saved in the current stack by serial number 0/home/dir1 1/home [root @ localhost dir1] # pushd/home/dir2 # The dir2 directory will be added to the stack, switch to the dir2 directory/home/dir2/home/dir1/home [root @ localhost dir2] # pushd/home/dir3 # The dir3 directory will be added to the stack, switch to the dir3 directory/home/dir3/home/dir2/home/dir1/home [root @ localhost dir3] # dirs-v # view the saved directory in the current stack by serial number 0/ home/dir3 1/home/dir2 2/home/dir1 3/home [root @ localhost dir3] # pushd + 1 # + 1 is dirs life Order the serial number listed, by using this serial number, you can switch the directory to dir2/home/dir2/home/dir3 [root @ localhost dir2] #2. Common shortcut key operation Ctrl +: move the cursor to the beginning of the line. Ctrl + e: move the cursor to the end of the row. Ctrl + l: Clear the terminal. This shortcut works the same as typing clear in the command line. Ctrl + d: log out and close from the Shell prompt. You do not need to enter exit when using this shortcut key. Ctrl + u: Clear the current row. If you work under the command line, use this shortcut to clear the characters from the cursor to the beginning of the line. Ctrl + Alt + Fn: Switch the screen. Ctrl + Alt + one of the function keys will display a new screen. According to the default settings, from F1 to F6 is the Shell prompt screen. Ctrl + K: delete all characters from the cursor to the end of the line. 3. Use history commands to save history commands: In the current user directory. clear history commands in the bash_history file: history-c history command update: bash does not immediately write the command name into the history file when executing the command, but stores it in the internal buffer, when bash exits, It will be written together. However, you can call the 'History-W' command to require bash to update the history file immediately. Ctrl + r search Command: A Shortcut Key commonly used by Ctrl + R. This shortcut allows you to search for command history, which is useful when you want to execute a command repeatedly. After finding the command, you can usually press the Enter key to execute the command. If you want to adjust the command and then execute it, you can click the left or right arrow keys. "!" Command: Specify the keyword to execute the most recently executed command 4. command line auto-completion: TAB key

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.