zoukankan      html  css  js  c++  java
  • Bash shell的特性

    bash的特性




    命令补全


    Tab键

    ​ 命令补全

    ​ 路径补全

    ​ 选项补全

    ​ yum install -y bash-completion

    ​ -长格式

    ​ --all

    ​ -短格式

    ​ -a


    快捷键


    ctrl + a 光标到行首

    ctrl + e 光标到行尾

    ctrl + w 删除光标右边一组字符

    ctrl + c 终止当前的命令

    ctrl + l 清屏(clear)

    ctrl + r 查找最近一次的命令

    ctrl + d 退出当前的bash,登出

    ctrl + z 把当前运行程序拿到后台运行,fg 回来。

    ctrl + k 删除/剪切 光标左边的作用

    ctrl + u 删除/剪切 光标右边的内容

    ctrl + y 粘贴

    ctrl + s 锁定终端

    ctrl + q 解锁

    ctrl + ← 向左移动一组字符

    esc + . 上一个命令最后一个空格后的内容

    '#' 注释


    历史命令


    history 显示命令

    ​ -c 清除历史命令

    ​ -d 4 删除记录的第四条命令

    ​ -w 保存历史命令,保存在: ~/.bash_history

    ​ ! 直接执行历史命令中匹配得最近的那一个。

    ​ !! 执行上一条命令

    ​ 历史命令记录,一般用于日志审计。

    vim /etc/profile
    
    USER_IP=`who -u am i 2>/dev/null | awk '{print $NF}' | sed -e 's/[()]//g'`
    if [ "$USER_IP" = "" ]
    then
    USER_IP=`hostname`
    fi
    export HISTTIMEFORMAT="%F | %T | 用户IP: $USER_IP | 操作用户: `whoami` |操作命令: "
    shopt -s histappend
    export PROMPT_COMMAND="history -a"
    
    source /etc/profile		#生效
    

    命令别名


    ​ 将命令简单化处理

    查
    [root@localhost ~]#alias		#查看别名
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    
    增,改
    [root@localhost ~]#alias vi='vim'		#设置别名,临时生效
    永久生效:
    vi ~/.bashrc
    	添加内容
    alias wk='vim /etc/sysconfig/network-scripts/ifcfg-eth0'
    
    删
    [root@localhost ~]#unalias vi				#取消别名
    

    获取帮助


    1、命令 --help
    	ls --help
    2、man 命令
    	ls
    
  • 相关阅读:
    PAIRING WORKFLOW MANAGER 1.0 WITH SHAREPOINT 2013
    Education resources from Microsoft
    upgrade to sql server 2012
    ULSViewer sharepoint 2013 log viewer
    Top 10 Most Valuable Microsoft SharePoint 2010 Books
    讨论 Setsockopt选项
    使用 Alchemy 技术编译 C 语言程序为 Flex 可调用的 SWC
    Nagle's algorithm
    Nagle算法 TCP_NODELAY和TCP_CORK
    Design issues Sending small data segments over TCP with Winsock
  • 原文地址:https://www.cnblogs.com/gshelldon/p/13268378.html
Copyright © 2011-2022 走看看