author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Wed, 17 Mar 2010 15:24:36 +0200 | |
changeset 347 | 8ae88e9dd05d |
parent 277 | 5c7e19c15332 |
child 735 | 5c437e2d5fe1 |
permissions | -rw-r--r-- |
27 | 1 |
-*- outline -*- |
2 |
||
3 |
* How override PS1, PS2? |
|
4 |
||
5 |
When loading bash read ~/.bash_profile and ~/.bashrc. |
|
6 |
||
7 |
Put at end of these files |
|
8 |
||
9 |
PS1='\u@\H$ ' |
|
10 |
||
221
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
11 |
When xterm start bash - it start as non-login. So ~/.bash_profile and ~/.bashrc |
27 | 12 |
didn't read. To workaround this use |
13 |
||
14 |
$ xterm -e bash -i -c "mc -x" |
|
15 |
||
276 | 16 |
That make bash interactive and init file was readed. |
221
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
17 |
|
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
18 |
* Command history. |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
19 |
|
277 | 20 |
Bash allow accessing to command that you type previously. There are several |
21 |
options to control command history behavior. Set corresponding variables in |
|
22 |
your ~/.bashrc file (which is read by interactive shell): |
|
221
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
23 |
|
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
24 |
# ignorespace do not save lines that start with space |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
25 |
# erasedups all previous lines matching the current line to be removed from |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
26 |
# the history list before that line is saved |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
27 |
export HISTCONTROL=igrorespace:erasedups |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
28 |
export HISTIGNORE=" ?cd *":"e *":"sudo mv *":"sudo rm *":"sudo cp *":"sudo mkdir *":"sudo chmod *":"sudo chown *":ls:pwd:"vlc*" |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
29 |
|
277 | 30 |
There are another options, with default values (which satisfy my needs, so |
221
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
31 |
I don't put they to ~/.bashrc): |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
32 |
|
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
33 |
export HISTFILE=~/.bash_history # where is command history stored |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
34 |
export HISTFILESIZE=500 # how many lines been in $HISTFILE |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
35 |
export HISTSIZE=500 # how many lines been stored in bash process |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
36 |
|
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
37 |
** mc (GNU Midnight Commander). |
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
38 |
|
97171c12b447
About command history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
27
diff
changeset
|
39 |
You can also set special history rules for mc subshell in ~/.mc/bashrc file. |