[sf-lug] (forw) Re: todays meeting at enchanted cafe

jim jim at systemateka.com
Mon Jan 3 10:44:40 PST 2011



   as to the grammar of commands, here's an attempt 
at a brief summary. 
   in a terminal window one sees a prompt to indicate 
the presence of a command line. 
   it's helpful to ask the question "what software 
is working now?" in the case of the command line, it's 
a shell, the bash shell in most cases. all command 
line shells work in the same way. 
   the first thing you type must be a command. if 
you type  abc  or some other non-command-name, the 
shell will try to find it and finally report that it 
can't. think of the command as a verb. 
   as to the shell's interpretation, after the first 
thing you type (after the first space character), the 
shell treats the remainder of the command line as a 
set of things to pass to the command. there are some 
terms that are helpful: 
* the command itself is the "head" of the command line. 
* any other stuff on the command line is the "tail". 
* space characters separate the things on the command line. 
* every distinct thing on the command line is a "parameter". 
* the command is parameter 0; the other parameters are 
  sequentially numbered, 1, 2, 3.... 
* all parameters numbered 1 and greater are called 
  "arguments". 

   the shell interprets your command line in the following 
way. 
   it first looks for any special characters such as $ or 
" or ' or * or some such. if it finds any special 
characters, it follows its rules for that special character 
and change what you typed according to its rules for that 
character. you can investigate this by using the echo 
command. for example, 
$ echo * 
<filenames> 
$ echo $SHELL 
/bin/bash 
$ echo "$SHELL *" 
/bin/bash <filenames> 
$ echo '$SHELL *' 
$SHELL * 
$ 
   after the shell makes any changes to what you've 
typed on the command line, it tells the kernel to load 
the command into memory and then passes the command line 
tail to the command. for example, in the case of 
$ echo $SHELL * 
the shell changes the $SHELL to /bin/bash and then appends 
the names of all files listed in the current directory, in 
other words, alters the tail of the command line according 
to its rules for the $ character and the * character, and 
then loads the  echo  program into memory and passes the 
altered tail to the  echo  program. 
   the  echo  program does its thing, which is simply to 
show the command line tail it received to the display (on 
a line just below the command you typed). 

   generally, a command either presents a report about 
things or it changes things without making a report. for 
example, the  ls  command shows names that are listed in 
a directory; the  cp  command makes a copy of a file 
without giving any indication of its work (unless you've 
made an error in typing the command, in which case the 
cp  command displays an error report rather than doing 
something. 

   most commands are designed to look for options, and 
each command has its own set of options. 
   for commands that issue reports, typing the command 
by itself tells the command to issue a default report. 
to see possible options, type <command> --help 
$ ls --help 
<list of options> 
   for commands that change things, type the command 
with no arguments and the command will usually present 
what it needs for its arguments (some commands will 
present a default report). 
$ cp
<information appears about what to type in the tail> 
$ mount 
<the mount program presents a list of what's currently 
mounted> 

   remember that each command has its own options, 
generally written as a hyphen followed by some character. 
here are a few options for the  ls  command: 
$ ls -lat 
which could as wlll be written 
$ ls -tla 

   generally, the grammar for using commands is 
verb adverb noun(s), 
for example 
$ ls -atl /home 
$ ls -tal /home /bin /lib 
$ cp this that 
$ cp -R this that 




On Mon, 2011-01-03 at 09:58 -0800, Rick Moen wrote:
> Forwarding back to the public discussion.
> 
> ----- Forwarded message from Bobbie Sellers <bliss at sfo.com> -----
> 
> Date: Mon, 03 Jan 2011 08:29:11 -0800
> From: Bobbie Sellers <bliss at sfo.com>
> To: Rick Moen <rick at linuxmafia.com>
> Subject: Re: [sf-lug] todays meeting at enchanted cafe
> Reply-To: bliss at sfo.com
> Organization: none
> 
> On 01/03/2011 12:36 AM, Rick Moen wrote:
> 
> > If you just use the chown/chgrp commands, you can fix UID and GID
> > changes really easily.
>     I have problems with the grammar of the commands.
>     In other words I don't get it.  I prefer to work through the gui
> tools because
> though I may have to go around the barn to get the job done, the job
> gets done,
> 
>     And it may be that most people use their computers in ways at
> right angles
> to the way you use computers,  Vital files and data for you may be something
> completely different.  I will try to look at your intformation later
> but with
> the bad video driver even typing this little note is torment(due to
> slow response
> in several ways).
> 
>     later
>     Bobbie
> 
> ----- End forwarded message -----
> 
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
> Information about SF-LUG is at http://www.sf-lug.org/





More information about the sf-lug mailing list