1. Where is the bash program located on your system?

    /bin/bash

    1. Use the —version option to find out which version you are running.

    bash-5.1$ bash —version
    GNU bash,版本 5.1.8(1)-release (x86_64-apple-darwin20.3.0)
    Copyright (C) 2020 Free Software Foundation, Inc.
    许可证 GPLv3+: GNU GPL 许可证第三版或者更新版本 [http://gnu.org/licenses/gpl.html](http://gnu.org/licenses/gpl.html>)

    本软件是自由软件,您可以自由地更改和重新发布。
    在法律许可的情况下特此明示,本软件不提供任何担保。

    1. Which shell configuration files are read when you login to your system using the graphical user interface and then opening a terminal window?
    • /etc/profile
    • ~/.bash_profile, ~/.bash_login or ~/.profile
    • ~/.bash_logout
    1. Are the following shells interactive shells? Are they login shells?
      • A shell opened by clicking on the background of your graphical desktop, selecting “Terminal” or such from a menu.

    是的,是登陆shell

    • A shell that you get after issuing the command ssh localhost.

    是的,是登陆

    • A shell that you get when logging in to the console in text mode.

    不是响应式,不是

    • A shell obtained by the command xterm &.

    是的

    • A shell opened by the mysystem.sh script.

    是的

    • A shell that you get on a remote host, for which you didn’t have to give the login and/or password because you use SSH and maybe SSH keys.

    是的

    1. Can you explain why bash does not exit when you type Ctrl+C on the command line?

    bash是解释语言。。ctrl+c 只是终止了执行shell还在啊

    1. Display directory stack content.

    dirs

    1. If it is not yet the case, set your prompt so that it displays your location in the file system hierarchy, for instance add this line to ~/.bashrc:
      export PS1\=”\u@\h \w> 设置在.bashrc里,意思是username@host where

    2. Display hashed commands for your current shell session.

    hash命令即可

    1. How many processes are currently running on your system? Use ps | wc, the first line of output of ps is not a process!

    ps -e | wc -l

    1. How to display the system hostname? Only the name, nothing more!

    hostname 命令

    The hostname is usually set once at system startup in the script /etc/init.d/hostname.sh normally by reading the contents of a file which contains the hostname, e.g., /etc/hostname.