Linux/2-Config/bashrc: Difference between revisions

From Wiki
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
== ~/.bashrc ==
== Ubuntu 20.04 ==
* ~/.bashrc
<blockquote>
<pre>
-
</pre>
</blockquote>


* color + root/username
* /root/.bashrc
<blockquote>
<blockquote>
<pre>
<pre>
if [ "$color_prompt" = yes ]; then
force_color_prompt=yes     # uncomment
    if [[ ${EUID} == 0 ]] ; then
 
        PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[01;34m\] \W \$\[\033[00m\] '              # <- changes
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    else
 
        PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
  # change first "32m" to "31m"
    fi
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h \w \$ '
fi
</pre>
</pre>
</blockquote>
</blockquote>


 
== ~/.bash_aliases ==
* systemctl without page breaks
<blockquote>
<blockquote>
<pre>
<pre>
alias systemctl='systemctl --no-pager'
touch .bash_aliases
</pre>
</pre>
</blockquote>
</blockquote>


== /etc/bash.bashrc ==
* systemctl without page breaks
* autocomplete (uncomment to activate)
<blockquote>
<blockquote>
<pre>
<pre>
# enable bash completion in interactive shells
alias systemctl='systemctl --no-pager'
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
</pre>
</pre>
</blockquote>
</blockquote>
[[Category:Linux/CheatSheet]]
[[Category:Linux]]

Latest revision as of 14:26, 16 October 2020

Ubuntu 20.04

  • ~/.bashrc
-
  • /root/.bashrc
force_color_prompt=yes     # uncomment

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

  # change first "32m" to "31m"

~/.bash_aliases

touch .bash_aliases
  • systemctl without page breaks
alias systemctl='systemctl --no-pager'