Linux Shell

What is The Shell?

Traditionally, the shell is Bash (Bourne again Shell). When this chapter speaks about the shell it means Bash. There are actually more available shells than Bash (ash, csh, ksh, zsh, …), each employing different features and characteristics. If you need further information about other shells, search for shell in YaST.

7.1.1Knowing The Bash Configuration Files

A shell can be invoked as an:

  1. Interactive login shell This is used when logging in to a machine, invoking Bash with the –login option or when logging in to a remote machine with SSH.
  2. Ordinary interactive shell This is normally the case when starting xterm, konsole, gnome-terminal or similar tools.
  3. Non-interactive shell This is used when invoking a shell script at the command line.

Depending on which type of shell you use, different configuration files are being read. The following tables show the login and non-login shell configuration files.

Table 7-1 Bash Configuration Files for Login Shells

File Description
/etc/profile Do not modify this file, otherwise your modifications can be destroyed during your next update!
/etc/profile.local Use this file if you extend /etc/profile
/etc/profile.d/ Contains system-wide configuration files for specific programs
~/.profile Insert user specific configuration for login shells here

Table 7-2 Bash Configuration Files for Non-Login Shells

/etc/bash.bashrc Do not modify this file, otherwise your modifications can be destroyed during your next update!
/etc/bash.bashrc.local Use this file to insert your system-wide modifications for Bash only
~/.bashrc Insert user specific configuration here

Additionally, Bash uses some more files:

Table 7-3 Special Files for Bash

File Description
~/.bash_history Contains a list of all commands you have been typing
~/.bash_logout Executed when logging out

7.1.2The Directory Structure

The following table provides a short overview of the most important higher-level directories that you find on a Linux system. Find more detailed information about the directories and important subdirectories in the following list.

Table 7-4 Overview of a Standard Directory Tree

Directory Contents
/ Root directory—the starting point of the directory tree.
/bin Essential binary files, such as commands that are needed by both the system administrator and normal users. Usually also contains the shells, such as Bash.
/boot Static files of the boot loader.
/dev Files needed to access host-specific devices.
/etc Host-specific system configuration files.
/home Holds the home directories of all users who have accounts on the system. However, root’s home directory is not located in /home but in /root.
/lib Essential shared libraries and kernel modules.
/media Mount points for removable media.
/mnt Mount point for temporarily mounting a file system.
/opt Add-on application software packages.
/root Home directory for the superuser root.
/sbin Essential system binaries.
/srv Data for services provided by the system.
/tmp Temporary files.
/usr Secondary hierarchy with read-only data.
/var Variable data such as log files.
/windows Only available if you have both Microsoft Windows* and Linux installed on your system. Contains the Windows data.

The following list provides more detailed information and gives some examples of which files and subdirectories can be found in the directories:

/bin

Contains the basic shell commands that may be used both by root and by other users. These commands include ls, mkdir, cp, mv, rm and rmdir. /bin also contains Bash, the default shell in SUSE Linux Enterprise Server.

/boot

Contains data required for booting, such as the boot loader, the kernel, and other data that is used before the kernel begins executing user-mode programs.

/dev

Holds device files that represent hardware components.

/etc

Contains local configuration files that control the operation of programs like the X Window System. The/etc/init.d subdirectory contains scripts that are executed during the boot process.

/home/username

Holds the private data of every user who has an account on the system. The files located here can only be modified by their owner or by the system administrator. By default, your e-mail directory and personal desktop configuration are located here in the form of hidden files and directories. KDE users find the personal configuration data for their desktop in .kde4, GNOME users find it in .gconf.

NOTE: Home Directory in a Network Environment

If you are working in a network environment, your home directory may be mapped to a directory in the file system other than /home.

/lib

Contains the essential shared libraries needed to boot the system and to run the commands in the root file system. The Windows equivalent for shared libraries are DLL files.

/media

Contains mount points for removable media, such as CD-ROMs, USB sticks and digital cameras (if they use USB)./media generally holds any type of drive except the hard drive of your system. As soon as your removable medium has been inserted or connected to the system and has been mounted, you can access it from here.

/mnt

This directory provides a mount point for a temporarily mounted file system. root may mount file systems here.

/opt

Reserved for the installation of third-party software. Optional software and larger add-on program packages can be found here.

/root

Home directory for the root user. The personal data of root is located here.

/sbin

As the s indicates, this directory holds utilities for the superuser. /sbin contains the binaries essential for booting, restoring and recovering the system in addition to the binaries in /bin.

/srv

Holds data for services provided by the system, such as FTP and HTTP.

/tmp

This directory is used by programs that require temporary storage of files.

IMPORTANT: Cleaning up /tmp at Boot Time

Data stored in /tmp are not guaranteed to survive a system reboot. It depends, for example, on settings in/etc/sysconfig/cron.

/usr

/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 hosts compliant with the Filesystem Hierarchy Standard (FHS). This directory contains all application programs and establishes a secondary hierarchy in the file system. KDE4 and GNOME are also located here. /usr holds a number of subdirectories, such as /usr/bin, /usr/sbin,/usr/local, and /usr/share/doc.

/usr/bin

Contains generally accessible programs.

/usr/sbin

Contains programs reserved for the system administrator, such as repair functions.

/usr/local

In this directory the system administrator can install local, distribution-independent extensions.

/usr/share/doc

Holds various documentation files and the release notes for your system. In the manual subdirectory find an online version of this manual. If more than one language is installed, this directory may contain versions of the manuals for different languages.

Under packages find the documentation included in the software packages installed on your system. For every package, a subdirectory /usr/share/doc/packages/packagename is created that often holds README files for the package and sometimes examples, configuration files or additional scripts.

If HOWTOs are installed on your system /usr/share/doc also holds the howto subdirectory in which to find additional documentation on many tasks related to the setup and operation of Linux software.

/var

Whereas /usr holds static, read-only data, /var is for data which is written during system operation and thus is variable data, such as log files or spooling data. For an overview of the most important log files you can find under /var/log/, refer to Table 35-1.

source: https://www.suse.com/documentation/sles11/book_sle_admin/data/sec_adm_whatistheshell.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s