• shell下快捷键


    ### 1.快捷键

    • ^C   终止前台运行的程序
    • ^D   退出 等价于exit
    • ^L   清屏
    • ^A   光标移动到命令行的最前端
    • ^E   光标移动到命令行的最后端
    • ^U   删除光标前所有字符
    • ^K   删除光标后所有字符
    • ^R   搜索历史命令,利用关键词
    • Alt+.  引用上一个命令的最后一个参数
    • ESC . 引用上一个命令的最后一个参数

    2.历史命令

    • history
    • 光标上下键
    • ^R
    • !220   此命令要结合history
        335  ll Desktop
        336  ll Downloads
        337  cat asd
        338  asd
        339  ssh root@192.168.85.163~ !335~ ll Desktop
    • !$ 获取上个命令的参数
      ➜  ~ ll  Desktop
      total 2936
      drwxr-xr-x  3 guanbinbin  staff    96B  9  4 23:15 Tunnelblick VPN 配置样本
      -rw-r--r--@ 1 guanbinbin  staff    36K  6 23 23:13 th.jpeg
      -rw-r--r--@ 1 guanbinbin  staff   260B  6 17 23:20 学习目录
      -rw-r--r--@ 1 guanbinbin  staff   710K  6 16 12:40 屏幕快照 2019-06-16 下午12.40.54.png
      -rw-r--r--@ 1 guanbinbin  staff   710K  6 16 12:41 屏幕快照 2019-06-16 下午12.41.02.png
      -rw-r--r--@ 1 guanbinbin  staff   143B  6 16 20:41 学习目录的副本
      ➜  ~ !$
      ➜  ~ Desktop

    3.别名

       1.使用alilas可以查看当前那些命令使用了别名

    [root@Server-n93yom ~]# alias
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias grep='grep --color=auto'
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias mv='mv -i'
    alias rm='rm -i'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
    [root@Server-n93yom ~]#

    在当前shell中起一个别名,打开tmp文件夹

    [root@Server-n93yom ~]# alias binbin='cd /tmp'     # unalias取消别名
    [root@Server-n93yom ~]# binbin
    [root@Server-n93yom tmp]#

     但是此命令在关闭shell后会失效;

    2. 若想永久有效,需要在/etc/bashrc文件中添加,此别名

        

  • 相关阅读:
    设计模式java----单例模式
    创建三个线程按顺序输出1-60,每个线程输出5个数
    java笔记----线程状态转换函数
    java笔记----常见的异常
    java一个数分解的质因数java
    MapReduce ----数据去重
    MapReduce ----倒排索引
    报错org.apache.hadoop.mapreduce.lib.input.FileSplit cannot be cast to org.apache.hadoop.mapred.FileSplit
    NumPy的使用(一)
    python----csv的使用
  • 原文地址:https://www.cnblogs.com/guanbin-529/p/11504207.html
Copyright © 2020-2023  润新知