Chinaunix首页 | 论坛 | 博客
  • 博客访问: 867689
  • 博文数量: 179
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1546
  • 用 户 组: 普通用户
  • 注册时间: 2015-01-27 11:05
个人简介

MySQL工程师 QQ:1815357042

文章分类

全部博文(179)

文章存档

2015年(179)

分类: LINUX

2015-02-02 16:16:58

提示:
.bashrc 前面有一个点的是隐藏文件!

用到的快捷键

tab 自动补齐(有不知道的吗)

ctrl+a 移动到当前行的开头(a ahead)

ctrl+u 删除(剪切)此处至开始所有内容

 

vim

末行模式下

:ser nu 然后  直接输入行号

编辑模式下

其中i是将其后输出的字符插入到当前光标位置之前。命令I是将其后输入的字符插入到当前光标所在行的行首

其中命令a是将其后输入的字符插入到当前光标位置之后,而命令A则是将其后输入的字符追加到当前光标所在行的行尾

命令模式下

u 撤销上一次操作

GG 光标快速回到文件底部

o 在光标所在行的下一行行首并进入编辑模式 
在光标前进入编辑模式

在命令模式下     按住shift +两次z 保存并退出

 

相关命令


显示隐藏文件
  1. ls -a



通常输入路径时,打错一两个字,就会出现错误信息,CentOS提供了一个小技巧,不过这个技巧不是万能的,只限于一两个字母路径打错,系统就会自动调整,其实系统也是根据输入的路径与相应目录比对,然后修正
两种都是在最后一行添加

  1. shopt -s cdspell



只对当前session有效

  1. vim ~/.bashrc



对全局永久有效

  1. ls /etc/ |grep bash
  2. vim /etc/bashrc
修改完后需要保存退出,并重新登录才会生效


  1. # /etc/bashrc

  2. # System wide functions and aliases
  3. # Environment stuff goes in /etc/profile

  4. # It's NOT a good idea to change this file unless you know what you
  5. # are doing. It's much better to create a custom.sh shell script in
  6. # /etc/profile.d/ to make custom changes to your environment, as this
  7. # will prevent the need for merging in future updates.

  8. # are we an interactive shell?
  9. if [ "$PS1" ]; then
  10.   if [ -z "$PROMPT_COMMAND" ]; then
  11.     case $TERM in
  12.     xterm*)
  13.         if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
  14.             PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
  15.         else
  16.             PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
  17.         fi
  18.         ;;
  19.     screen)
  20.         if [ -e /etc/sysconfig/bash-prompt-screen ]; then
  21.             PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
  22.         else
  23.             PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
  24.         fi
  25.         ;;
  26.     *)
  27.         [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
  28. "/etc/bashrc" 86L, 2681C 1,1 Top
  29.                 fi
  30.         esac
  31.     }

  32.     # By default, we want umask to get set. This sets it for non-login shell.
  33.     # Current threshold for system reserved uid/gids is 200
  34.     # You could check uidgid reservation validity in
  35.     # /usr/share/doc/setup-*/uidgid file
  36.     if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
  37.        umask 002
  38.     else
  39.        umask 022
  40.     fi

  41.     # Only display echos from profile.d scripts if we are no login shell
  42.     # and interactive - otherwise just process them to set envvars
  43.     for i in /etc/profile.d/*.sh; do
  44.         if [ -r "$i" ]; then
  45.             if [ "$PS1" ]; then
  46.                 . "$i"
  47.             else
  48.                 . "$i" >/dev/null 2>&1
  49.             fi
  50.         fi
  51.     done

  52.     unset i
  53.     unset pathmunge
  54. fi
  55. # vim:ts=4:sw=4

输入错误路径
  1. cd /ect
会自动修正


长路径也是没有问题的

  1. cd /ect/sysconfig/






阅读(1001) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~