l version="1.0" encoding="UTF-8" standalone="no"?>Bash and also Bash scripts | administration Guide | smashville247.net Linux companies Server 15 SP1

You are watching: What is the command a user invokes to log off when working at the linux shell?


smashville247.net › smashville247.net Linux companies Server smashville247.net › Administration Guide › Common Tasks › Bash and also Bash Scripts
smashville247.net › smashville247.net Linux enterprise Server smashville247.net › Administration Guide › Common Tasks › Bash and also Bash Scripts

Today, many world use computers with a graphical user user interface (GUI) like GNOME. Although GUIs offer countless features, they"re limited when performing automated task execution. Shells enhance GUIs well, and this thing gives summary of some facets of shells, in this situation the Bash shell.

1.1 What is “The Shell”?1.2 Writing covering Scripts1.3 Redirecting Command Events1.4 using Aliases1.5 utilizing Variables in Bash1.6 Grouping and also Combining Commands1.7 functioning with typical Flow Constructs1.8 For more Information

Traditionally, the Linux shell is Bash (Bourne again Shell). As soon as this thing speaks about “the shell” it way Bash. Over there are more shells available (ash, csh, ksh, zsh, …), each employing different features and characteristics. If friend need additional information about other shells, search for shell in YaST.

Interactive login shell.  This is offered when logging in come a machine, invoking Bash v the --login option or when logging in to a remote an equipment with SSH.

“Ordinary” interactive shell.  This is generally the instance when beginning xterm, konsole, gnome-terminal, or similar command-line interface (CLI) tools.

Non-interactive shell.  This is invoked once invoking a shell script at the command line.

depending on the form of covering you use, various configuration documents will it is in read. The complying with tables present the login and non-login shell configuration files.




carry out not change this file, otherwise your modifications may be ruined during your next update!


usage this document if you expand /etc/profile


consists of system-wide configuration records for specific programs


Insert user specific configuration for login shells here

note that the login shell likewise sources the construction files detailed under Table 1.2, “Bash Configuration records for Non-Login Shells”.


perform not change this file, otherwise your modifications may be ruined during your following update!


usage this record to insert your system-wide changes for Bash just


Insert user details configuration right here




consists of a list of all regulates you have typed


Executed as soon as logging out


User defined aliases of frequently used commands. See male 1 alias for more details around defining aliases.

There space special shells the block users from logging right into the system: /bin/false and also /sbin/nologin. Both fail silently as soon as the user attempts to log right into the system. This to be intended as a defense measure for device users, though modern Linux operating solution have much more effective devices for regulating system access, such as PAM and also AppArmor.

The default ~ above smashville247.net Linux companies Server is to assign /bin/bash to human being users, and also /bin/false or /sbin/nologin to mechanism users. The nobody user has actually /bin/bash for historic reasons, as it is a minimally-privileged user that offered to it is in the default for mechanism users. However, whatever little bit of security acquired by utilizing nobody is lost when multiple device users use it. It have to be feasible to adjust it come /sbin/nologin; the fastest way to check it is change it and see if the breaks any kind of services or applications.

usage the adhering to command to list which shells are assigned to all users, system and also human users, in /etc/passwd. The output varies follow to the services and users on your system:

tux > sort -t: -k 7 /etc/passwd | awk -F: "print $1" " $7" | column -ttux /bin/bashnobody /bin/bashroot /bin/bashavahi /bin/falsechrony /bin/falsedhcpd /bin/falsednsmasq /bin/falseftpsecure /bin/falselightdm /bin/falsemysql /bin/falsepostfix /bin/falsertkit /bin/falsesshd /bin/falsetftp /bin/falseunbound /bin/falsebin /sbin/nologindaemon /sbin/nologinftp /sbin/nologinlp /sbin/nologinmail /sbin/nologinman /sbin/nologinnscd /sbin/nologinpolkitd /sbin/nologinpulse /sbin/nologinqemu /sbin/nologinradvd /sbin/nologinrpc /sbin/nologinstatd /sbin/nologinsvn /sbin/nologinsystemd-coredump /sbin/nologinsystemd-network /sbin/nologinsystemd-timesync /sbin/nologinusbmux /sbin/nologinvnc /sbin/nologinwwwrun /sbin/nologinmessagebus /usr/bin/falsescard /usr/sbin/nologin




source directory—the beginning point of the brochure tree.


essential binary files, together as commands that are necessary by both the device administrator and also normal users. Usually likewise contains the shells, such as Bash.


Static documents of the boots loader.


papers needed to accessibility host-specific devices.


Host-specific system configuration files.


holds the home directories that all customers who have accounts ~ above the system. However, root"s home magazine is not located in /home but in /root.


vital shared libraries and kernel modules.


mount points because that removable media.


Mount allude for in the interim mounting a paper system.


Add-on application software packages.


Home catalog for the superuser root.


necessary system binaries.


Data because that services provided by the system.


momentary files.


second hierarchy through read-only data.


variable data such as log files.


Only obtainable if you have both Microsoft Windows* and Linux mounted on your system. Contains the home windows data.

