The Shell Flashcards

1
Q

What is the “Shell”?

A

The Shell describes the “outer” part of the operating system, the things the end user gets in contact with. In contrast to the kernel, which is nothing one can “touch”, it provides input and output methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which types of shells are there?

A

There are not only text-mode shells (CLI), but also the graphical interface can be described as a shell.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Name examples for shells

A

csh, tcsh, bash, sh and ksh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What was one of the first shells called and how was it named after the GNU project rewrote it?

A

Bourne shell (1977). When the GNU project was created, it rewrote the Bourne shell as Bourne Again Shell (bash), which is still widely used on different flavours of Linux as well as Android.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s the aim of the C shell?

A

Providing similar syntax and input mechanisms as C programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which ability do all shells provide?

A

The ability to save several commands into a file and run that later on (script). A script may thus require a certain shell to be invoked.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do you see when you fire up a shell?

A

kwmuser@localhost:~$ _

You can see the currently logged on username, followed by an at sign and the hostname of the computer. After the colon , the current working directory is displayed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which sign represents your home folder?

A

~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Where can you find your home directory as regular user?

A

/home/USERNAME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where can you find your home directory as root user?

A

/root

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How is a command usually made up?

A

A command is usually crafted of its name and optionally arguments. (

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you know which part of a command is the argument?

A

Arguments are usually prefixes with a dash - or two dashes for the long format –.

Example: ls -l

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which concept does Linux have for its users?

A

Linux has a user/group concept. That means that users can belong to one or several groups, groups can thus hold one or several users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the most powerful user account, present on every Linux installation?

A

the “root” account

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Who or what is root?

A

The most powerful user account, present on every Linux installation. “root” has the power to overrule everything and thus the potential to destroy the complete system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Can I assign a regular user with “root” permissions?

A

Regular user accounts do not have “root” permissions, but it might be allowed to gain super user (“root”) capabilities on a temporary basis.

17
Q

What’s root’s UID?

A

0

18
Q

What are the IDs of regular users?

A

Such accounts usually start at user ID 1000

19
Q

Where are user account information (including encrypted

passwords) stored?

A

/etc/passwd and /etc/shadow

20
Q

What’s the opposit of saving a password as clear text?

A

Saving it hashed (encrypted)

21
Q

Why does Linux have groups?

A

The grouping mechanism makes it easier to manage large amounts of users, for instance by putting all users of a given department into one group
Groups can then also be assigned certain access rights on the file system, so that all users belonging to the group share certain permissions.

22
Q

Where are the group’s IDs and other information stored?

A

in /etc/group

23
Q

Where are permissions needed in Linux?

A
  • Linux has permissions everywhere
  • Every file and every directory has certain permissions
  • User- and group ownership
  • Rights for user, group and everyone else
24
Q

What do you know about Permission if you read this:

drwxr-xr-x 2 kwmuser users 12288 Mar 7 09:14 VL1

A

The first column on the very left side lists the type of file or directory. A “d” represents a directory, while the dash indicates a regular file. The next three columns are the permissions for the owner, followed by the group permissions and the world (everyone else) permissions.
The next column represents the count of files/directories linked to the file, 2 links for the directory in this case, 1 link for the regular file. The owner of both entries is “kwmuser” with the group “users”. The remaining columns list file size, date and time. The last column is the name of the directory/file.

25
Q

What does the triplets rwx mean?

A
  • “r” or “4” indicates permission to read a file
  • “w” or “2” permission to write the file.
  • If it is a script or a program, it must be executable. This is indicated by the “x” or “1”.
  • if there is no permission for the relevant part you use a dash (-)
26
Q

Except for the letter triplet how could you also represent permissions?

A

With numbers.

  • “r” = “4” (read)
  • “w” = “2” (write)
  • “x” = “1” (execute)

For each triplet you just calculate the permissions by adding the numbers. So a “7” would mean that permission for reading, writing and executing are given.
One number can replace a complete permission triplet, specifying 755

27
Q

What does the permission 664 mean?

A

Permissions of rw-rw-r– or 664 mean that the user and members of the group are allowed to read and write to this file, while all others are only allowed to read it.

28
Q

What is the difference in starting a system program and another program?

A

A program is started by typing its name on the command line. In the case of system programs, that are programs which are in the search path of the operating system, this is sufficient. In all other cases, the full path to the program must be typed.

29
Q

What is the PATH variable?

A

Linux searches for programs you type on the command line without full path in specific locations on your file system. If it finds the program there, it is executed. There is the environment variable “PATH”, which can be overridden or modified to change the behaviour of this mechanism. Only the first match is returned if you have multiple versions of an executable.

30
Q

What is an absolute path?

A

Absolute paths, always starting with “/”, refer to the same file or directory no matter what the current directory is.

Example: /home/kwmuser/file.txt

31
Q

What is a relative path?

A

Relative paths depend on the current working directory. Every directory listing using ls contains two special directories: . and … The first one always refers to the current directory, while the latter refers to the parent directory.

32
Q

If you get feedback for a command you entered: Is that a good or bad sign?

A

Most commands print no output on success! If you get no feedback, then the operation was usually successful.
Only if there are errors, an error message is printed on the screen.

33
Q

What is vi?

A

“vi” is one of the oldest editors for the command line currently available. It was ported to a wide range of operating systems and architectures (including Windows).

Nowadays, “vi” is often a symlink to “vim” (“vi improved”). Due to the design of the interface, it can be a bit difficult for beginners, but once you get the basics, it is a quick and comfortable editor with a small memory footprint.

34
Q

What are the two modes of vi(m)? How do you switch?

A

After startup, you are in command mode. If you press “i”, “vi” changes to insert mode.
You can press “ESC” at any time to switch from insert mode back to command mode.

35
Q

What does it mean if you are in command mode in vi(m)?

A

That means that the letters you type are not printed to the screen, but are used to control the behaviour of the program.

36
Q

What does it mean if you are in insert mode in vi(m)?

A

You are able to type your text as usual on the screen.

37
Q

What is nano?

A

“nano” is a small, but powerful command line editor that provides sort of a graphical interface. On newer versions of Ubuntu, “nano” is the default console editor for editing configuration files.

38
Q

What is better: vi or nano?

A

nano is easier to use than “vi”, but on smaller systems, due to their limited storage size, often not available.