Hey everyone!
I'd like to start a thread learning about your favourite RHEL bash tweaks. I'm particularly interested in:
I'll get started:
Aliases:
alias apsc="ansible-playbook --syntax-check"
Shell environment variables:
export LESS="-X"
This will cause a pager to not clear on exit. For example, when you're reading a man page, the screen will be cleared on exit so if you have a man page which has examples that you'd like to immediately use in your current terminal, exiting the man page will keep your example onscreen.
Functions:
mcd(){
mkdir -pv $1
cd $1
}
using mcd foo will create a directory and then change into it.
I have many examples that I can share but I want to hear from you and I will share my full environment configuration that I use. My objective is to take the very best contributions and add them to my git repo for everyone to use.
The -v (verbose) option should, IMHO, be used wherever it exists. Your mkdir command is one example. Others:
mv, cp, rm, chmod, chown, tar, rsync, restorecon, etc...
I like having a little extra "room." I add this to all my .bashrc files - it double spaces my prompts:
PS1='\n[\u@\h \W]\$ '
I use mkdir -pv without even thinking about it but I like the use of increased verbosity and we should teach this in RH124. Thanks for that tip!
I like the prompt colour!
On my Mac I use a slightly different PS1 which I won't dare paste here as it requires a plugin and the value of $PS1 is just ugly as a result.
Hello Ricardo,
At the risk of redirecting your post a little bit, along with potentially
coming across as a purist, I'd like to comment on your item 2:
"shell environment variables". It could be considered splitting
hairs a tad bit.
I know, you know, that "Shell" variables, and "Environment"
variables, are two different animals. I know, at least I think I
know, what you're intending to refer to, but I'm not so sure
that there may not be someone out here in the community
who's beginning their Linux journey, who knows the distinction.
I know part of my purist demeanor is guided by the fact that
I deliver 4 levels of Linux courses, and that very first one is
where I may go overboard a little bit in setting the foundation
for the remaining three (sys admin level) courses. One of the
subjects that I provide a little extra coverage with is when I begin
the conversation about the shell - especially when it comes to
variable types and functionalities.
Okay, I might be rambling a little bit here, and I don't mean to.
I know part of my prose is really just trying to justify my putting
the reference to "shell environment varibles" under the
microscope.
Now that I've gone this far, I'll close with the following:
- Shell variables are only present in the shell in which
they are defined.
- Environment variables are inherited by child shells but
shell variables are not
- Shell variables can be made an environment variable
by using export command
Okay, that's as far as I'll go with that because I've strayed away
enough from the original post. It's the purist in me
is not intended for the seasoned pros - they know, or should know,
the distinction.
Alright, now that I've consumed this much bandwidth, I know
I'm indebted to provide a reply based on the original post:
"favorite RHEL bash tweak". Coming to a theatre near you
soon!!!
Whew! I'm so relieved that you didn't drop the hammer
on me. I was sweating that my verbage would possibly
be taken as being critical.
One contribution coming up!!!
Long live emoticons!!!
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.