Shell basics Flashcards

(24 cards)

1
Q

What does RTFM mean?

A

Read The F**king Manual

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

What is a Shebang?

A

A shebang is a character sequence consisting of the characters number sign and exclamation mark (#!) at the beginning of a script.
It is used to specify which program should be called to run the script and is also known as a “bang” line.

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

What is the shell?

A

A shell is a program that allows you to interact with your operating system.

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

What’s a terminal?

A

A terminal, on the other hand, is a program that provides a text-based interface to the shell.

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

What’s the difference between shell and terminal?

A

In other words, a terminal is a graphical interface to the shell, while the shell is the program that processes your commands. When you open a terminal program, it runs a shell in the background and provides you with a window where you can interact with the shell.

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

What is the shell prompt?

A

The shell prompt is a string of text displayed by the shell to indicate that it is ready to receive commands. It is the place where you can enter commands and interact with the shell. The prompt typically includes information about the user, the hostname, and the current working directory, and it is followed by a cursor, waiting for your input.

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

What is the root directory?

A

The root directory is the top-most directory in a computer file system, sometimes referred to as the parent directory or home directory.
It contains all other directories and files on a system and is marked by a slash (/).

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

Understanding the File System Tree

A

Unix-like operating system such as Linux organizes its files in what is called a hierarchical directory structure.

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

Absolute Pathnames

A

An absolute pathname begins with the root directory and follows the tree branch by
branch until the path to the desired directory or file is completed.

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

Relative Pathnames

A

Where an absolute pathname starts from the root directory and leads to its destination, a relative pathname starts from the working directory.
To do this, it uses a couple of special notations to represent relative positions in the file system tree. These special notations are “.” (dot) and “..” (dot dot).

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

. directory

A

The “.” notation refers to the working directory

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

.. directory

A

The “..” notation refers to the working directory’s parent directory.

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

cd Shortcuts

A

cd Changes the working directory to your home directory.

cd - Changes the working directory to the previous working directory.

cd ~user_name Changes the working directory to the home directory of user_name. For example, cd ~bob will change the directory to the home directory of user “bob.”

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

What is the difference between the root directory and the home directory of the user root?

A

The root directory is the topmost level of the system drive, denoted by a slash ‘/’.
The home directory of the root user is named “root” and is located below the root directory.
It is denoted by ‘~’ and has path “/users/ username”.

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

What does the ln command do?

A

The ln command is used to create either hard or symbolic links.

The following creates a hard link:
ln file link

The following creates a symbolic link:
ln -s item link

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

What is a link in linux?

A

Link is a special type of file in Linux that points to another file or folder on your computer, or a connected file system

17
Q

Hard link

A

Hard links are the original Unix way of creating links.
A hard link is indistinguishable from the file itself.
Hard links have two important limitations:

  1. A hard link cannot reference a file outside its own file system. This means a link cannot reference a file that is not on the same disk partition as the link itself.
  2. A hard link may not reference a directory.
18
Q

Symbolic Links

A

Symbolic links were created to overcome the limitations of hard links. Symbolic links work by creating a special type of file that contains a text pointer to the referenced file or directory.

19
Q

Wildcards

A

Wildcards in Linux are special characters that represent other characters and can be used with commands to list or remove files matching a pattern.

20
Q

What Exactly Are Commands?

A
  1. An executable program
  2. A command built into the shell itself.
  3. A shell function.
  4. An alias.
21
Q

type command

A

Display a Command’s Type

22
Q

which command

A

Display an Executable’s Location

23
Q

help command

A

Get Help for Shell Builtins

24
Q

man command

A

Display a Program’s Manual Page