Linux basic commands: Bash, history

Source: Internet
Author: User
Tags clear screen

1, Bash effect Introduction:

1. Command history

2, Pipeline, redirect

3. Command aliases

4. Command line editing

5. Command line expansion

6. File name Wildcard

7. Variables

8. Programming

2. Command line editing:

cursor Jump:

CTRL + A: Skip to the beginning of the command

Ctrl+e: Jump to the end of the command line

Ctrl+u: Delete the cursor to the beginning of the command line

CTRL+K: Delete the cursor to the end of the command line

Ctrl+l: Clear Screen

3. Command history:

Introduction to the History command:

View command history, default command history buffer is 1000 commands

1 . command format:

History [OPTION] ...

History followed by parameters and

2 . Command function:

View Historical Input Commands

3 . Command parameters:

-C: Empty command history

-D offset [n]: Delete command at specified position

-W: Save the Command history to the history file

4 . The use of command history tips :

!n : executes the nth command in the command history

!-n: Executes the last nth command in the command history

!! : Executes the previous command

String: Executes the last command in the command history to give the beginning of a string port

!$: Reference the last parameter of the previous command

Press the ESC key to release and then press.: reference the last parameter of the previous command

5 . Command instance:

1, history-d 3 Delete the 3rd command

[Email protected] ~]# history

1 VIM/ETC/VIMRC

2 Ifconfig

3 Vim/etc/sysconfig/network-scripts/ifcfg-eth0

4 vim/etc/resolv.conf

5 ifconfig eth0 up

[Email protected] ~]# history-d 3

[Email protected] ~]# history

1 VIM/ETC/VIMRC

2 Ifconfig

3 vim/etc/resolv.conf

4 Service Network restart

2, history-d 5 3 delete from 5th command after 3 command

[Email protected] ~]# history

1 VIM/ETC/VIMRC

2 Ifconfig

3 Vim/etc/sysconfig/network-scripts/ifcfg-eth0

4 vim/etc/resolv.conf

5 ifconfig eth0 up

6 Service Network restart

7 Ping 10.109.131.131

[Email protected] ~]# history-d 5 3

[Email protected] ~]# history

1 VIM/ETC/VIMRC

2 Ifconfig

3 Vim/etc/sysconfig/network-scripts/ifcfg-eth0

4 vim/etc/resolv.conf

5 Service Network Restart

6 Ping 10.109.131.131

7 Ifconfig

3.!4 View the 4th command in the history command     

[[email protected] ~]#! 4

Vim/etc/resolv.conf


This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1860193

Linux basic commands: Bash, history

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.