When you login to Linux the operating system looks to a file called …
/etc/profile
… to perform its commands.
Within that file, if you are in a default Bash environment shell, as we are with Mac OS X application Terminal you may see a line of code, as highlighted in red like …
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
… which then proceeds to take commands from a file called …
/etc/bashrc
… which may contain code like …
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='h:W u$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf 'e]7;%sa' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
Today, we change this /etc/bashrc file so that a current date and time is added to the Linux prompt (and for advice we thank this excellent link) by the amendment in orange as shown below for /etc/bashrc …
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='h:W u d [t]$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf 'e]7;%sa' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
If this was interesting you may be interested in this too.
I’m curious to locate out what blog system youΓ’β¬β’re employing? IΓ’β¬β’m experiencing some small security difficulties with my latest blog and IΓ’β¬β’d like to find something far more safeguarded. Do you’ve any recommendations?
Hi there, after reading this awesome piece of writing i am also delighted to share my know-how here with friends.|
I value you writing your point of view.. Good feelings you’ve got here.. Good feelings you might have here.. indeed, investigation is paying off.
of course, analysis is paying off. Isn’t it superb if you obtain a very good publish? So pleased to have discovered this article.. My personal web surfing seem total.. thank you.
So content to have located this article.. Certainly handy mindset, thank you for writing.. So pleased to have discovered this submit.. Very useful mindset, many thanks for sharing with us..
I’m more than happy to find this site. I need to to thank you for your time for this fantastic read!! I definitely savored every bit of it and I have you bookmarked to check out new information on your website.|
Have you ever thought about including a little bit more than just your articles? I mean, what you say is valuable and all. But just imagine if you added some great graphics or video clips to give your posts more, “pop”! Your content is excellent but with pics and clips, this blog could undeniably be one of the most beneficial in its field. Awesome blog!|
Hello there! This is my first visit to your website! We are a group of volunteers and starting a new project in a community in the same niche. Your website provided us valuable information to work on. You have done a marvellous job!
Take pleasure in the blog you provided.. Is not it excellent whenever you get a good post? My web surfing seem total.. thank you. Terrific thoughts you have got here..
naturally like your web-site but you need to take a look at the spelling on quite a few of your posts. Several of them are rife with spelling issues and I in finding it very troublesome to inform the reality however I will certainly come back again.