Shell Introduction, Command history, command completion and aliases, wildcard characters, input and output redirection

Source: Internet
Author: User
Tags aliases

Shell Introduction

The shell is a command interpreter that provides interaction between the user and the machine, supports specific grammars, such as logical judgments, loops, and each user can have their own specific shell

CentOS7 default shell is bash (Bourne Agin Shell)

and zsh, Ksh and so on.



Command history

View history Commands

[email protected] ~]# cat. bash_history

Modify History Bar Number:

Vi/etc/profile

histsize=1000

To modify the format of viewing history:

New in/etc/profile:

histtimeformat= "%y/%m/%d%h:%m:%s"

Source/etc/profile

841 2017/10/20 06:01:05 Vi. bash_history

842 2017/10/20 06:02:03 Vi/etc/profile

843 2017/10/20 06:03:23 Source/etc/profile

844 2017/10/20 06:03:27 History


Add Permission control:

[Email protected] ~]# chattr +a. bash_history

[Email protected] ~]# > Bash_history

-bash:. Bash_history:operation not permitted


!! : Indicates the execution of the previous command

! 844: Represents a command that executes 844 rows

!his: Represents the command that executes the start of his, which is the last executed


Command completion and aliases

1.Tab Completion

2, Parameter Complete installation bash-completion

Alias aliases

[email protected] ~]# alias wo= ' Ls/root ' #临时有效

[email protected] ~]# wo

2.txt 2.txt.bz2 anaconda-ks.cfg


Permanently valid:

[Email protected] ~]# Vi. BASHRC


#. BASHRC


# User specific aliases and functions


Alias wo= ' Ls/root '


Wildcard characters

1, [[email protected] ~]# ls *.txt

2.txt David.txt

2.

[email protected] ~]# ls?. Txt

2.txt

[email protected] ~]# ls??. Txt

23.txt

[[email protected] ~]# ls [0-9].txt

2.txt

[[email protected] ~]# ls [0-9][0-9].txt

23.txt

[[email protected] ~]# ls {2,23}.txt

23.txt 2.txt

Redirect:

Cat 1.txt >2.txt

Cat 1.txt >> 2.txt

[[email protected] ~]# cat 23.txt >> 2.txt &>/dev/null


This article is from the "Discover new things" blog, make sure to keep this source http://shenj.blog.51cto.com/5802843/1978471

Shell Introduction, Command history, command completion and aliases, wildcard characters, input and output redirection

Related Article

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.