date: “2017-01-17” draft: false title: “bash” tag: [“cli”, “commands”] category: “unix”
Summary - bash
| OS | Default Available | Online Man |
|---|---|---|
| Linux | Y | bash |
| Solaris | Y | bash |
| BSD | Y | bash |
| MacOS | Y | bash |
| Basics | Command |
|---|---|
| Version | bash --version |
| Usage info | bash --help |
| Man | man bash |
Usage - bash
Bash is a command interpreter and scripting language which enables user and scripted interactions with systems.
It is highy reccomended to skim the entire bash man page.
Examples
| command | description |
|---|---|
bash -c <COMMAND> |
run the provided command |
Shell & Environment variables
Use set | less to list current bash shell variables.
Use env | less to list the current environment variables.
Environment & Shell Variables
History
Bash history behavior can be modified with the below shell variables.
Use set <VAR>=<VALUE> and unset <VAR> to modify shell variables.
Use set | less to list current bash shell variables.
| Variable | Explanation |
|---|---|
| HISTFILE | The name of the file in which command history is saved. If unset, the command history is not saved when a shell exits. |
| HISTSIZE | The number of commands to remember in the command history. |
Reference Materials - bash
See Also
usermod --shell <SHELL>- change users default shell- [usermod]({{< relref “unix/commands/usermod.md” >}})