Thursday, August 11, 2016

/etc/profile

The /etc/profile file is the first file read when creating a login shell.






After the /etc/profile file is read, the bash shell looks for one of the following configuration files in the user’s home directory:


.bash_profile
.bash_login
.profile

.bashrc

The .bashrc file is used to configure non-login shells.

Search for text acrross man pages

>man -k
>apropos

Sections Used in man Pages

Sections Used in man Pages
Section           Content
1                     Programs and shell commands that can be used by any user
2                     System functions provided by the Linux kernel
3                     Library functions
4                     Special files found in/dev
5                    File format descriptions and conventions
6                    Games
7                    Miscellaneous conventions
8                    Administrative utilities used by the root use
9                    Kernel routine documentation

history file (.bash_history) Enviroment Variables

HISTSIZE or HISTFILESIZE:


Configures the size of your history file. On most distributions, this is set to 1,000 entries. You can customize the size of your history file by changing the value of this variable.


HISTCONTROL:


Controls how your command history is stored. You can set this variable to a value of ignoredups, ignorespace, ignoreboth, or erasedups. A value of ignorespace tells the shell to ignore commands in the history that start with spaces. A value of ignoredups tells the shell to ignore duplicate commands in the history. A value of ignoreboth specifies both ignorespace and ignoredups. You can also set this variable to a value of erasedups to remove all duplicate entries in the history file

uname Command

uname


This command returns information about your Linux system using several different options, including the following:



-p    Displays the processor type

-r    Displays the Linux kernel’s release number

-o   Displays the operating system

-m   Displays the system’s hardware architecture (such as x86_64)

-v    Displays the Linux kernel’s version number

-i    Displays the hardware platform

-s    Displays the Linux kernel’s name

-a   Displays all of this information

-n Displays the system’s hostname





















bash Configuration Files

If you’re using a non-login shell, things are pretty straightforward. The bash shell simply runs /etc/bashrc for system-wide functions and aliases, and then it runs ~/.bashrc from the user’s home directory for user-specific customizations.


If you’re using a login shell, bash first runs /etc/profile and applies the configurations speci-fied in that file. After that, however, things get a little more complex. As you may have noticed in Table 2-1, several of the files listed sound like they do exactly the same thing. You’re right, they do. The issue here is that no distribution uses all of these files. For example, a Fedora system uses ~/.bashrc, ~/.bash_profile, and ~/.bash_logout. Alternatively, openSUSE and Ubuntu systems use ~/.bashrc and ~/.profile.


When a login shell is run, the bash shell program searches for configuration files in the following order:


1.~/.bash_profile
2.~/.bash_login
3.~/.profile



It uses the first file it finds and ignores all of the rest.