zoukankan      html  css  js  c++  java
  • MAC终端配置

    高亮

    针对terminal采用bash模式:

    1. 编辑 ~/.bash_profile, 加入以下代码:
      export CLICOLOR=1
      export LSCOLORS=gxfxaxdxcxegedabagacad
    2. 保存,然后重启terminal,搞定,恢复正常了(或者source ~/.bash_profile)

    详细讲解代码中的涵义:

    1. CLICOLOR: 前景色和背景色的字符串合并值
    2. LSCOLORS: 对于不同变量所采用的颜色方案,具体看如下表格:
      a       black
      b       red
      c       green
      d       brown
      e       blue
      f        magenta
      g      cyan
      h       light grey
      A      bold black, usually shows up as dark grey
      B       bold red
      C      bold green
      D      bold brown, usually shows up as yellow
      E       bold blue
      F       bold magenta
      G     bold cyan
      H      bold light grey; looks like bright white
      x       default foreground or background
      而文件类型列表如下:
      1. directory
      2. symbolic link
      3. socket
      4. pipe
      5. executable
      6. block special
      7. character special
      8. executable with setuid bit set
      9. executable with setgid bit set
      10. directory writable to others, with sticky bit
      11. directory writable to others, without sticky

    所以对照这张表就可以得知:

    gxfxaxdxcxegedabagacad

    就是对于directory而言,它的前景色就是: g(cyan),而背景色就是:x(默认的背景色).

    自动补全忽略大小写

    打开终端,输入:

    nano .inputrc


    在里面粘贴上以下语句:

    set completion-ignore-case on
    set show-all-if-ambiguous on
    TAB: menu-complete


    Control+O,保存,重启终端

    SSH

    在Mac OS的终端(terminal)中,可以使用命令 ssh user@host 的命令来远程连接一台服务器,但是,如果要管理的服务器太多,IP地址不能全部记住的时候怎么办?这时候我们可以为每一台服务器设置一个别名(alias),使用vim命令编辑一下 ~/.ssh/config 这个文件(如果目录下没有这个文件,可以新建一个),接着按下面格式添加内容:

    Host 别名
        HostName IP地址
        Port 22
        User 用户名

    另外,如果想查看当前有哪些配置了别名的服务器,可以使用命令cat ~/.ssh/config | grep "Host"

  • 相关阅读:
    【NYOJ】[168]房间安排
    【NYOJ】[168]房间安排
    【POJ】[3253]Fence Repair
    【POJ】[3253]Fence Repair
    【杭电】[2111]Saving HDU
    【杭电】[2111]Saving HDU
    【杭电】[3635]Dragon Balls
    【杭电】[3635]Dragon Balls
    [leetcode]159. Longest Substring with At Most Two Distinct Characters至多包含两种字符的最长子串
    [leetcode]3. Longest Substring Without Repeating Characters无重复字母的最长子串
  • 原文地址:https://www.cnblogs.com/shengxinjack/p/7890319.html
Copyright © 2011-2022 走看看