https://redirect.cs.umbc.edu/systems/api.php?action=feedcontributions&user=Ii69854&feedformat=atomCSEE Documentation - User contributions [en]2024-03-28T10:46:02ZUser contributionsMediaWiki 1.35.13https://redirect.cs.umbc.edu/systems/index.php?title=.bashrc&diff=5549.bashrc2024-02-27T19:37:21Z<p>Ii69854: Remove cleanup tag</p>
<hr />
<div>A .bashrc or .bash_profile file contains settings that are applied to non-interactive or interactive shells respectively. All the things described in this document are applicable to both, so it's reasonable to create only one and symlink the other one to it (or include it by saying something like <tt>. ~/.bashrc</tt> in your <tt>.bash_profile</tt>).<br />
<br />
==Simple things==<br />
===Setting the PATH===<br />
It's often nice to have more binaries directly accessible in your PATH environment variable. To do this, I use the following settings:<br />
<br />
<br />
<br />
export PATH=/usr/site/bin:/usr/sbin:/usr/bin:/usr/local/bin:/bin<br />
<br />
<br />
if [ "$LOGNAME" = "root" ]; then<br />
export PATH=$PATH:/sbin<br />
fi<br />
<br />
===Changing the prompt===<br />
Having a colored prompt can be helpful to notice quickly where the prompt is in a long listing of output, and having a reminder who you are logged in as and where you are never hurts. To accomplish this, I use the following prompt:<br />
export PS1="\[\033[34m\]\u\[\033[0m\]@\[\033[32m\]\h\[\033[0m\]:\[\033[31m\]\w\[\033[0m\]\\$ "<br />
<br />
This translates to a comman dprompt that looks like the following. <br />
<br />
[[File:Command prompt.png|alt=ii69854@aerial:~$]]<br />
<br />
This format has the advantage of being usable by <tt>scp</tt>; if you have to copy a file from that directory onto another machine, you can copy/paste the whole string into your <tt>scp</tt> command.<br />
<br />
===Changing the terminal name===<br />
Setting the name of the terminal is reflected in the title bar in gnome-terminal, or with a similar mechanism for other terminals (or GNU screen). I use the following settings:<br />
case $TERM in<br />
xterm*)<br />
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'<br />
;;<br />
screen*)<br />
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'<br />
;;<br />
*)<br />
;;<br />
esac<br />
<br />
This will give a title that looks like<br />
<br />
username@hostname:~/Documents<br />
<br />
===Changing your default pager===<br />
If you are on a sufficiently old system, the outdated pager <tt>more</tt> is used. You may want to set the pager to <tt>less</tt> instead.<br />
export PAGER=less</div>Ii69854https://redirect.cs.umbc.edu/systems/index.php?title=.bashrc&diff=5548.bashrc2024-02-27T19:36:50Z<p>Ii69854: </p>
<hr />
<div>{{Cleanup}}<br />
<br />
A .bashrc or .bash_profile file contains settings that are applied to non-interactive or interactive shells respectively. All the things described in this document are applicable to both, so it's reasonable to create only one and symlink the other one to it (or include it by saying something like <tt>. ~/.bashrc</tt> in your <tt>.bash_profile</tt>).<br />
<br />
==Simple things==<br />
===Setting the PATH===<br />
It's often nice to have more binaries directly accessible in your PATH environment variable. To do this, I use the following settings:<br />
<br />
<br />
<br />
export PATH=/usr/site/bin:/usr/sbin:/usr/bin:/usr/local/bin:/bin<br />
<br />
<br />
if [ "$LOGNAME" = "root" ]; then<br />
export PATH=$PATH:/sbin<br />
fi<br />
<br />
===Changing the prompt===<br />
Having a colored prompt can be helpful to notice quickly where the prompt is in a long listing of output, and having a reminder who you are logged in as and where you are never hurts. To accomplish this, I use the following prompt:<br />
export PS1="\[\033[34m\]\u\[\033[0m\]@\[\033[32m\]\h\[\033[0m\]:\[\033[31m\]\w\[\033[0m\]\\$ "<br />
<br />
This translates to a comman dprompt that looks like the following. <br />
<br />
[[File:Command prompt.png|alt=ii69854@aerial:~$]]<br />
<br />
This format has the advantage of being usable by <tt>scp</tt>; if you have to copy a file from that directory onto another machine, you can copy/paste the whole string into your <tt>scp</tt> command.<br />
<br />
===Changing the terminal name===<br />
Setting the name of the terminal is reflected in the title bar in gnome-terminal, or with a similar mechanism for other terminals (or GNU screen). I use the following settings:<br />
case $TERM in<br />
xterm*)<br />
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'<br />
;;<br />
screen*)<br />
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'<br />
;;<br />
*)<br />
;;<br />
esac<br />
<br />
This will give a title that looks like<br />
<br />
username@hostname:~/Documents<br />
<br />
===Changing your default pager===<br />
If you are on a sufficiently old system, the outdated pager <tt>more</tt> is used. You may want to set the pager to <tt>less</tt> instead.<br />
export PAGER=less</div>Ii69854https://redirect.cs.umbc.edu/systems/index.php?title=.bashrc&diff=5547.bashrc2024-02-27T19:35:32Z<p>Ii69854: Added an image for the command prompt</p>
<hr />
<div>{{Cleanup}}<br />
<br />
A .bashrc or .bash_profile file contains settings that are applied to non-interactive or interactive shells respectively. All the things described in this document are applicable to both, so it's reasonable to create only one and symlink the other one to it (or include it by saying something like <tt>. ~/.bashrc</tt> in your <tt>.bash_profile</tt>).<br />
<br />
==Simple things==<br />
===Setting the PATH===<br />
It's often nice to have more binaries directly accessible in your PATH environment variable. To do this, I use the following settings:<br />
<br />
<br />
<br />
export PATH=/usr/site/bin:/usr/sbin:/usr/bin:/usr/local/bin:/bin<br />
<br />
<br />
if [ "$LOGNAME" = "root" ]; then<br />
export PATH=$PATH:/sbin<br />
fi<br />
<br />
===Changing the prompt===<br />
Having a colored prompt can be helpful to notice quickly where the prompt is in a long listing of output, and having a reminder who you are logged in as and where you are never hurts. To accomplish this, I use the following prompt:<br />
export PS1="\[\033[34m\]\u\[\033[0m\]@\[\033[32m\]\h\[\033[0m\]:\[\033[31m\]\w\[\033[0m\]\\$ "<br />
<br />
This translates to a comman dprompt that looks like the following. <br />
<br />
[[File:Command prompt.png|alt=ii69854@aerial:~$]]<br />
<br />
This format has the advantage of being usable by <tt>scp</tt>; if you have to copy a file from that directory onto another machine, you can copy/paste the whole string into your <tt>scp</tt> command.<br />
<br />
===Changing the terminal name===<br />
Setting the name of the terminal is reflected in the title bar in gnome-terminal, or with a similar mechanism for other terminals (or GNU screen). I use the following settings:<br />
case $TERM in<br />
xterm*)<br />
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'<br />
;;<br />
screen*)<br />
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'<br />
;;<br />
*)<br />
;;<br />
esac<br />
<br />
===Changing your default pager===<br />
If you are on a sufficiently old system, the outdated pager <tt>more</tt> is used. You may want to set the pager to <tt>less</tt> instead.<br />
export PAGER=less</div>Ii69854https://redirect.cs.umbc.edu/systems/index.php?title=File:Command_prompt.png&diff=5546File:Command prompt.png2024-02-27T19:32:00Z<p>Ii69854: An picture for the .bashrc which displays what the given prompt looks like.</p>
<hr />
<div>== Summary ==<br />
An picture for the .bashrc which displays what the given prompt looks like.</div>Ii69854https://redirect.cs.umbc.edu/systems/index.php?title=.bashrc&diff=5545.bashrc2024-02-27T19:21:13Z<p>Ii69854: /* Changing the prompt */</p>
<hr />
<div>{{Cleanup}}<br />
<br />
A .bashrc or .bash_profile file contains settings that are applied to non-interactive or interactive shells respectively. All the things described in this document are applicable to both, so it's reasonable to create only one and symlink the other one to it (or include it by saying something like <tt>. ~/.bashrc</tt> in your <tt>.bash_profile</tt>).<br />
<br />
==Simple things==<br />
===Setting the PATH===<br />
It's often nice to have more binaries directly accessible in your PATH environment variable. To do this, I use the following settings:<br />
<br />
<br />
<br />
export PATH=/usr/site/bin:/usr/sbin:/usr/bin:/usr/local/bin:/bin<br />
<br />
<br />
if [ "$LOGNAME" = "root" ]; then<br />
export PATH=$PATH:/sbin<br />
fi<br />
<br />
===Changing the prompt===<br />
Having a colored prompt can be helpful to notice quickly where the prompt is in a long listing of output, and having a reminder who you are logged in as and where you are never hurts. To accomplish this, I use the following prompt:<br />
export PS1="\[\033[34m\]\u\[\033[0m\]@\[\033[32m\]\h\[\033[0m\]:\[\033[31m\]\w\[\033[0m\]\\$ "<br />
<br />
This corresponds to a prompt that looks like the following, but with described below.<br />
ii69854@linuxserver1:~$ <br />
<br />
The username is blue, the @ is white (or black depending on your background), a green hostname, a white (or black) colon, a red directory, and a white (or black) $. <br />
<br />
This format has the advantage of being usable by <tt>scp</tt>; if you have to copy a file from that directory onto another machine, you can copy/paste the whole string into your <tt>scp</tt> command.<br />
<br />
===Changing the terminal name===<br />
Setting the name of the terminal is reflected in the title bar in gnome-terminal, or with a similar mechanism for other terminals (or GNU screen). I use the following settings:<br />
case $TERM in<br />
xterm*)<br />
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'<br />
;;<br />
screen*)<br />
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'<br />
;;<br />
*)<br />
;;<br />
esac<br />
<br />
===Changing your default pager===<br />
If you are on a sufficiently old system, the outdated pager <tt>more</tt> is used. You may want to set the pager to <tt>less</tt> instead.<br />
export PAGER=less</div>Ii69854https://redirect.cs.umbc.edu/systems/index.php?title=.bashrc&diff=5544.bashrc2024-02-27T19:16:47Z<p>Ii69854: /* Changing your default pager */</p>
<hr />
<div>{{Cleanup}}<br />
<br />
A .bashrc or .bash_profile file contains settings that are applied to non-interactive or interactive shells respectively. All the things described in this document are applicable to both, so it's reasonable to create only one and symlink the other one to it (or include it by saying something like <tt>. ~/.bashrc</tt> in your <tt>.bash_profile</tt>).<br />
<br />
==Simple things==<br />
===Setting the PATH===<br />
It's often nice to have more binaries directly accessible in your PATH environment variable. To do this, I use the following settings:<br />
<br />
<br />
<br />
export PATH=/usr/site/bin:/usr/sbin:/usr/bin:/usr/local/bin:/bin<br />
<br />
<br />
if [ "$LOGNAME" = "root" ]; then<br />
export PATH=$PATH:/sbin<br />
fi<br />
<br />
===Changing the prompt===<br />
Having a colored prompt can be helpful to notice quickly where the prompt is in a long listing of output, and having a reminder who you are logged in as and where you are never hurts. To accomplish this, I use the following prompt:<br />
export PS1="\[\033[34m\]\u\[\033[0m\]@\[\033[32m\]\h\[\033[0m\]:\[\033[31m\]\w\[\033[0m\]\\$ "<br />
This gives your username in blue (i.e., if you sudo -s it'll be <tt>root</tt> instead of your username) followed by a black @ followed by the hostname of the machine you're on followed by a colon followed by the path to the current directory, followed by the sigil $ or # for user or root respectively. This format has the advantage of being usable by <tt>scp</tt>; if you have to copy a file from that directory onto another machine, you can copy/paste the whole string into your <tt>scp</tt> command.<br />
<br />
===Changing the terminal name===<br />
Setting the name of the terminal is reflected in the title bar in gnome-terminal, or with a similar mechanism for other terminals (or GNU screen). I use the following settings:<br />
case $TERM in<br />
xterm*)<br />
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'<br />
;;<br />
screen*)<br />
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'<br />
;;<br />
*)<br />
;;<br />
esac<br />
<br />
===Changing your default pager===<br />
If you are on a sufficiently old system, the outdated pager <tt>more</tt> is used. You may want to set the pager to <tt>less</tt> instead.<br />
export PAGER=less</div>Ii69854https://redirect.cs.umbc.edu/systems/index.php?title=.bashrc&diff=5543.bashrc2024-02-27T19:14:42Z<p>Ii69854: /* Setting the PATH */</p>
<hr />
<div>{{Cleanup}}<br />
<br />
A .bashrc or .bash_profile file contains settings that are applied to non-interactive or interactive shells respectively. All the things described in this document are applicable to both, so it's reasonable to create only one and symlink the other one to it (or include it by saying something like <tt>. ~/.bashrc</tt> in your <tt>.bash_profile</tt>).<br />
<br />
==Simple things==<br />
===Setting the PATH===<br />
It's often nice to have more binaries directly accessible in your PATH environment variable. To do this, I use the following settings:<br />
<br />
<br />
<br />
export PATH=/usr/site/bin:/usr/sbin:/usr/bin:/usr/local/bin:/bin<br />
<br />
<br />
if [ "$LOGNAME" = "root" ]; then<br />
export PATH=$PATH:/sbin<br />
fi<br />
<br />
===Changing the prompt===<br />
Having a colored prompt can be helpful to notice quickly where the prompt is in a long listing of output, and having a reminder who you are logged in as and where you are never hurts. To accomplish this, I use the following prompt:<br />
export PS1="\[\033[34m\]\u\[\033[0m\]@\[\033[32m\]\h\[\033[0m\]:\[\033[31m\]\w\[\033[0m\]\\$ "<br />
This gives your username in blue (i.e., if you sudo -s it'll be <tt>root</tt> instead of your username) followed by a black @ followed by the hostname of the machine you're on followed by a colon followed by the path to the current directory, followed by the sigil $ or # for user or root respectively. This format has the advantage of being usable by <tt>scp</tt>; if you have to copy a file from that directory onto another machine, you can copy/paste the whole string into your <tt>scp</tt> command.<br />
<br />
===Changing the terminal name===<br />
Setting the name of the terminal is reflected in the title bar in gnome-terminal, or with a similar mechanism for other terminals (or GNU screen). I use the following settings:<br />
case $TERM in<br />
xterm*)<br />
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'<br />
;;<br />
screen*)<br />
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'<br />
;;<br />
*)<br />
;;<br />
esac<br />
<br />
===Changing your default pager===<br />
<tt>more</tt> is for losers. Use <tt>less</tt> instead.<br />
export PAGER=less</div>Ii69854