2010年12月1日 星期三

debian linux bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
PS1='[\[\e[1;31m\]\u@\[\e[1;33m\]\h \[\e[1;32m\]\W\[\e[0m\]]\[\033[1;36m\]\A\[\033[0m\]\$ '
PATH=$PATH:/toolchain/rsdk/linux/
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

example output of PS1:
[root@debian-u5a ~]10:54# 



linux bash reference artical
http://web.mit.edu/gnu/doc/html/features_1.html

3 則留言:

  1. bash彩色的ps1+ exit code變顏色

    https://blog.gtwang.org/linux/how-to-make-a-fancy-and-useful-bash-prompt-in-linux-1/
    https://stackoverflow.com/questions/43015463/how-to-change-bash-prompt-color-based-on-exit-code-of-last-command

    smiley()
    {
    if [ "$?" == "0" ]; then
    echo -e '\e[0;32m:)$ \e[0m'
    else
    echo -e '\e[0;31m:($ \e[0m'
    fi
    }
    PSa="${debian_chroot:+($debian_chroot)}[\[\033[01;31m\]\u@\[\033[01;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]]\[\033[1;36m\]\A\[\033[00m\]"
    PS1="$PSa"'`smiley`'

    回覆刪除
  2. zsh PROMPT

    PROMPT='[${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[yellow]%} %T{$reset_color%}$ '


    PROMPT='[${ret_status}%{$fg[magenta]%}%n@%{$fg[red]%}%m %{$fg[cyan]%}%c%{$reset_color%}]%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[yellow]%} %T%{$reset_color%}$ '



    [username@host]-[short-directory-path]-[time]$

    export PROMPT='[${ret_status}%{$fg[magenta]%}%n@%{$fg[red]%}%m]-[%{$fg[cyan]%}%c%{$reset_color%}]%{$fg_bold[blue]%}-[%T]%{$reset_color%}$ '


    export PROMPT='[${ret_status}%{$fg[magenta]%}%n@%{$fg[red]%}%m]-[%{$fg[cyan]%}%c%{$reset_color%}]%{$fg_bold[blue]%}-[%T]%{$reset_color%}$ '




    https://attilaolah.eu/2014/05/12/a-simple-but-powerful-zsh-prompt/

    https://medium.com/statementdog-engineering/prettify-your-zsh-command-line-prompt-3ca2acc967f
    超簡單!十分鐘打造漂亮又好用的 zsh command line 環境


    https://superuser.com/questions/49092/how-to-format-the-path-in-a-zsh-prompt
    I would love to have a readable colored path. For example, instead of simply using %~ to return ~/path/to/foo I would like to format it to ~$RED/$NOCOLORpath$RED/$NOCOLORto$RED/$NOCOLORfoo to highlight the path separators.


    https://unix.stackexchange.com/questions/330149/how-to-have-a-custom-command-prompt-in-zsh/


    https://www-s.acm.illinois.edu/workshops/zsh/prompt/escapes.html
    http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html

    https://unix.stackexchange.com/questions/331341/how-to-set-dd-mm-yy-for-command-prompt-in-zsh


    https://orrsella.com/2013/10/08/zsh-promp-format-with-date-time-and-current-directory/



    http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/


    https://github.com/robbyrussell/oh-my-zsh/issues/5686

    how to enable username and hostname in the default theme? #5686


    https://unix.stackexchange.com/questions/209390/how-to-set-hostname-in-zsh
    How to set HOSTNAME in zsh?


    http://www.nparikh.org/unix/prompt.php
    Customizing your shell prompt


    https://unix.stackexchange.com/questions/210643/how-to-edit-shell-prompt-to-show-time

    https://superuser.com/questions/943844/add-timestamp-to-oh-my-zsh-robbyrussell-theme/943916


    https://superuser.com/questions/413073/windows-console-with-ansi-colors-handling
    ANSI colors handling

    回覆刪除
  3. https://stackoverflow.com/questions/15936003/for-each-dir-create-a-tar-file


    find . -type d -maxdepth 1 -mindepth 1 -exec tar zcvf {}.tar.gz {} \;

    將各別的目錄 tar起來 壓縮成各自tar.gz檔案

    回覆刪除