Running Commands Flashcards Preview

Networking > Running Commands > Flashcards

Flashcards in Running Commands Deck (30):

Command line interface advantages...?

Efficiency and flexibility. (Simplicity is not one of them.)


If commands entered on the command line were compared to English sentences, the commands could be thought of as...?

having verbs, adverbs, and direct objects. (The verb is the command to run, the adverbs are the various command line switches that can be used to modify the behavior of the command ("quietly", or "verbosely"), and any remaining words are the direct objects (what the command is supposed to act on). Again, as in languages, there are irregularities, and for almost every rule mentioned, there will be exceptions.)


First word of any command is generally the ...?

Name of a program that lives as a file somewhere in the filesystem. (For example, the previous lessons used the ps and who commands. If we want to know which file contains these programs, there is a program called which which can help us. The which command, followed by the name of another command, will tell you "which" file is being run.)


when running a command, the shell process asks...?

the kernel to execute the specified program as a separate process, and arranges the output (or, more correctly, the standard out stream) of the process to be written to the terminal. The shell then pauses until the command's process terminates. Once the command finishes, the shell prints another prompt, and waits to be told what to do next.)


Many commands can have their behavior modified by...?

Specifying different command line switches. (An easy example is the ls command, which is used to list the contents of a directory.) (Continued on next cards)


ls /usr ...?

Simply lists the contents of the directory.


ls -s /usr ...?

Includes the -s command line switch, gives the sizes of the content as well.


ls -l /usr ...?

Gives a "long" listing including all kinds of details about the files, such as ownerships, permissions, and modify times.


-s and -l, are single letter switches. These are referred to as...?

"short" command line switches. (Sometimes, short command line switches can also take an argument. For example, the ls command has a -w command line switch, which specifies how "wide" the output should be, in characters.)


Command line switch arguments simply follow the...?

Command line switch.


How do you know which command line switches take arguments and which don't?

Short answer is through experience.


More than ____ command switch can be used at a time.



Multiple command line switches are simply...?

bunched together, squeezed between the command and any command arguments.


Often, when using multiple command lines switches, users will take...?

Advantage of a shortcut that lets all switches be "piled together" onto one hyphen (-).


All of the single letter switches that don't take an argument, in this case -s and -r, can be piled together, sharing a...?

Single -


If a switch does take an argument, such as -w 40, it can only share a hyphen if it comes...?

last. (That way, its argument can be specified next on the command line.)


Long switches are composed of...?

Words (Rather than single letter switches, and rather than starting with a leading hyphen, long switches are proceeded by double hyphens (--). Some commands use only short switches, some commands use long. Many commands, including ls, handle some both.)


When long command line switches take an argument, the syntax differs slightly as well. Rather than the argument following the switch as a separate word, the argument is.?

bunched together with the long switch, separated by an =, as in --width=40. (Note also, that short and long command line switches can be mixed.)


Whatever words are left over on the command line, after the command name and after any command line switches, are called...?

arguments to the command.


What a command expects as arguments, or if it expects any at all, depend on...?

the command (For example, the ls command, if given arguments, will treat the arguments as the files or directories to be listed. The ps command expects no arguments. The cal command takes from zero to two, a possible month and a possible year to generate the calendar for. Learning what arguments a program excepts, and what it does with its argument, is part of learning how to use that command.)


Most commands support either the _____ long command like switch, or the -h or -? short command line switches



Some things to note in the usage message...?

- Optional elements are enclosed in square brackets ([ and ]).
- Here, the usage message refers to multiple short command line switches using the shortcut notation.
- Note the ls supports both the short (-s) and long (--size) forms of this command line switch.
- Here is the -w or --width command line switch, which requires an argument.
(Usage messages do not provide a complete reference for the command, but merely provide enough info to refresh memories.)


Which of the following would be a legitimate invocation of the touch command?
- touch -k /etc/services
- touch -ac /etc/services
- touch -nocreate /etc/services
- touch -t

Touch -ac /etc/services


Which of the following would be legitimate invocation of the touch command?
- touch -from /etc/services
- touch --cm /etc/services
- touch --no-create a /etc/services
- touch

touch --no-create -a /etc/services


What best describes why madonna got the "file arguments missing" error message when running touch -r /etc/services...?

The -r command line switch requires an argument, which madonna didn't supply.


What best describes why madonna got the "command not found" error message when running tooch /etc/services...?

madonna misspelled the command name, and no command name tooch could be found.


What best describes why madonna got the "invalid option" error message when running touch -k /etc/services?

The touch command doesn't support the -k command line switch.


When madonna ran the command touch -r /etc/services /tmp/foo, what best describes the role of the word /etc/services...?

The word serves as an argument to the -r command line switch.


When a user runs the command who from the command line, what happens...?

The shell asks the kernel to execute the contents of the file /usr/bin/who as a separate process, displaying the process's output on the terminal.


When long command line switches were introduced, what best describes why they were preceded with a double hyphen (such as --size) instead of a single hyphen (such as -size)....?

The word -size could be interpreted as a shortcut for the -s -i -z -e short command line switches, instead of a single long command line switch.