📄 ch01_09.htm
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 1] 1.9 Which Shell Am I Running? </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly & Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly & Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:31:07Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch01_01.htm"TITLE="1. Introduction"><LINKREL="prev"HREF="ch01_08.htm"TITLE="1.8 There Are Many Shells "><LINKREL="next"HREF="ch01_10.htm"TITLE="1.10 Internal and External Commands "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_08.htm"TITLE="1.8 There Are Many Shells "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.8 There Are Many Shells "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 1<BR>Introduction</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_10.htm"TITLE="1.10 Internal and External Commands "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.10 Internal and External Commands "BORDER="0"></A></TD></TR></TABLE> <HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-1031">1.9 Which Shell Am I Running? </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-1141"></A>You can usually tell which family your shell belongs to by a characterin the promptit displays.Bourne-type shells usually have <CODECLASS="literal">$</CODE> in the prompt.The C shell uses <CODECLASS="literal">%</CODE>.(But <EMCLASS="emphasis">tcsh</EM> users often use <CODECLASS="literal">></CODE>.)</P><PCLASS="para">It's possible to<SPANCLASS="link">customize the prompt (<ACLASS="linkend"HREF="ch07_01.htm#UPT-ART-4820"TITLE="Why Change Your Prompt? ">7.1</A>)</SPAN>so that it displays additional information, but most users andsystem administrators will keep the convention of ending theprompt with the original prompt character.<ACLASS="indexterm"NAME="AUTOID-1150"></A><ACLASS="indexterm"NAME="AUTOID-1153"></A></P><PCLASS="para">To be certain, type one of these commands (the secondis for systems that use NIS, Sun's Network Information Service, tomanage network-wide files):</P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">% <CODECLASS="userinput"><B>grep <CODECLASS="replaceable"><I>yourloginname </I></CODE>/etc/passwd</B></CODE>% <CODECLASS="userinput"><B>ypcat passwd | grep <CODECLASS="replaceable"><I>yourloginname</I></CODE></B></CODE></PRE></BLOCKQUOTE></P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-1164"></A>You should get back the contents of your entry in the systempassword file.[2]For example:</P><BLOCKQUOTECLASS="footnote"><PCLASS="para">[2] That may match more than one entry.Searching for <EMCLASS="emphasis">tim</EM> could also find a user named <EMCLASS="emphasis">timothy</EM> or<EMCLASS="emphasis">fatima</EM>.A more accurate<SPANCLASS="link">regular expression (<ACLASS="linkend"HREF="ch26_01.htm#UPT-ART-7844"TITLE="That's an Expression ">26.1</A>)</SPAN>is <CODECLASS="literal">'^</CODE><CODECLASS="replaceable"><I>yourloginname</I></CODE><CODECLASS="literal">:'</CODE>.</P></BLOCKQUOTE><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">tim::23:10:Tim O'Reilly:/home/tim:/bin/csh</PRE></BLOCKQUOTE></P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-1179"></A>The fields are separated by colons. The lastfield should show the shell you are using.<EMCLASS="emphasis">/bin/csh</EM> (or <EMCLASS="emphasis">/usr/bin/csh</EM>) is the C shell,<EMCLASS="emphasis">/bin/sh</EM> is the Bourne shell (or Korn shell),and so forth.An empty last field defaults to the Bourne shell.</P><PCLASS="para">In case you're interested in the rest of the line,the first field shows your login name.The second stores your encrypted password, if any; this may be kept ina separate "shadow password" file.Thethird and fourth fields show your<SPANCLASS="link">user ID or UID (<ACLASS="linkend"HREF="ch38_03.htm"TITLE="Managing Processes: Overall Concepts ">38.3</A>)</SPAN>and<SPANCLASS="link">group ID or GID (<ACLASS="linkend"HREF="ch38_03.htm"TITLE="Managing Processes: Overall Concepts ">38.3</A>)</SPAN>,respectively. The fifth field often contains informationabout you, and the sixth your home directory.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">TOR</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_08.htm"TITLE="1.8 There Are Many Shells "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.8 There Are Many Shells "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_10.htm"TITLE="1.10 Internal and External Commands "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.10 Internal and External Commands "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">1.8 There Are Many Shells </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">1.10 Internal and External Commands </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed & awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -