Lea rning the Command Line

Michael Havens plug-discuss@lists.plug.phoenix.az.us
Mon, 10 Feb 2003 19:54:18 -0700


Thanks for the list of commands. Would you know of anything I should use =
to=20
put them into practice? Should I go to a college bookstore and buy a=20
textbook? I guess I should wait until I see what Jim is willing to give m=
e.

Things like this just boggle my mind:
1> for i in $(echo $PATH | tr ":" " ")
2> do
3>   ls $i
4> done

hmmm....
1 for i in $ <envirionment>(echo $<environment>PATH <print what is in=20
environment PATH>|tr :.....I;m lost.... wait....

1 for i in $ <envirionment>(echo $<environment>PATH <print what is in=20
environment PATH>|tr <translate~ I had to look at the man pages for tr>: =
<I=20
don't get what follows>
2 do <execute the following line>
3 ls $ <envirionment>i <Looks as if you are telling the machine that ....

Mind boggling!

On Sunday 09 February 2003 07:08 pm, Lynn David Newton wrote:
>   m> Does 'man bash' list all of the commands? If not,
>   m> how do you get a list of all the commands?
>
> There is no such thing as "all the commands". What you
> have available as executable commands depends on what
> is found by your PATH variable and what is installed on
> your machine. This is at minimum a couple thousand
> files. To get some idea, do this:
>
> for i in $(echo $PATH | tr ":" " ")
> do
>   ls $i
> done
>
> every word you see (with the exception of a few that
> might be directories) is an executable command in your
> path.
>
> Change the last line of that sequence to
>
> done | wc -w
>
> to get a count, if you're curious. In my environment
> the number is 4096.
>
> In addition, there are a great many more commands that
> are built right into your shell.
>
> Most people would say that's a few too many commands to
> get to know. They are right. You don't need to know
> more than a small fraction of those, and more than you
> need to know the half million or so words in the
> English language in order to speak English well.
>
> I will agree that the place to start is with the bash
> manual (assuming that's your shell). It will teach you
> not only the "words" (commands), but about the
> "grammar", the basics of the Unix way of doing things,
> with concepts about variables and parameters,
> redirection, pipes, and all that good stuff.
>
> Almost any standard reference you can find (many of
> them free online) will list a common set of useful
> commands of reasonable size.
>
> In fact ... I have attached (inline) a short list that
> I used as a handout to my classes in Linux/Unix at UAT
> last year. Keep in mind that this is a list of the ones
> *I* thought were important. Experts will disagree on
> some of the marginal commands, but if you know all of
> these, you will be able to go a long way:
>
> -------------------------------------------------------
>
>                             Unix Esperanto
>                             --------------
>
> The following is a list of commands that your instructor believes
> should be in every Unix user's basic vocabulary. Included are some
> commands that are not disk-based, but are internal to the shell.
>
> This list was culled out of over 4000 executable commands found in
> your instructor's PATH.
>
> alias      (n)  - substitute name for a command
> apropos    (1)  - search the whatis database for strings
> basename   (1)  - strip directory and suffix from filenames
> bash       (1)  - GNU Bourne-Again Shell
> cal        (1)  - displays a calendar
> case       (n)  - evaluate one of several choices
> cat        (1)  - concatenate files and print on the standard output
> cd         (n)  - Change working directory
> chgrp      (1)  - change group ownership
> chmod      (1)  - change file access permissions
> chown      (1)  - change file owner and group
> cksum      (1)  - checksum and count the bytes in a file
> clear      (1)  - clear the terminal screen
> cmp        (1)  - compare two files
> cp         (1)  - copy files and directories
> cut        (1)  - remove sections from each line of files
> date       (1)  - print or set the system date and time
> df         (1)  - report filesystem disk space usage
> diff       (1)  - find differences between two files
> dirname    (1)  - strip non-directory suffix from file name
> du         (1)  - estimate file space usage
> echo       (1)  - display a line of text
> emacs      (1)  - GNU project Emacs
> env        (1)  - run a program in a modified environment
> eval       (n)  - evaluate string and numeric expressions
> exec       (n)  - overlay current process
> exit       (n)  - cause normal program termination
> export     (n)  - make variables global in sub-shells
> fc         (n)  - fix command by editing it
> fg         (n)  - foreground
> file       (1)  - determine file type
> find       (1)  - search for files in a directory hierarchy
> for        (n)  - for loop
> ftp        (1)  - Internet file transfer program
> gawk       (1)  - pattern scanning and processing language
> gcc        (1)  - GNU project C and C++ Compiler (gcc - 2.96)
> grep       (1)  - print lines matching a pattern
> head       (1)  - output the first part of files
> help       (n)  - bash builtin command help
> history    (n)  - shell history
> host       (1)  - DNS lookup utility
> id         (1)  - print real and effective UIDs and GIDs
> if         (n)  - execute scripts conditionally
> info       (1)  - read Info documents
> jobs       (n)  - shell job control
> kill       (1)  - terminate a process
> ksh        (1)  - Public domain Korn shell
> ln         (1)  - make links between files
> login      (1)  - sign on
> lp         (1)  - send requests to an LPRng print service
> lpq        (1)  - spool queue examination program
> lpr        (1)  - off line print
> ls         (1)  - list directory contents
> man        (1)  - format and display the on-line manual pages
> md5sum     (1)  - compute and check MD5 message digest
> mkdir      (1)  - make directories
> more       (1)  - file perusal filter for crt viewing
> mv         (1)  - move (rename) files
> nohup      (1)  - run a command immune to hangups
> passwd     (1)  - update a user's authentication tokens(s)
> popd       (n)  - pop current directory off stack
> ps         (1)  - report process status
> pushd      (n)  - push current directory on stack
> pwd        (1)  - print name of current/working directory
> read       (n)  - read a variable from stdin
> return     (n)  - return from a function
> rm         (1)  - remove files or directories
> rmdir      (1)  - remove empty directories
> sed        (1)  - a Stream EDitor
> set        (n)  - display and set positional parameters
> shift      (n)  - move positional parameters
> sleep      (1)  - delay for a specified amount of time
> sort       (1)  - sort lines of text files
> ssh        (1)  - OpenSSH SSH client (remote login program)
> sum        (1)  - checksum and count the blocks in a file
> tail       (1)  - output the last part of files
> tee        (1)  - read from stdin and write to stdout and files
> telnet     (1)  - user interface to the TELNET protocol
> test       (1)  - check file types and compare values
> touch      (1)  - change file timestamps
> tr         (1)  - translate or delete characters
> type       (n)  - show pathnames of commands
> typeset    (n)  - declare shell variables with attributes
> ulimit     (n)  - get and set user limits
> umask      (n)  - set file creation mask
> unalias    (n)  - turn off alias(es)
> uname      (1)  - print system information
> uniq       (1)  - remove duplicate lines from a sorted file
> unset      (n)  - delete variables
> until      (n)  - execute until a condition is true
> vim        (1)  - Vi IMproved, a programmers text editor
> wait       (n)  - wait for process termination
> wc         (1)  - print the number of bytes, words, lines in files
> whatis     (1)  - search the whatis database for complete words
> whereis    (1)  - locate binary, source, man page for command
> which      (1)  - show full path of commands
> while      (n)  - execute as long as condition is true
> who        (1)  - show who is logged on
> whoami     (1)  - print effective userid
> whois      (1)  - query a whois or nicname database
> xargs      (1)  - build and execute command lines from standard input
> xterm      (1x)  - terminal emulator for X (graphical program)

--=20
:-)~Mike~(-: