GuruNet's profileGuru_Net's BlooooogPhotosBlogLists Tools Help

Blog


    April 09

    BASH笔记【摘自肥肥世家】

    1.BASH初始化环境文件查找顺序
    /etc/profile (初始化系统级别环境)------> $HOME/.bash_profile---------->.bashrc文件

    2.一些常用的环境变量
    $LOGNAME $HOME $PATH $TZ $MAILCHECK $PS1 $PS2 $PWD

    3.后台运行 & ,查看后台运行的命令 jobs

    4.常用的控制键
    Ctrl_C 中止当前命令
    Ctrl_D 输入结束
    Ctrl_\ 若Ctrl_C无效,则中止当前命令
    Ctrl_S 禁止屏幕输出
    Ctrl_Q 开启屏幕输出
    DEL或Ctrl_?删除最后的字符(不知为啥Ctrl_?在我的debian下无效:( )
    Ctrl_U 删除整行
    Ctrl_Z 暂停当前命令

    5.用户环境配置
    1> .bash_profile  .bashrc  .bash_logout
       以上3个是bash shell的用户配置文件,位于用户的主目录下。其中的.bash_profile是最重要的一个配置文件,它在用户每次登录系统时被读取,里面的所有命令都会被bash执行。.profile(由Bourne Shell 和 Korn Shell使用)和.login(由C Shell使用)两个文件是.bash_profile的同义词。
    2> .bashrc文件会在shell调用另一个shell时读取,也就是在shell中再键入bash命令启动一个新shell时就会去读该文件,但一般都会在.bash_profile里调用.bashrc脚本以便统一配置用户环境。
    3> .bash_logout在退出shell时被读取,可以做一些清理工作。
    4> /etc目录的bash.bashrc和profile是系统级的配置文件,当在用户主目录下找不到.bash_profile和.bashrc时,就会读取该两个文件,.bash_history是bash shell的历史记录文件,里面记录了你在bash shell中输入的所有命令,可通过HISSIZE环境变量设置在历史记录文件里保存的记录条数。
       当我们修改了这些配置文件后,可以用source .bash_profile使修改内容马上生效.


                                                 ----------Edited by Gvim 7.0

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://gurunets.spaces.live.com/blog/cns!26589C6386DA9C55!167.trak
    Weblogs that reference this entry
    • None