dropdown menu

BASH initialization:
A shell is a command interpreter and it offers other things.

When new Bash shell started 2 files are loaded:
1. /etc/profile - system wide customization, that applies to every user's bash login shell
2. ~/.profile (or ~/.bash_profile) - per-user customization file, customization of my login shell

Every time you start a new Bash shell (after you have started your login shell), a new file, ~/.bashrc, is read instead of the ~/.profile file. To minimize confusion, the recommended practice is to put all customization settings (such as setting options and environment variables) in your ~/.bashrc file, and source this file from within your login initialization file(~/.profile). You can easily do this by adding source ~/.bashrc to the end of your ~/.profile file,

???:
Bash first executes /etc/profile, the system-wide startup file, if that file exists and the user can read it. After reading that file, Bash looks for ~/.bash_profile, ~/.bash_login, ~/.profile, and ~/.bashrc-in that order-where ~ is the shell's abbreviation for the user's home directory (also available as $HOME). If you exit Bash, the shell searches for ~/.bash_logout.

chsh bash or bash          change shell to bash
set -o                     lists the options which can be changed to customize bash
set -o <option>            turns on the specific option (set -o emacs)
set +o <option>            turns off the specific option

history                    shows the previous commands with numbers, use this number with !, to execcute a specific command:
-----------------------------
history
...
    368  whoami
    369  date
    370  ls
    371  history
root@aix31: / # !369
date
Tue Nov 17 21:57:09 NFT 2009
-----------------------------

Changing the prompt:
PS1='bubba\$ '            <-leave a space at the end, for better separation, \$ will be a # if user is root, otherwise $ sign is used

\u expands to the current user's username.
\h expands to the hostname (up to the first period in the DNS name).
\w expands to the current working directory (~ indicates the user's home directory).
\t expands to the time in a 24-hour clock format (HH:MM:SS).
\A expands to the time in a 24-hour clock format (HH:MM).
\e (the ASCII escape character) passes more advanced options to the terminal window.
\[ indicates the start of a non-printing character sequence.
\] indicates the end of a non-printing character sequence.

PS1='[\u@\h:\w]\$ ' <---> [root@aix31:/home]#

4 comments:

  1. Could you please tell me

    How to set extended_history=ON like ksh shell in BASH and CSH shell??

    ReplyDelete
  2. can someone record a video installing the bash shell on AIX 7.1 includes downloading the proper package to the computer then transfer it to the AIX server and installing , because i tried to install the bash shell and it said the package cannot be installed.

    ReplyDelete
  3. Thanks for the tips - useful.

    Your italicised backslashes look like pipes - on my browser anyway (IE11, unfortunately).

    ReplyDelete
    Replies
    1. Thanks for the feedback, I'll change italics.

      Delete