{
	"id": "ebc89979-09a0-412f-8f7d-92b518567844",
	"created_at": "2026-04-06T00:19:37.251618Z",
	"updated_at": "2026-04-10T03:21:40.214791Z",
	"deleted_at": null,
	"sha1_hash": "5828e2f58583310f3874ff04153e08d50675848f",
	"title": "Bash - ArchWiki",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 148648,
	"plain_text": "Bash - ArchWiki\r\nArchived: 2026-04-05 20:20:35 UTC\r\nBash (Bourne-Again SHell) is a command-line shell/programming language by the GNU Project. Its name alludes\r\nto its predecessor, the long-deprecated Bourne shell. Bash can be run on most Unix-like operating systems,\r\nincluding GNU/Linux.\r\nBash is the default command-line shell on Arch Linux.\r\nInvocation\r\nBash behaviour can be altered depending on how it is invoked. Some descriptions of different modes follow.\r\nIf Bash is spawned by login in a TTY, by an SSH daemon, or similar means, it is considered a login shell. This\r\nmode can also be engaged using the -l / --login command line option.\r\nBash is considered an interactive shell when its standard input, output and error are connected to a terminal (for\r\nexample, when run in a terminal emulator), and it is not started with the -c option or non-option arguments (for\r\nexample, bash script ). All interactive shells source /etc/bash.bashrc and ~/.bashrc , while interactive\r\nlogin shells also source /etc/profile and ~/.bash_profile .\r\nNote In Arch /bin/sh (which used to be the Bourne shell executable) is symlinked to bash . If Bash is invoked\r\nwith the name sh , it tries to mimic the startup behavior of historical versions of sh , including POSIX\r\ncompatibility.\r\nConfiguration files\r\nBash will attempt to execute a set of startup files depending on how it was invoked. See the Bash Startup Files\r\nsection of the GNU Bash manual for a complete description.\r\nFile Description\r\nLogin\r\nshells\r\n(see\r\nnote)\r\nInteractive,\r\nnon-login\r\nshells\r\n/etc/profile\r\nSources application settings in\r\n/etc/profile.d/*.sh and /etc/bash.bashrc .\r\nYes No\r\n~/.bash_profile\r\nPer-user, after /etc/profile . If this file does not\r\nexist, ~/.bash_login and ~/.profile are checked\r\nin that order. The skeleton file\r\n/etc/skel/.bash_profile also sources\r\n~/.bashrc .\r\nYes No\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 1 of 10\n\n~/.bash_logout Per-user, after exit of a login shell. Yes No\r\n/etc/bash.bash_logout\r\nDepends on the -\r\nDSYS_BASH_LOGOUT=\"/etc/bash.bash_logout\"\r\ncompilation flag. After exit of a login shell.\r\nYes No\r\n/etc/bash.bashrc\r\nDepends on the -DSYS_BASHRC=\"/etc/bash.bashrc\"\r\ncompilation flag. Sources /usr/share/bash-completion/bash_completion .No Yes\r\n~/.bashrc Per-user, after /etc/bash.bashrc . No Yes\r\nNote\r\nLogin shells can be non-interactive when called with the --login argument.\r\nWhile interactive, non-login shells do not source ~/.bash_profile , they still inherit the environment\r\nfrom their parent process (which may be a login shell). See GregsWiki:ProcessManagement#On processes,\r\nenvironments and inheritance for details.\r\nShell and environment variables\r\nThe behavior of Bash and programs run by it can be influenced by a number of environment variables.\r\nEnvironment variables are used to store useful values such as command search directories, or which browser to\r\nuse. When a new shell or script is launched it inherits its parent's variables, thus starting with an internal set of\r\nshell variables[1].\r\nThese shell variables in Bash can be exported in order to become environment variables:\r\nVARIABLE=content\r\nexport VARIABLE\r\nor with a shortcut\r\nexport VARIABLE=content\r\nEnvironment variables are conventionally placed in ~/.profile or /etc/profile so that other Bourne-compatible shells can use them.\r\nSee Environment variables for more general information.\r\nCommand line\r\nBash command line is managed by the separate library called Readline. Readline provides emacs and vi styles of\r\nshortcuts for interacting with the command line, i.e. moving back and forth on the word basis, deleting words etc.\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 2 of 10\n\nIt is also Readline's responsibility to manage history of input commands. Last, but not least, it allows you to create\r\nmacros.\r\nTab completion\r\nTab completion is the option to auto-complete typed commands by pressing Tab (enabled by default).\r\nSingle-tab\r\nIt may require up to three tab-presses to show all possible completions for a command. To reduce the needed\r\nnumber of tab-presses, see Readline#Faster completion.\r\nCommon programs and options\r\nBy default, Bash only tab-completes commands, filenames, and variables. The package bash-completion extends\r\nthis by adding more specialized tab completions for common commands and their options, which can be enabled\r\nby sourcing /usr/share/bash-completion/bash_completion (which has been already sourced in Arch's\r\n/etc/bash.bashrc ). With bash-completion, normal completions (such as ls file.* Tab Tab ) will behave\r\ndifferently; however, they can be re-enabled with compopt -o bashdefault program (see [2] and [3] for more\r\ndetail).\r\nCustomize per-command\r\nNote Using the complete builtin may cause conflicts with bash-completion.\r\nBy default, Bash only tab-completes file names following a command. You can change it to complete command\r\nnames using complete -c :\r\n~/.bashrc\r\ncomplete -c man which\r\nor complete command names and file names with -cf :\r\ncomplete -cf sudo\r\nSee bash(1) § Programmable Completion for more completion options.\r\nHistory\r\nHistory completion\r\nYou can bind the up and down arrow keys to search through Bash's history (see: Readline#History and Readline\r\nInit File Syntax):\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 3 of 10\n\n~/.bashrc\r\nbind '\"\\e[A\": history-search-backward'\r\nbind '\"\\e[B\": history-search-forward'\r\nor to affect all readline programs:\r\n~/.inputrc\r\n\"\\e[A\": history-search-backward\r\n\"\\e[B\": history-search-forward\r\nHistory customization\r\nThe HISTCONTROL variable can prevent certain commands from being logged to the history.\r\nTo stop logging of consecutive identical commands:\r\n~/.bashrc\r\nexport HISTCONTROL=ignoredups\r\nTo remove all but the last identical command:\r\n~/.bashrc\r\nexport HISTCONTROL=erasedups\r\nTo avoid saving commands that start with a space:\r\n~/.bashrc\r\nexport HISTCONTROL=ignorespace\r\nTo avoid saving consecutive identical commands, and commands that start with a space:\r\n~/.bashrc\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 4 of 10\n\nexport HISTCONTROL=ignoreboth\r\nTo remove all but the last identical command, and commands that start with a space:\r\n~/.bashrc\r\nexport HISTCONTROL=\"erasedups:ignorespace\"\r\nSee bash(1) § HISTCONTROL for details.\r\nDisable history\r\nTo disable the bash history only temporarily:\r\n$ set +o history\r\nThe commands entered now are not logged to the $HISTFILE .\r\nFor example, now you can hash passwords with printf secret | sha256sum , or hide GPG usage like gpg -eaF\r\nsecret-pubkey.asc and your secret is not written to disk.\r\nTo enable history:\r\n$ set -o history\r\nTo disable all bash history:\r\n~/.bashrc or /etc/profile\r\nexport HISTSIZE=0\r\n... and just to make sure, destroy your old histfile forever:\r\n$ wipe -i -l2 -x4 -p4 \"$HISTFILE\"\r\n$ ln -sv /dev/null \"$HISTFILE\"\r\nMimic Zsh run-help ability\r\nZsh can invoke the manual for the command preceding the cursor by pressing Alt+h . A similar behaviour is\r\nobtained in Bash using this Readline bind:\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 5 of 10\n\n~/.bashrc\r\nrun-help() { help \"$READLINE_LINE\" 2\u003e/dev/null || man \"$READLINE_LINE\"; }\r\nbind -m vi-insert -x '\"\\eh\": run-help'\r\nbind -m emacs -x '\"\\eh\": run-help'\r\nThis assumes are you using the (default) Emacs editing mode.\r\natuin replaces your existing shell history with an SQLite database, and records additional context for your\r\ncommands. Additionally, it provides optional and fully encrypted synchronization of your history between\r\nmachines, via an Atuin server.\r\nEnable bash history timestamps ( export HISTTIMEFORMAT=\"%F %T \" ) before syncing. Atuin works well with tools\r\nlike blesh-gitAUR and cmd-wrapped to provide an enhanced terminal experience across machines.\r\nAliases\r\nalias is a command, which enables a replacement of a word with another string. It is often used for abbreviating a\r\nsystem command, or for adding default arguments to a regularly used command.\r\nPersonal aliases can be stored in ~/.bashrc or any separate file sourced from ~/.bashrc . System-wide aliases\r\n(which affect all users) belong in /etc/bash.bashrc . See [4] for example aliases.\r\nFor functions, see Bash/Functions.\r\nTips and tricks\r\nPrompt customization\r\nSee Bash/Prompt customization.\r\nSyntax highlighting and autosuggestions\r\nble.sh (Bash Line Editor), packed as blesh-gitAUR, is a command line editor written in pure Bash, which is an\r\nalternative to GNU Readline. It has many enhanced features like syntax highlighting, autosuggestions, menu-completion, abbreviations, Vim editing mode, and hook functions. Other interesting features include status line,\r\nhistory share, right prompt, transient prompt, and xterm title.\r\nAfter installing it, source it in an interactive session.\r\n~/.bashrc\r\nsource /usr/share/blesh/ble.sh\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 6 of 10\n\nConfigurations are explained in depth in the ~/.blerc file and at the wiki. The stable bleshAUR\r\n package is also\r\navailable.\r\nCommand not found\r\npkgfile includes a \"command not found\" hook that will automatically search the official repositories, when\r\nentering an unrecognized command.\r\nYou need to source the hook to enable it, for example:\r\n~/.bashrc\r\nsource /usr/share/doc/pkgfile/command-not-found.bash\r\nThen attempting to run an unavailable command will show the following info:\r\n$ abiword\r\nabiword may be found in the following packages:\r\n extra/abiword 3.0.1-2 /usr/bin/abiword\r\nNote The pkgfile database may need to be updated before this will work. See pkgfile#Installation for details.\r\nDisable Ctrl+z in terminal\r\nYou can disable the Ctrl+z feature (pauses/closes your application) by wrapping your command like this:\r\n#!/bin/bash\r\ntrap \"\" 20\r\nadom\r\nNow, when you accidentally press Ctrl+z in adomAUR instead of Shift+z , nothing will happen because\r\nCtrl+z will be ignored.\r\nClear the screen after logging out\r\nTo clear the screen after logging out on a virtual terminal:\r\n~/.bash_logout\r\nclear\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 7 of 10\n\nreset\r\nAuto \"cd\" when entering just a path\r\nBash can automatically prepend cd when entering just a path in the shell. For example:\r\n$ /etc\r\nbash: /etc: Is a directory\r\nBut after adding one line into .bashrc file:\r\n~/.bashrc\r\n...\r\nshopt -s autocd\r\n...\r\nYou get:\r\n[user@host ~]$ /etc\r\ncd /etc\r\n[user@host etc]$\r\nAutojump\r\nautojump-gitAUR is a python script which allows navigating the file system by searching for strings in a database\r\nwith the user's most-visited paths.\r\nzoxide is an alternative which has additional features and performance improvements compared to the original\r\nautojump and can serve as a drop-in replacement for autojump.\r\nPrevent overwrite of files\r\nFor the current session, to disallow existing regular files to be overwritten by redirection of shell output:\r\n$ set -o noclobber\r\nThis is identical to set -C .\r\nTo make the changes persistent for your user:\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 8 of 10\n\n~/.bashrc\r\n...\r\nset -o noclobber\r\nTo manually overwrite a file while noclobber is set:\r\n$ echo \"output\" \u003e| file.txt\r\nUse directory stack to navigate\r\npushd and popd can be used to push or pop directories to a stack while switching to them. This can be useful\r\nfor \"replaying\" your navigation history.\r\n[user@host ~] pushd /tmp/dir1\r\n[user@host /tmp/dir1] pushd /var/lib\r\n[user@host /var/lib] popd\r\n[user@host /tmp/dir1] popd\r\n[user@host ~]\r\nSee bash(1) § DIRSTACK.\r\nShell environment detection\r\nSee Environment variables#Shell environment detection.\r\nTroubleshooting\r\nLine wrap on window resize\r\nWhen resizing a terminal emulator, Bash may not receive the resize signal. This will cause typed text to not wrap\r\ncorrectly and overlap the prompt. The checkwinsize shell option checks the window size after each command\r\nand, if necessary, updates the values of LINES and COLUMNS .\r\n~/.bashrc\r\nshopt -s checkwinsize\r\nShell exits even if ignoreeof set\r\nIf you have set the ignoreeof option and you find that repeatedly hitting ctrl-d causes the shell to exit, it is\r\nbecause this option only allows 10 consecutive invocations of this keybinding (or 10 consecutive EOF characters,\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 9 of 10\n\nto be precise), before exiting the shell.\r\nTo allow higher values, you have to use the IGNOREEOF variable.\r\nFor example:\r\nexport IGNOREEOF=100\r\nChecking errors by analyzing scripts\r\nThe package shellcheck analyzes bash (and other shell) scripts, prints possible errors, and suggests better coding.\r\nThere is also the web site shellcheck.net of the same purpose, based on this program.\r\nSee also\r\nBash Reference Manual, or /usr/share/doc/bash/bashref.html\r\nReadline Init File Syntax\r\nThe Bourne-Again Shell - The third chapter of The Architecture of Open Source Applications\r\nPS1 generator - generate your .bashrc/PS1 bash prompt using an intuitive UI\r\nEven more useful .bashrc commands\r\nTutorials\r\nGreg's Wiki\r\nGregsWiki:BashGuide\r\nGregsWiki:BashFAQ\r\nQuote Tutorial\r\nAn active and friendly IRC channel for Bash\r\nExamples\r\nHow to change the title of an xterm\r\nSource: https://wiki.archlinux.org/index.php/Bash#Invocation\r\nhttps://wiki.archlinux.org/index.php/Bash#Invocation\r\nPage 10 of 10",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"references": [
		"https://wiki.archlinux.org/index.php/Bash#Invocation"
	],
	"report_names": [
		"Bash#Invocation"
	],
	"threat_actors": [],
	"ts_created_at": 1775434777,
	"ts_updated_at": 1775791300,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/5828e2f58583310f3874ff04153e08d50675848f.pdf",
		"text": "https://archive.orkl.eu/5828e2f58583310f3874ff04153e08d50675848f.txt",
		"img": "https://archive.orkl.eu/5828e2f58583310f3874ff04153e08d50675848f.jpg"
	}
}