The complying with list provides more detailed information and also gives some examples of i m sorry files and also subdirectories deserve to be discovered in the directories:


contains the simple shell commands that might be supplied both by root and by other users. These regulates include ls, mkdir, cp, mv, rm and rmdir. /bin additionally contains Bash, the default shell in smashville247.net Linux enterprise Server.


consists of data forced for booting, such as the boots loader, the kernel, and also other data that is used prior to the kernel starts executing user-mode programs.


Holds an equipment files that represent hardware components.


contains local configuration papers that control the operation of programs prefer the X home window System. The /etc/init.d subdirectory has LSB init script that can be executed during the boot process.


holds the personal data of every user who has actually an account ~ above the system. The files located here deserve to only be modified by their owner or by the mechanism administrator. By default, your e-mail directory and personal desktop configuration room located right here in the kind of covert files and directories, such together .gconf/ and .config.

Note: Home brochure in a Network Environment

If you room working in a network environment, her home magazine may it is in mapped to a magazine in the document system various other than /home.


contains the essential shared libraries necessary to boot the system and also to operation the regulates in the root file system. The Windows identical for mutual libraries space DLL files.


contains mount points for removable media, such together CD-ROMs, speed disks, and digital cameras (if they usage USB). /media normally holds any type of drive other than the difficult disk of her system. Once your removable medium has actually been placed or connected to the system and also has been mounted, you can accessibility it indigenous here.


This brochure provides a mount allude for a temporarily mounted file system. Root might mount file systems here.


booked for the surroundings of third-party software. Optional software and also larger add-on regime packages have the right to be uncovered here.


Home catalog for the source user. The personal data of source is located here.


A tmpfs directory used through systemd and various components. /var/run is a symbolic attach to /run.


together the s indicates, this brochure holds utilities because that the superuser. /sbin includes the binaries crucial for booting, restoring and also recovering the mechanism in enhancement to the binaries in /bin.


stop data because that services detailed by the system, such together FTP and also HTTP.


This directory is used by program that need temporary storage of files.

Important: cleaning up /tmp at boot Time

Data save in /tmp is not guaranteed to endure a device reboot. That depends, for example, on settings made in /etc/tmpfiles.d/tmp.conf.


/usr has nothing to do with users, but is the acronym for Unix system resources. The data in /usr is static, read-only data that can be shared among various master compliant v the Filesystem power structure Standard (FHS). This directory contains all applications programs consisting of the graphical desktops such together GNOME and also establishes a an additional hierarchy in the document system. /usr holds number of subdirectories, such together /usr/bin, /usr/sbin, /usr/local, and also /usr/share/doc.


contains generally easily accessible programs.


has programs reserved for the device administrator, such together repair functions.


In this brochure the system administrator deserve to install local, distribution-independent extensions.


Holds various smashville247.net files and the relax notes for her system. In the manual subdirectory find an online version of this manual. If more than one language is installed, this brochure may save on computer versions of the manuals for various languages.

Under packages discover the smashville247.net had in the software packages set up on her system. Because that every package, a subdirectory /usr/share/doc/packages/PACKAGENAME is created that frequently holds README records for the package and also sometimes examples, configuration records or added scripts.

If HOWTOs are set up on your mechanism /usr/share/doc also holds the howto subdirectory in which to find additional smashville247.net on many tasks pertained to the setup and operation of Linux software.


conversely, /usr hold static, read-only data, /var is for data i m sorry is written throughout system operation and also thus is variable data, such as log documents or spooling data. For summary of the most vital log documents you can find under /var/log/, describe Table 44.1, “Log Files”.


The first line begins with the Shebang characters (#!) which show that this document is a script. The interpreter, mentioned after the Shebang, executes the script. In this case, the specified interpreter is /bin/sh.


The second line is a comment beginning with the hash sign. We recommend that you comment an overwhelming lines. With appropriate commenting, you deserve to remember the function and duty of the line. Also, other readers will hopefully recognize your script. Commenting is considered an excellent practice in the advance community.


The third line offers the built-in command echo to print the corresponding text.

Every script have to contain a Shebang line (as in the example above). If the heat is missing, you need to contact the interpreter manually.

You can save the manuscript wherever you want. However, it is a great idea to conserve it in a magazine where the shell can discover it. The search course in a shell is established by the atmosphere variable PATH. Generally a typical user go not have actually write accessibility to /usr/bin. As such it is recommended to save your scripts in the users" brochure ~/bin/. The above example gets the name hello.sh.

The script requirements executable permissions. Set the permissions through the following command:

tux > chmod +x ~/bin/hello.sh

See more: What Aspects Of Roman Society Remained Similar From Republic To Empire 6

If you have fulfilled every one of the over prerequisites, you deserve to execute the script in the adhering to ways:

As absolute Path.  The script deserve to be executed through an pure path. In our case, that is ~/bin/hello.sh.

Everywhere.  If the PATH setting variable consists of the brochure where the script is located, you can execute the script with hello.sh.