Using Bash Shell

本文介绍了BashShell的基础使用技巧,包括获取系统信息、设置个性化提示符、利用环境变量简化命令输入等。此外,还提供了如何管理和查看运行中的任务的方法。
Using Bash Shell

2/19 20:13:11 CST 2004
==============================

Get Your Information
    echo    display a line of text
    type    get the path of a command
    finger    user information lookup program
    pwd    print working directory

        [eg]    echo $SHELL
            finger -l username

Setup Your Shell
    Some important setup files are:
        /etc/profile
        /etc/bashrc
        ~/.bash_profile
        ~/.bashrc
        ~/.bash_logout
   
    You can setup prompt characers, add enviroment varialbes, and add alias.
        [eg]    alias p='pwd; ls -CF'
            alias rm='rm -i'

    By default, the bash shell command line editor is based on emacs. If you want to use vi as the command line editor, you need only add the follow statement in the .bashrc file:
        set -o vi

    Some examples of using enviromental variables:
        [eg]    AB=/usr/dog; export AB
            cd $AB
        [example:]    export PATH=$PATH:/home/xyz
    You can use "unset" command to cancel an enviromental variable.

Command History
    Command history is stored in .bash_history file. Commands are:
        history
        !n
        !!
        !?string?

        fc     using text editor to edit history command.

Some Special Characters
    #
    &    running in background
    '    [eg]    alias dir='ls-al'

    *
    ?
    [ and ]
    -
    !
    /

        [eg]    ls [xyz]*
            ls *[!0-9]
    .
    ..
    ;    seperate several commands
        [eg]    date; troff -me largedoc | lpr; date
   
    >
    >>
    |    [eg]    cat /etc/password | sort | more

    ~    home direcroty
    @
    $


    $(command)
    'command'    treat the command output as arguments of another command.
            [eg]    vi $(find /home -print | grep xyzzy)


Manage Running Jobs
    Programs can running background or foreground.

    &
    at
    Ctrl+z    pause running program
    Ctrl+c    cancel running program
   
    fg    [eg]    fg %5
    bg    resume suspended job background

    jobs    list the programs running background
    ps

        [eg]    pasue the running program, and make it running background:
                find / -name SCSI -print
                Ctrl+z
                bg
           
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值