Книга: The Linux Command Line
Назад: II. Configuration and the Environment
Дальше: 13. Customizing the Prompt

, and shell functions (which are related to shell scripting) will be covered in . in your environment.

.

.

, but for now we will translate:. To demonstrate how this works, try the following:

. The emacs editor was originally written by Richard Stallman. It is a gigantic, all-purpose, does-everything programming environment. Though readily available, it is seldom installed on most Linux systems by default. lists the meanings of our additions.

.

export HISTCONTROL=ignoredups

Causes the shell’s history recording feature to ignore a command if the same command was just recorded.

export HISTSIZE=1000

Increases the size of the command history from the default of 500 lines to 1000 lines.

alias l.='ls -d .* --color=auto'

Creates a new command called l., which displays all directory entries that begin with a dot.

alias ll='ls -l –color=auto'

Creates a new command called ll, which displays a long-format directory listing.

As we can see, many of our additions are not intuitively obvious, so it would be a good idea to add some comments to our .bashrc file to help explain things to the humans. Using the editor, change our additions to look like this:

# Change umask to make directory sharing easier umask 0002  # Ignore duplicates in command history and increase # history size to 1000 lines export HISTCONTROL=ignoredups export HISTSIZE=1000  # Add some helpful aliases alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto'

Ah, much better! With our changes complete, press ctrl-O to save our modified .bashrc file and ctrl-X to exit nano.

The changes we have made to our .bashrc will not take effect until we close our terminal session and start a new one, because the .bashrc file is only read at the beginning of a session. However, we can force bash to reread the modified .bashrc file with the following command:

[me@linuxbox ˜]$ source .bashrc

After doing this, we should be able to see the effect of our changes. Try out one of the new aliases:

[me@linuxbox ˜]$ ll

© RuTLib.com 2015-2018