Running Commands Flashcards Preview

Networking > Running Commands > Flashcards

Flashcards in Running Commands Deck (30):
1

Command line interface advantages...?

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

2

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.)

3

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.)

4

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.)

5

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)

6

ls /usr ...?

Simply lists the contents of the directory.

7

ls -s /usr ...?

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

8

ls -l /usr ...?

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

9

-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.)

10

Command line switch arguments simply follow the...?

Command line switch.

11

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

Short answer is through experience.

12

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

One

13

Multiple command line switches are simply...?

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

14

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

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

15

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 -

16

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.)

17

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.)

18

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.)

19

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.

20

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.)

21

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

--help

22

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.)

23

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

24

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

25

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.

26

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.

27

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.

28

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.

29

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.

30

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.