{"id":321,"date":"2015-08-09T10:36:44","date_gmt":"2015-08-09T10:36:44","guid":{"rendered":"https:\/\/www.armourinfosec.com\/?p=321"},"modified":"2017-01-18T10:03:05","modified_gmt":"2017-01-18T04:33:05","slug":"linux-shell","status":"publish","type":"post","link":"https:\/\/www.armourinfosec.com\/linux-shell\/","title":{"rendered":"Linux shell"},"content":{"rendered":"

\"CH932\"<\/a>Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands. In UNIX, any program can be the users shell.<\/p>\n

Types of Shells in Linux<\/strong><\/p>\n

sh ( Bourne Shell )<\/strong>: The original shell still used on UNIX systems and in UNIX-related environments. This is the basic shell, a small program with few features. While this is not the standard shell, it is still available on every Linux system for compatibility with UNIX programs.<\/p>\n

bash ( Bourne Again shell )<\/strong>: The standard GNU shell, intuitive and flexible. Probably most advisable for beginning users while being at the same time a powerful tool for the advanced and professional user. On Linux, bash is the standard shell for common users. This shell is a so-called superset of the Bourne shell, a set of add-ons and plug-ins. This means that the Bourne Again shell is compatible with the Bourne shell: commands that work in sh, also work in bash. However, the reverse is not always the case.<\/p>\n

csh ( C shell )<\/strong>: the syntax of this shell resembles that of the C programming language sometimes asked for by programmers.<\/p>\n

tcsh ( TENEX C shell )<\/strong>: a superset of the common C shell, enhancing user-friendliness and speed. That is why some also call it the Turbo C shell.<\/p>\n

ksh ( the Korn shell )<\/strong>: sometimes appreciated by people with a UNIX background. A superset of the Bourne shell; with standard configuration a nightmare for beginning users.<\/p>\n

The file \/etc\/shells<\/strong> gives an overview of known shells on a Linux system.<\/p>\n

[root@armourinfosec \/]# vim \/etc\/shells<\/p>\n

To switch from one shell to another, just enter the name of the new shell in the active terminal.<\/p>\n

[root@armourinfosec \/]# sh<\/p>\n

Reserved Bourne shell variables<\/strong><\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Variable name<\/strong><\/td>\nDefinition<\/strong><\/td>\n<\/tr>\n
CDPATH<\/td>\nA colon-separated list of directories used as a search path for thecdbuilt-in command.<\/td>\n<\/tr>\n
HOME<\/td>\nThe current user’s home directory; the default for thecdbuilt-in. The value of this variable is also used by tilde expansion.<\/td>\n<\/tr>\n
IFS<\/td>\nA list of characters that separate fields; used when the shell splits words as part of expansion.<\/td>\n<\/tr>\n
MAIL<\/td>\nIf this parameter is set to a file name and the MAILPATHvariable is not set, Bash informs the user of the arrival of mail in the specified file.<\/td>\n<\/tr>\n
MAILPATH<\/td>\nA colon-separated list of file names which the shell periodically checks for new mail.<\/td>\n<\/tr>\n
OPTARG<\/td>\nThe value of the last option argument processed by thegetoptsbuilt-in.<\/td>\n<\/tr>\n
OPTIND<\/td>\nThe index of the last option argument processed by thegetoptsbuilt-in.<\/td>\n<\/tr>\n
PATH<\/td>\nA colon-separated list of directories in which the shell looks for commands.<\/td>\n<\/tr>\n
PS1<\/td>\nThe primary prompt string. The default value is “‘\\s-\\v\\$ ‘”.<\/td>\n<\/tr>\n
PS2<\/td>\nThe secondary prompt string. The default value is “‘> ‘”.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

Bash reserved variables<\/strong><\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Variable name<\/strong><\/td>\nDefinition<\/strong><\/td>\n<\/tr>\n
auto_resume<\/td>\nThis variable controls how the shell interacts with the user and job control.<\/td>\n<\/tr>\n
BASH<\/td>\nThe full pathname used to execute the current instance of Bash.<\/td>\n<\/tr>\n
BASH_ENV<\/td>\nIf this variable is set when Bash is invoked to execute a shell script, its value is expanded and used as the name of a startup file to read before executing the script.<\/td>\n<\/tr>\n
BASH_VERSION<\/td>\nThe version number of the current instance of Bash.<\/td>\n<\/tr>\n
BASH_VERSINFO<\/td>\nA read-only array variable whose members hold version information for this instance of Bash.<\/td>\n<\/tr>\n
COLUMNS<\/td>\nUsed by the select built-in to determine the terminal width when printing selection lists. Automatically set upon receipt of a SIGWINCH signal.<\/td>\n<\/tr>\n
COMP_CWORD<\/td>\nAn index into ${COMP_WORDS}of the word containing the current cursor position.<\/td>\n<\/tr>\n
COMP_LINE<\/td>\nThe current command line.<\/td>\n<\/tr>\n
COMP_POINT<\/td>\nThe index of the current cursor position relative to the beginning of the currentCommand.<\/td>\n<\/tr>\n
COMP_WORDS<\/td>\nAn array variable consisting of the individual words in the current command line.<\/td>\n<\/tr>\n
COMPREPLY<\/td>\nAn array variable from which Bash reads the possible completions generated by a shell function invoked by the programmable completion facility.<\/td>\n<\/tr>\n
DIRSTACK<\/td>\nAn array variable containing the current contents of the directory stack.<\/td>\n<\/tr>\n
EUID<\/td>\nThe numeric effective user ID of the current user.<\/td>\n<\/tr>\n
FCEDIT<\/td>\nThe editor used as a default by the -eoption to the fcbuilt-in command.<\/td>\n<\/tr>\n
FIGNORE<\/td>\nA colon-separated list of suffixes to ignore when performing file name completion.<\/td>\n<\/tr>\n
FUNCNAME<\/td>\nThe name of any currently-executing shell function.<\/td>\n<\/tr>\n
GLOBIGNORE<\/td>\nA colon-separated list of patterns defining the set of file names to be ignored by filename expansion.<\/td>\n<\/tr>\n
GROUPS<\/td>\nAn array variable containing the list of groups of which the current user is amember.<\/td>\n<\/tr>\n
histchars<\/td>\nUp to three characters which control history expansion, quick substitution, andtokenization.<\/td>\n<\/tr>\n
HISTCMD<\/td>\nThe history number, or index in the history list, of the current command.<\/td>\n<\/tr>\n
HISTCONTROL<\/td>\nDefines whether a command is added to the history file.<\/td>\n<\/tr>\n
HISTFILE<\/td>\nThe name of the file to which the command history is saved. The default value is~\/.bash_history.<\/td>\n<\/tr>\n
HISTFILESIZE<\/td>\nThe maximum number of lines contained in the history file, defaults to 500.<\/td>\n<\/tr>\n
HISTIGNORE<\/td>\nA colon-separated list of patterns used to decide which command lines should besaved in the history list.<\/td>\n<\/tr>\n
HISTSIZE<\/td>\nThe maximum number of commands to remember on the history list, default is 500.<\/td>\n<\/tr>\n
HOSTFILE<\/td>\nContains the name of a file in the same format as \/etc\/hosts that should be readwhen the shell needs to complete a hostname.<\/td>\n<\/tr>\n
HOSTNAME<\/td>\nThe name of the current host.<\/td>\n<\/tr>\n
HOSTTYPE<\/td>\nA string describing the machine Bash is running on.<\/td>\n<\/tr>\n
IGNOREEOF<\/td>\nControls the action of the shell on receipt of an EOF character as the sole input.<\/td>\n<\/tr>\n
INPUTRC<\/td>\nThe name of the Read line initialization file, overriding the default\/etc\/inputrc.<\/td>\n<\/tr>\n
LANG<\/td>\nUsed to determine the locale category for any category not specifically selected witha variable starting with LC_.<\/td>\n<\/tr>\n
LC_ALL<\/td>\nThis variable overrides the value of LAN Gand any other LC_variable specifying alocale category.<\/td>\n<\/tr>\n
LC_COLLATE<\/td>\nThis variable determines the collation order used when sorting the results of filename expansion, and determines the behavior of range expressions, equivalence<\/p>\n

classes, and collating sequences within file name expansion and pattern matching.<\/td>\n<\/tr>\n

LC_CTYPE<\/td>\nThis variable determines the interpretation of characters and the behavior ofcharacter classes within file name expansion and pattern matching.<\/td>\n<\/tr>\n
LC_MESSAGES<\/td>\nThis variable determines the locale used to translate double-quoted strings precededby a “$” sign.<\/td>\n<\/tr>\n
LC_NUMERIC<\/td>\nThis variable determines the locale category used for number formatting.<\/td>\n<\/tr>\n
LINENO<\/td>\nThe line number in the script or shell function currently executing.<\/td>\n<\/tr>\n
LINES<\/td>\nUsed by the select built-in to determine the column length for printing selectionlists.<\/td>\n<\/tr>\n
MACHTYPE<\/td>\nA string that fully describes the system type on which Bash is executing, in thestandard GNU CPU-COMPANY-SYSTEM format.<\/td>\n<\/tr>\n
MAILCHECK<\/td>\nHow often (in seconds) that the shell should check for mail in the files specified in the MAILPATH or MAIL variables.<\/td>\n<\/tr>\n
OLDPWD<\/td>\nThe previous working directory as set by the cd built-in<\/td>\n<\/tr>\n
OPTERR<\/td>\nIf set to the value 1, Bash displays error messages generated by the getopts built-in.<\/td>\n<\/tr>\n
OSTYPE<\/td>\nA string describing the operating system Bash is running on.<\/td>\n<\/tr>\n
PIPESTATUS<\/td>\nAn array variable containing a list of exit status values from the processes in themost recently executed foreground pipeline (which may contain only a single<\/p>\n

command).<\/td>\n<\/tr>\n

POSIXLY_CORRECT<\/td>\nIf this variable is in the environment when bash starts, the shell enters POSIXmode.<\/td>\n<\/tr>\n
PPID<\/td>\nThe process ID of the shell’s parent process.<\/td>\n<\/tr>\n
PROMPT_COMMAND<\/td>\nIf set, the value is interpreted as a command to execute before the printing of eachprimary prompt (PS1)<\/td>\n<\/tr>\n
PS3<\/td>\nThe value of this variable is used as the prompt for the select command. Defaults to”‘#? ‘”<\/td>\n<\/tr>\n
PS4<\/td>\nThe value is the prompt printed before the command line is echoed when the -xoption is set; defaults to “‘+ ‘”.<\/td>\n<\/tr>\n
PWD<\/td>\nThe current working directory as set by the cd built-in command.<\/td>\n<\/tr>\n
RANDOM<\/td>\nEach time this parameter is referenced, a random integer between 0 and 32767 is generated. Assigning a value to this variable seeds the random number generator.<\/td>\n<\/tr>\n
REPLY<\/td>\nThe default variable for the read built-in.<\/td>\n<\/tr>\n
SECONDS<\/td>\nThis variable expands to the number of seconds since the shell was started.<\/td>\n<\/tr>\n
SHELLOPTS<\/td>\nA colon-separated list of enabled shell options.<\/td>\n<\/tr>\n
SHLVL<\/td>\nIncremented by one each time a new instance of Bash is started.<\/td>\n<\/tr>\n
TIMEFORMAT<\/td>\nThe value of this parameter is used as a format string specifying how the timinginformation for pipelines prefixed with the time reserved word should be displayed.<\/td>\n<\/tr>\n
TMOUT<\/td>\nIf set to a value greater than zero, TMOUT is treated as the default timeout for theRead built-in. In an inter ative shell, the value is interpreted as the number of<\/p>\n

seconds to wait for input after issuing the primary prompt when the shell is<\/p>\n

interactive. Bash terminates after that number of seconds if input does not arrive.<\/td>\n<\/tr>\n

UID<\/td>\nThe numeric, real user ID of the current user.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"

Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing…<\/p>\n","protected":false},"author":1,"featured_media":846,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"yoast_head":"\nWhat is Linux shell | Types of Linux shell<\/title>\n<meta name=\"description\" content=\"Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.armourinfosec.com\/linux-shell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Linux shell | Types of Linux shell\" \/>\n<meta property=\"og:description\" content=\"Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.armourinfosec.com\/linux-shell\/\" \/>\n<meta property=\"og:site_name\" content=\"Armour Infosec\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ArmourInfosec\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-09T10:36:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-01-18T04:33:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.armourinfosec.com\/wp-content\/uploads\/2015\/08\/CH932.png\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Armour Infosec\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ArmourInfosec\" \/>\n<meta name=\"twitter:site\" content=\"@ArmourInfosec\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Armour Infosec\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.armourinfosec.com\/linux-shell\/\",\"url\":\"https:\/\/www.armourinfosec.com\/linux-shell\/\",\"name\":\"What is Linux shell | Types of Linux shell\",\"isPartOf\":{\"@id\":\"https:\/\/www.armourinfosec.com\/#website\"},\"datePublished\":\"2015-08-09T10:36:44+00:00\",\"dateModified\":\"2017-01-18T04:33:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308\"},\"description\":\"Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.armourinfosec.com\/linux-shell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.armourinfosec.com\/linux-shell\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.armourinfosec.com\/linux-shell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.armourinfosec.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux shell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.armourinfosec.com\/#website\",\"url\":\"https:\/\/www.armourinfosec.com\/\",\"name\":\"Armour Infosec\",\"description\":\"Do Your Part - Be Security Smart\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.armourinfosec.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308\",\"name\":\"Armour Infosec\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.armourinfosec.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g\",\"caption\":\"Armour Infosec\"},\"sameAs\":[\"https:\/\/www.armourinfosec.com\/\"],\"url\":\"https:\/\/www.armourinfosec.com\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Linux shell | Types of Linux shell","description":"Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.armourinfosec.com\/linux-shell\/","og_locale":"en_US","og_type":"article","og_title":"What is Linux shell | Types of Linux shell","og_description":"Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands.","og_url":"https:\/\/www.armourinfosec.com\/linux-shell\/","og_site_name":"Armour Infosec","article_publisher":"https:\/\/www.facebook.com\/ArmourInfosec","article_published_time":"2015-08-09T10:36:44+00:00","article_modified_time":"2017-01-18T04:33:05+00:00","og_image":[{"width":450,"height":300,"url":"https:\/\/www.armourinfosec.com\/wp-content\/uploads\/2015\/08\/CH932.png","type":"image\/png"}],"author":"Armour Infosec","twitter_card":"summary_large_image","twitter_creator":"@ArmourInfosec","twitter_site":"@ArmourInfosec","twitter_misc":{"Written by":"Armour Infosec","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.armourinfosec.com\/linux-shell\/","url":"https:\/\/www.armourinfosec.com\/linux-shell\/","name":"What is Linux shell | Types of Linux shell","isPartOf":{"@id":"https:\/\/www.armourinfosec.com\/#website"},"datePublished":"2015-08-09T10:36:44+00:00","dateModified":"2017-01-18T04:33:05+00:00","author":{"@id":"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308"},"description":"Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands.","breadcrumb":{"@id":"https:\/\/www.armourinfosec.com\/linux-shell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.armourinfosec.com\/linux-shell\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.armourinfosec.com\/linux-shell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.armourinfosec.com\/"},{"@type":"ListItem","position":2,"name":"Linux shell"}]},{"@type":"WebSite","@id":"https:\/\/www.armourinfosec.com\/#website","url":"https:\/\/www.armourinfosec.com\/","name":"Armour Infosec","description":"Do Your Part - Be Security Smart","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.armourinfosec.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308","name":"Armour Infosec","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.armourinfosec.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g","caption":"Armour Infosec"},"sameAs":["https:\/\/www.armourinfosec.com\/"],"url":"https:\/\/www.armourinfosec.com\/author\/admin\/"}]}},"menu_order":0,"_links":{"self":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/posts\/321"}],"collection":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/comments?post=321"}],"version-history":[{"count":0,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/posts\/321\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/media\/846"}],"wp:attachment":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/media?parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/categories?post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/tags?post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}