Challenging Concepts Flashcards

1
Q

4 main rights of the GNU GPL License

A
  • The right to download and run the software freely.
  • The right to make changes to the software as desired.
  • The right to redistribute copies of the software.
  • The right to modify and distribute copies of new versions of the software.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

4 main characteristics of the GNU GPL License

A
  1. Copyleft: The GPL is a copyleft license, which means that any derivative works or modifications made to the original software must also be licensed under the GPL. This ensures that the software and its derivatives remain free and open source.
  2. Source Code Availability: The GPL requires that the source code of the software be made available to users. This allows users to study, modify, and distribute the software.
  3. Distribution of License: When distributing software under the GPL, the license terms must be included along with the software. This ensures that recipients are aware of their rights and obligations under the GPL.
  4. Compatibility with Other GPL-Licensed Software: The GPL is designed to be compatible with other GPL-licensed software. This means that if you combine or link GPL-licensed software with other GPL-licensed software, the resulting work must also be licensed under the GPL.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

2 main license types

A
  1. Copyleft Licenses (e.g., GNU GPL): Copyleft licenses are designed to ensure that software and its derivatives remain free and open source.
  2. Permissive Licenses (e.g., Apache, BSD, MIT): Permissive licenses, on the other hand, have fewer restrictions compared to copyleft licenses.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Ways open source software may not be free:

A
  1. Licensing Restrictions: While open source software grants certain freedoms, it is still subject to licensing terms. Users must comply with the specific requirements outlined in the chosen open source license, such as attribution or copyleft provisions.
  2. Support and Maintenance Costs: Although the software itself may be freely available, users may incur costs for support, maintenance, or additional services related to the open source software. These costs can vary depending on the specific software and the level of support required.
  3. Compatibility and Integration Challenges: Integrating open source software into existing systems or ensuring compatibility with other proprietary software may require additional effort and resources. This can result in costs associated with customization or development work.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Creative Commons about?

A

Creative Commons is an organization that offers licenses allowing creators to share their work while retaining certain rights. These licenses provide flexibility and allow creators to choose the permissions they want to grant. By using Creative Commons licenses, creators can easily communicate how their work can be used, shared, and adapted. This promotes collaboration, creativity, and the sharing of knowledge and culture. However, it’s important to note that Creative Commons licenses work within existing copyright law and do not replace it.

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

Linux Software for Image Editing

A
  • GIMP (GNU Image Manipulation Program) is a powerful open-source image editing software.- It offers a wide range of features for photo retouching, image composition, and image authoring.- GIMP supports various file formats and provides tools for advanced editing, such as layers, filters, and customizable brushes.- It has an active community and a large number of plugins and scripts available for extending its functionality.
  • Others: Krita, Inkscape, Darktable, Shotwell, RawTherapee
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Popular Vector Graphics (Linux):

A
  • Inkscape is a popular open-source vector graphics editor.- It provides a comprehensive set of tools for creating and editing vector-based artwork.- Inkscape supports SVG (Scalable Vector Graphics) as its native file format and can import/export other vector and raster formats.- It offers features like shape manipulation, text support, gradients, and advanced path editing.- Inkscape is known for its user-friendly interface and its ability to handle complex vector graphics projects.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Linux software for 3D Animation

A
  • Blender is a versatile open-source 3D animation suite.- It offers a wide range of features for modeling, animation, rendering, and post-production.- Blender supports various 3D file formats and provides tools for creating realistic animations, visual effects, and simulations.- It has a powerful node-based material and compositing system, making it suitable for advanced 3D projects.- Blender has an active community and is widely used in the animation and visual effects industry.
  • Other: Krita, Synfig Studio, Natron, Pencil2D
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Linux Webserver Software

A
  • Apache HTTP Server is a widely used open-source web server software.- It is known for its stability, security, and flexibility, supporting various modules and configurations.- Apache is highly customizable and can handle a large number of concurrent connections.- NGINX is another popular open-source web server known for its high performance and scalability.
  • NGINX is often used as a reverse proxy or load balancer, efficiently handling high traffic volumes.- Both Apache and NGINX have extensive documentation and active communities for support.
  • Reverse proxy manages client requests on behalf of backend servers, providing additional functionality such as load balancing, SSL termination, and security. On the other hand, a load balancer specifically focuses on distributing incoming traffic across multiple servers to optimize performance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Linux applications for: image editing, vector graphics, 3d animation , and Linux Webservers

A

GIMP, Inkscape, Blender, Apache NGINX

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

Linux applications used as a cloud computing client in the web browser

A
  1. OwnCloud: OwnCloud is a self-hosted cloud storage platform that allows users to access and manage their files, calendars, contacts, and more through a web interface. It provides features similar to popular cloud storage services like Dropbox or Google Drive.
  2. Nextcloud: Nextcloud is another self-hosted cloud platform that offers file synchronization, sharing, and collaboration features. It also provides additional functionalities such as calendar and contact management, document editing, and video conferencing.
  3. Seafile: Seafile is a cloud storage and file synchronization platform that can be self-hosted or used with their cloud service. It offers features like file sharing, collaboration, and version control.
  4. Pydio: Pydio (formerly known as AjaXplorer) is an open-source file sharing and synchronization platform. It allows users to access, share, and collaborate on files through a web interface.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Where the OS is stored on a Raspberry PI

A

The microSD card serves as the primary storage medium for the Raspberry Pi’s operating system, system files, and user data.

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

Creative Commons is about

A

Putting the control back into the hands of the author
Creative Commons is a licensing framework that allows creators to specify the permissions for others to use their work. It offers a range of licenses, from more permissive to restrictive, governing how content can be shared, modified, and used, while still retaining some rights.

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

What the ‘.’ and ‘..’ files represent

A

. (Dot): This entry refers to the current directory. When you see . in a directory listing, it indicates the directory itself.

.. (Double Dot): This entry refers to the parent directory. If you’re navigating through a file system, .. takes you up one level in the directory hierarchy.

if you’re in the directory /home/user/documents, then . refers to /home/user/documents, and .. refers to /home/user.

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

4 reasons why the space character is significant to the shell

A
  1. Command Parsing: The shell uses spaces to parse commands into distinct elements. Each element typically corresponds to a command, an option, or an argument.
  2. Word Separation: Commands and their arguments are separated by spaces. For example, in the command ls -l, ls is the command, and -l is an option passed to that command. The space helps the shell recognize these as separate words.
  3. Path Separation: When specifying file paths or directory names as arguments, spaces are used to separate different parts of the path. Quotation marks can be used to include spaces within a single argument, ensuring that the entire path is treated as a single entity.
  4. Redirection and Pipes: Spaces are used to separate different parts of a command when redirecting input/output or chaining commands together using pipes. For example, command1 > output.txt or command1 | command2.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why Windows file extensions are meaningless to the shell

A

In a command shell or terminal environment, file extensions are generally considered part of the file name and don’t inherently convey the type or purpose of the file in the same way they might in graphical file managers.

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

How to ‘wrap’ a long command in the terminal

A

To “wrap” or break a long command into multiple lines in the terminal, you can use the backslash \ character at the end of each line.
It’s important to note that there should be no space after the backslash; it should be the last character on the line.

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

The linked pages for the info command are called nodes

A

Linked Pages: The documentation presented by the info command is not a single, linear document. Instead, it consists of interconnected pages or nodes, where each node covers a particular aspect or topic. These nodes are linked together to facilitate navigation.

Info Command: The info command is a text-based documentation viewer in Unix-like operating systems. It allows users to access and navigate through detailed information about various commands, programs, and concepts.

Nodes: In the context of the info command, a “node” is a unit of information that corresponds to a specific topic or section within the documentation. Nodes are interconnected, allowing users to move from one node to another to explore related information.

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

The difference between an absolute and relative path

A

Absolute Path:

Specifies the complete path from the root directory to the target file or directory.
Always starts from the root directory (designated by a forward slash, / in Unix-like systems) and includes all the directories in the path.
Provides a full and unambiguous description of the file or directory location.
Examples:
Unix/Linux: /home/user/documents/file.txt
Windows: C:\Users\User\Documents\file.txt
Relative Path:

Specifies the path to the target file or directory relative to the current working directory.
Does not start from the root directory; instead, it’s based on the current location in the file system.
May be shorter and more convenient but depends on the context of the current working directory.
Examples:
If the current directory is /home/user/:
documents/file.txt (Unix/Linux)
Documents\file.txt (Windows)

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

Explain the key aspects of File Hierarchy Standard (FHS) and how that relates to a user’s /home folder

A

The File Hierarchy Standard (FHS) is a set of guidelines and conventions that dictate the structure of the file system on Unix-like operating systems. The FHS helps ensure consistency and interoperability across different Unix and Linux distributions. It defines the organization and placement of files and directories in the filesystem hierarchy.

Key aspects of the FHS include:

  1. /: Root Directory:
    • The top-level directory in the file system hierarchy.
    • All other directories and files are organized beneath the root directory.
  2. /bin: Essential User Binaries:
    • Contains essential binaries (executable files) required for system recovery and maintenance.
  3. /etc: Configuration Files:
    • Contains system-wide configuration files and shell scripts used by system administrators.
  4. /home: User Home Directories:
    • Contains home directories for users.
    • Each user typically has a subdirectory under /home with their username (e.g., /home/user1, /home/user2).
  5. /usr: User Binaries and Read-Only Data:
    • Contains user-related programs, libraries, documentation, etc.
    • Often includes subdirectories like /usr/bin, /usr/lib, and /usr/share.
  6. /var: Variable Files:
    • Contains variable data files, such as log files and temporary files.

Now, regarding a user’s /home folder:

  • The /home directory is specifically designated for user home directories.
  • Each user typically has a subdirectory within /home named after their username (e.g., /home/user1).
  • The user’s home directory is where personal files, documents, and user-specific configurations are stored.

The /home directory, as outlined by the FHS, provides a standardized location for user home directories, making it easier for system administrators and users to locate and manage their personal files. The FHS contributes to the consistency and compatibility of file system organization across different Unix and Linux distributions.

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

Where do you find documentation on installed software packages

A
  • Man Pages (Manual Pages):
    The primary source of documentation for command-line programs.
    Accessible by using the man command followed by the name of the program.
    Example: man ls to view the manual page for the ls command.
    Info Pages:
  • Info Pages:
    Some software packages provide documentation in the info format.
    Accessible using the info command followed by the name of the program.
    Example: info gcc to view the documentation for the GCC compiler.
    Documentation Directories:
  • Documentation Directories:
    Many packages include documentation files installed in standard directories like /usr/share/doc or /usr/share/man.
    Check these directories for README files, manuals, and other documentation related to installed software.
    Configuration Files:
  • Configuration Files:
    Some software packages store documentation in their configuration directories.
    Check the installation directory or configuration directory for files like README, INSTALL, or other documentation files.
    Online Resources:
  • Online Resources:
    Visit the official website or documentation repository for the software.
    Online documentation is often available on project websites or community forums.
    Package Manager Commands:
  • Package Manager Commands:
    Use package manager commands to show information about installed packages.
    Example: dpkg -L <package-name> or rpm -ql <package-name> to list installed files, which may include documentation.
    Help Option:</package-name></package-name>
  • Help Option:
    Some programs support a –help option that provides a summary of command-line options.
    Example: <command></command> –help to display a brief help message.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the default level of compression for the zip command by option (hint: man zip)

A

The default compression level for the zip command is typically set to “normal” compression. In the zip command’s manual (man zip), you can find information about the available compression levels.

You can, however, specify a compression level using the -X option, followed by a numeric value from 0 to 9, where 0 is no compression and 9 is maximum compression.

zip -X9 archive.zip file1 file2 directory/

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

tar

A

tar: The tar command in Unix-like operating systems is used for archiving and compressing files and directories.

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

tar, -c and -x options, -j, -J, and -z options, the -f option

A

Options:
- -c: Create a new archive.
- -x: Extract files from an archive.
- -z: Compress the archive using gzip.
- -j: Compress the archive using bzip2.
- -J: Compress the archive using xz.
- -f: Specifies the filename of the archive.Options:

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

Breakdown:
~~~
tar -cvf archive.tar file1 file2 directory/
```

A

Create an Archive (-c):

tar -cvf archive.tar file1 file2 directory/
  

- -c: Create a new archive.
- -v: Verbose mode (optional, shows the files being archived).
- -f archive.tar: Specifies the filename of the archive.
- file1 file2 directory/: List of files and directories to be included in the archive.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Breakdown:

tar -xvf archive.tar
  
A

Extract from an Archive (-x):

tar -xvf archive.tar
  

- -x: Extract files from an archive.
- -v: Verbose mode (optional, shows the files being extracted).
- -f archive.tar: Specifies the filename of the archive.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Breakdown:

tar -czvf archive.tar.gz file1 file2 directory/
  
A

Create a Compressed Archive (-cz for gzip, -cj for bzip2, -cJ for xz):

tar -czvf archive.tar.gz file1 file2 directory/
  

- -c: Create a new archive.
- -z: Compress the archive using gzip.
- -v: Verbose mode (optional, shows the files being archived).
- -f archive.tar.gz: Specifies the filename of the compressed archive.
- file1 file2 directory/: List of files and directories to be included in the archive.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Breakdown:

tar -xzvf archive.tar.gz
  
A

Extract from a Compressed Archive (-xz for gzip, -xj for bzip2, -xJ for xz):

tar -xzvf archive.tar.gz
  

- -x: Extract files from an archive.
- -z: Decompress the archive using gzip.
- -v: Verbose mode (optional, shows the files being extracted).
- -f archive.tar.gz: Specifies the filename of the compressed archive.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

The exact order of files that follow

A

tar: The tar command in Unix-like operating systems is used for archiving and compressing files and directories.

Order of Options and Files:

  1. Create an Archive (-c):
    tar -cvf archive.tar file1 file2 directory/

    • -c: Create a new archive.
    • -v: Verbose mode (optional, shows the files being archived).
    • -f archive.tar: Specifies the filename of the archive.
    • file1 file2 directory/: List of files and directories to be included in the archive.
  2. Extract from an Archive (-x):
    tar -xvf archive.tar

    • -x: Extract files from an archive.
    • -v: Verbose mode (optional, shows the files being extracted).
    • -f archive.tar: Specifies the filename of the archive.
  3. Create a Compressed Archive (-cz for gzip, -cj for bzip2, -cJ for xz):
    tar -czvf archive.tar.gz file1 file2 directory/

    • -c: Create a new archive.
    • -z: Compress the archive using gzip.
    • -v: Verbose mode (optional, shows the files being archived).
    • -f archive.tar.gz: Specifies the filename of the compressed archive.
    • file1 file2 directory/: List of files and directories to be included in the archive.
  4. Extract from a Compressed Archive (-xz for gzip, -xj for bzip2, -xJ for xz):
    tar -xzvf archive.tar.gz

    • -x: Extract files from an archive.
    • -z: Decompress the archive using gzip.
    • -v: Verbose mode (optional, shows the files being extracted).
    • -f archive.tar.gz: Specifies the filename of the compressed archive.

The order of options and the filename (-f option) should come immediately after the tar command. The list of files and directories to be archived or extracted follows the options and the filename.

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

STDIN (Standard Input):
- File Descriptor Number:
- Purpose: STDIN is the

A

STDIN (Standard Input):
- File Descriptor Number: 0
- Purpose: STDIN is the standard input stream. It is the source of input for commands or processes. When you type from the keyboard or redirect input from a file, the data flows through STDIN.

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

STDOUT (Standard Output):
- File Descriptor Number:
- Purpose: STDOUT is the

A

STDOUT (Standard Output):
- File Descriptor Number: 1
- Purpose: STDOUT is the standard output stream. It is the default destination for the normal output of commands. When a command executes successfully, its output is directed to STDOUT. By default, STDOUT is displayed on the terminal.

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

STDERR (Standard Error):
- File Descriptor Number:
- Purpose: STDERR is the

A

STDERR (Standard Error):
- File Descriptor Number: 2
- Purpose: STDERR is the standard error stream. It is used for error messages and diagnostics. When a command encounters an error, the error message is sent to STDERR. Like STDOUT, STDERR is also, by default, displayed on the terminal.

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

Redirecting and Managing Streams:
- Redirecting STDOUT: You can redirect the output of a command to a file using

A

Redirecting and Managing Streams:
- Redirecting STDOUT: You can redirect the output of a command to a file using > or append to a file using >>. For example:

bash
  command > output.txt
 
  • Redirecting STDERR: To redirect STDERR, you can use 2> or 2>>. For example:
    bash
    command 2> error.txt
  • Redirecting Both STDOUT and STDERR: To redirect both STDOUT and STDERR to the same file, you can use &> or &>>. For example:
    bash
    command &> output_and_error.txt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Difference between STDIN, STDOUT, and STDERR (and their corresponding file descriptors numbers)

A

In Unix-like operating systems, including Linux, STDIN, STDOUT, and STDERR are streams that handle input, output, and error messages for processes. They are associated with file descriptors, which are small non-negative integers used to identify open files or streams.

Here’s an overview of each:

  1. STDIN (Standard Input):
    • File Descriptor Number: 0
    • Purpose: STDIN is the standard input stream. It is the source of input for commands or processes. When you type from the keyboard or redirect input from a file, the data flows through STDIN.
  2. STDOUT (Standard Output):
    • File Descriptor Number: 1
    • Purpose: STDOUT is the standard output stream. It is the default destination for the normal output of commands. When a command executes successfully, its output is directed to STDOUT. By default, STDOUT is displayed on the terminal.
  3. STDERR (Standard Error):
    • File Descriptor Number: 2
    • Purpose: STDERR is the standard error stream. It is used for error messages and diagnostics. When a command encounters an error, the error message is sent to STDERR. Like STDOUT, STDERR is also, by default, displayed on the terminal.

Redirecting and Managing Streams:
- Redirecting STDOUT: You can redirect the output of a command to a file using > or append to a file using >>. For example:

bash
  command > output.txt
 
  • Redirecting STDERR: To redirect STDERR, you can use 2> or 2>>. For example:
    bash
    command 2> error.txt
  • Redirecting Both STDOUT and STDERR: To redirect both STDOUT and STDERR to the same file, you can use &> or &>>. For example:
    bash
    command &> output_and_error.txt

These streams and file descriptors provide a flexible way to handle input, output, and error messages in the command-line environment. Understanding how to manipulate and redirect these streams is valuable for managing command output and error handling in scripts and day-to-day use.

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

In Unix-like operating systems, redirecting and appending refer to how the output of a command is handled when it is sent to a file. The key difference lies in

A

Redirecting output (overwrite or create)

In Unix-like operating systems, redirecting and appending refer to how the output of a command is handled when it is sent to a file. The key difference lies in whether the output overwrites the existing content of the file or is appended to the end of the file.

  1. Redirecting Output (>):
    • The > symbol is used for redirecting output to a file.
    • If the file already exists, the contents are overwritten with the new output.
    • If the file does not exist, a new file is created.
    • Example:
      bash
      command > output.txt

      • This will create or overwrite output.txt with the output of the command.
  2. Appending Output (>>):
    • The >> symbol is used for appending output to a file.
    • If the file already exists, the new output is added to the end of the existing content without overwriting.
    • If the file does not exist, a new file is created.
    • Example:
      command >> output.txt

      • This will append the output of the command to the existing content or create a new file if output.txt doesn’t exist.

Examples:
~~~
b
echo “First line” > file.txt

Appending output (add to existing or create)
echo “Second line”&raquo_space; file.txt
~~~

In these examples, the > symbol overwrites the content of file.txt with “First line,” and the >> symbol appends “Second line” to the end of the file. The result in file.txt would be:

First line
Second line

Understanding the difference between redirecting and appending is crucial when managing files in the command line, especially when dealing with command output or log files.

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

A (Address) Record:

A

Resolves a domain name to an IPv4 address.

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

AAAA Record:

A
  • Resolves a domain name to an IPv6 address.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

CNAME (Canonical Name) Record:

A
  • Creates an alias or nickname for a domain. It points to the canonical (true) domain name.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

MX Record:

A
  • Specifies mail servers responsible for receiving email on behalf of the domain.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What are the DNS record types?

A

DNS Record Types:

  1. A (Address) Record:
    • Resolves a domain name to an IPv4 address.
  2. AAAA (IPv6 Address) Record:
    • Resolves a domain name to an IPv6 address.
  3. CNAME (Canonical Name) Record:
    • Creates an alias or nickname for a domain. It points to the canonical (true) domain name.
  4. MX (Mail Exchange) Record:
    • Specifies mail servers responsible for receiving email on behalf of the domain.
  5. PTR (Pointer) Record:
    • Used for reverse DNS lookups, mapping an IP address to a domain name.
  6. NS (Name Server) Record:
    • Specifies authoritative DNS servers for the domain.
  7. SOA (Start of Authority) Record:
    • Contains administrative information about the domain, including the primary DNS server and other settings.
  8. TXT (Text) Record:
    • Allows arbitrary text to be associated with a domain. Commonly used for verification or information.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

What are DNS query commands?

A

DNS Query Commands:

  1. nslookup:
    • Used for querying DNS servers and obtaining information about domain names, IP addresses, or other DNS records.
    • Example: nslookup example.com
  2. dig (Domain Information Groper):
    • A versatile tool for DNS queries, providing detailed information about DNS responses.
    • Example: dig example.com A
  3. host:
    • A simple utility for performing DNS lookups.
    • Example: host example.com
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

Where is DNS configured in a Linux machine?

A

DNS Configuration on Linux:

  1. /etc/resolv.conf:
    • This file contains information about name servers and search domains.
    • Example:
      nameserver 8.8.8.8
      nameserver 8.8.4.4
  2. /etc/nsswitch.conf:
    • Configures the name service switch, specifying the order of service lookups (e.g., DNS, files, NIS).
    • Example:
      hosts: files dns
  3. /etc/hosts:
    • Allows manual mapping of IP addresses to hostnames.
    • Example:
      127.0.0.1   localhost
      192.168.1.1 example.com
  4. systemd-resolved:
    • In systems using systemd, the systemd-resolved service may handle DNS resolution.
    • Configuration: /etc/systemd/resolved.conf

These configurations help define how a Linux machine resolves domain names, interacts with DNS servers, and handles local host mappings. The specific configuration files may vary between Linux distributions.

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

When to use find, locate, or grep

A

The find, locate, and grep commands in Linux are used for different purposes, and the choice of which one to use depends on the specific task you want to accomplish. Here’s a brief overview of each command and when to use them:

  1. find:
    • Purpose: find is a powerful command-line tool for searching and locating files and directories in a file system hierarchy.
    • When to Use:
      • Searching for files based on criteria such as name, size, modification time, etc.
      • Performing complex file operations, such as executing commands on found files.
      • Recursive searching through directories.
    • Example:
      # Find all text files in the /home/user directory
      find /home/user -name "*.txt"
  2. locate:
    • Purpose: locate is a faster alternative for finding files by name. It uses a pre-built index of files on the system.
    • When to Use:
      • Quickly searching for files by name.
      • When you want to find files without specifying complex search criteria.
      • Suitable for situations where the index is up-to-date.
    • Example:
      # Locate all files with the name "example.txt"
      locate example.txt
    • Note: The locate command relies on a pre-built index, and the index may not be up-to-date if the system configuration or files have changed recently. You can update the index using the updatedb command.
  3. grep:
    • Purpose: grep is a powerful command-line tool for searching text patterns within files.
    • When to Use:
      • Searching for specific text patterns or strings within files.
      • Examining log files, configuration files, or any text-based files.
      • Combining with other commands through pipes for more complex searches.
    • Example:
      # Search for the string "error" in all .log files in the /var/log directory
      grep "error" /var/log/*.log

In summary:
- Use find when you need to search for files based on various criteria and perform complex operations.
- Use locate for quick file name-based searches when the index is up-to-date.
- Use grep when you want to search for specific text patterns within files.

These commands can also be combined in more complex commands or scripts to achieve specific search and manipulation tasks.

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

find:

A

find:
- Purpose: find is a powerful command-line tool for searching and locating files and directories in a file system hierarchy.
- When to Use:
- Searching for files based on criteria such as name, size, modification time, etc.
- Performing complex file operations, such as executing commands on found files.
- Recursive searching through directories.

  • Example:
    # Find all text files in the /home/user directory
    find /home/user -name "*.txt"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

locate:

A

locate:
- Purpose: locate is a faster alternative for finding files by name. It uses a pre-built index of files on the system.
- When to Use:
- Quickly searching for files by name.
- When you want to find files without specifying complex search criteria.
- Suitable for situations where the index is up-to-date.

  • Example:
    # Locate all files with the name "example.txt"
    locate example.txt
  • Note: The locate command relies on a pre-built index, and the index may not be up-to-date if the system configuration or files have changed recently. You can update the index using the updatedb command.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

grep:

A

grep:
- Purpose: grep is a powerful command-line tool for searching text patterns within files.
- When to Use:
- Searching for specific text patterns or strings within files.
- Examining log files, configuration files, or any text-based files.
- Combining with other commands through pipes for more complex searches.

  • Example:
    # Search for the string "error" in all .log files in the /var/log directory
    grep "error" /var/log/*.log
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What to do to force an update of the locate index

A

To force an update of the locate index on a Linux system, you can use the updatedb command. The updatedb command is responsible for updating the file name database that locate relies on.

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

tar does not compress by default but that zip does!

A

The tar and zip commands serve different purposes and have different default behaviors when it comes to compression.

tar Command:

  • Default Behavior: The tar command is primarily used for creating archives or collections of files and directories. By default, tar does not perform compression; it simply bundles files together into a single archive file.
  • Compression Options: While tar itself doesn’t compress, it often works in conjunction with compression tools like gzip or bzip2. Users can use additional options to compress the archive during the creation process. For example:
    • tar -cvzf archive.tar.gz files: Creates a gzip-compressed archive (-z option).

zip Command:

  • Default Behavior: The zip command, on the other hand, is designed to both archive and compress files by default. When you use zip without specific compression options, it automatically compresses the files added to the archive.
  • Compression Options: Users can still control the compression level when using zip through options like -0 (no compression) to -9 (maximum compression). For example:
    • zip archive.zip files: Creates a compressed archive using the default compression level.

Summary:

In summary, the key difference lies in the default behavior:

  • tar archives files without compression by default but can be combined with compression tools.
  • zip archives and compresses files by default, and users can adjust the compression level.

If compression is desired with tar, users need to explicitly specify a compression tool during the archive creation process. Each tool has its strengths, and the choice between tar and zip depends on the specific requirements of the task at hand.

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

Relationship between speed and compression for the zip command the options used

A

The zip command provides options to control the compression level, allowing users to balance compression efficiency with processing speed. The key options for controlling compression in the zip command are typically -0 through -9, where 0 indicates no compression, and 9 indicates maximum compression.

Here’s a general overview of the relationship between speed and compression for the zip command:

  1. Low Compression Levels (-0 to -5):
    • Speed: Faster compression.
    • Compression Ratio: Lower compression ratio (larger file size).
    • Usage: Suitable for scenarios where speed is a priority, and achieving the maximum compression ratio is not critical.
    bash
    zip -0 archive.zip files   # No compression
    zip -5 archive.zip files   # Low compression
  2. Medium Compression Levels (-6 to -8):
    • Speed: Moderate compression speed.
    • Compression Ratio: Balanced compression ratio.
    • Usage: A good compromise between speed and compression ratio, suitable for general use.
    bash
    zip -6 archive.zip files   # Medium compression
    zip -7 archive.zip files   # Medium compression
    zip -8 archive.zip files   # Medium compression
  3. High Compression Level (-9):
    • Speed: Slower compression.
    • Compression Ratio: Higher compression ratio (smaller file size).
    • Usage: Ideal for scenarios where achieving the maximum compression ratio is crucial, even if it comes at the cost of slower processing.
    bash
    zip -9 archive.zip files   # High compression

Example:
```bash
# Create a zip archive with medium compression level
zip -6 archive.zip files
~~~

The choice of compression level depends on the specific requirements of the task. If fast compression is essential and file size is less critical, a lower compression level may be suitable. Conversely, if achieving the smallest possible file size is a priority and speed is less important, a higher compression level may be preferred.

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

The typical bus types used with hard drives

A

The typical bus types used with hard drives refer to the interfaces that connect hard drives to the motherboard or storage controller. Over the years, various interfaces have been developed to accommodate the increasing speed and performance of hard drives. Here are some of the common bus types used with hard drives:

  1. Parallel ATA (PATA):
    • Description: Also known as IDE (Integrated Drive Electronics), PATA was once a standard interface for connecting hard drives to motherboards. It uses a parallel data transfer method.
    • Data Transfer Rate: Older PATA interfaces support lower data transfer rates compared to modern standards.
  2. Serial ATA (SATA):
    • Description: SATA is the successor to PATA and uses a serial data transfer method. It has become the standard interface for connecting internal hard drives to motherboards.
    • Data Transfer Rate: SATA interfaces support higher data transfer rates than PATA, and there are multiple generations (SATA I, SATA II, SATA III) with increasing speeds.
  3. Small Computer System Interface (SCSI):
    • Description: SCSI is a set of standards for connecting and transferring data between computers and peripheral devices, including hard drives. SCSI interfaces were commonly used in enterprise environments.
    • Variants: There are different variants of SCSI, including Ultra SCSI, Ultra2 SCSI, Ultra160 SCSI, and Ultra320 SCSI, each offering higher data transfer rates.
  4. Serial Attached SCSI (SAS):
    • Description: SAS is a serial interface designed for connecting high-performance devices, including hard drives, in enterprise environments. It is backward compatible with SATA.
    • Data Transfer Rate: SAS interfaces support high data transfer rates and are commonly used in servers and storage systems.
  5. Non-Volatile Memory Express (NVMe):
    • Description: NVMe is an interface protocol developed for modern, high-performance SSDs. It is designed to take advantage of the high-speed characteristics of NAND flash memory.
    • Data Transfer Rate: NVMe interfaces offer significantly higher data transfer rates compared to SATA, making them suitable for high-performance storage.

These interfaces have evolved over time, with newer standards providing faster data transfer rates and improved features. The choice of interface depends on factors such as the type of hard drive (HDD or SSD), the intended use (consumer or enterprise), and the performance requirements of the system. In modern systems, SATA and NVMe are the most common interfaces for connecting hard drives.

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

The 3 components that make up any Linux distribution

A

A Linux distribution consists of three key components:

  1. Linux Kernel: The core of the operating system that directly interacts with hardware, managing system resources and providing essential services.
  2. System Libraries: Sets of code and data that offer standardized functions to higher-level programs, abstracting interactions between the kernel and software.
  3. System Utilities and Tools: User-level programs and commands for tasks such as file management, process control, and system configuration, enabling user interaction with the operating system.

These components, along with a package management system, work together to create a complete and functional Linux distribution. Popular distributions include Ubuntu, Fedora, Debian, CentOS, and Arch Linux, each tailored to specific user needs and preferences.

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

The 2 major families of distros, and how to recognize

A

The two major families of Linux distributions are:

  1. Debian-based:
    • Recognition: Package management tools like apt or dpkg are used for installing and managing software packages. Common Debian-based distributions include Ubuntu and its variants, Debian itself, and Linux Mint.
  2. Red Hat-based:
    • Recognition: Package management tools such as yum or dnf are used for software installation and management. Prominent Red Hat-based distributions include Red Hat Enterprise Linux (RHEL), CentOS, Fedora, and Oracle Linux.

In summary, Debian-based distributions use apt or dpkg for package management, while Red Hat-based distributions use yum or dnf. Recognizing the package management tools is a quick way to identify which family a Linux distribution belongs to.

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

For Debian, main characteristics for:
Debian and Ubuntu Server, Ubuntu/Mint, and KALI
(+updownstream relationship)

A

Debian and Ubuntu Server (stable), Ubuntu/Mint (desktop/consumer), KALI (ethical hacking/pentesting)

Debian is a versatile Linux distribution with different flavors tailored for various purposes:

  1. Debian and Ubuntu Server (stable):
    • Debian serves as the foundation for stable server environments, and Ubuntu Server, based on Debian, inherits this stability for server deployments.
  2. Ubuntu/Mint (desktop/consumer):
    • Ubuntu, a Debian derivative, and Linux Mint, based on Ubuntu, are user-friendly desktop distributions designed for consumer use.
  3. KALI (ethical hacking/pentesting):
    • Kali Linux, another Debian derivative, specializes in ethical hacking and penetration testing, providing a comprehensive toolkit for security professionals.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

For Red Hat, main characteristics of: Fedora > RHEL > CentOS, Oracle Linux, Scientific Linux.
(+updownstream relationship)

A

Fedora (upstream distro) > RHEL > CentOS, Oracle Linux, Scientific Linux (all downstream distros)

In the Red Hat ecosystem:

  1. Fedora (upstream distro):
    • Cutting-edge, community-driven distribution serving as the upstream for Red Hat projects. Features the latest software and technologies.
  2. RHEL (Red Hat Enterprise Linux):
    • Enterprise-focused, stable, and secure Linux distribution with long-term support. Used in mission-critical environments.
  3. CentOS:
    • A downstream, community-supported version of RHEL. Provides RHEL’s stability and compatibility without the official Red Hat support.
  4. Oracle Linux:
    • Oracle’s distribution built on RHEL. Optimized for Oracle software and often used in Oracle Database environments.
  5. Scientific Linux:
    • A community-supported distribution based on RHEL. Initially aimed at scientific computing, but development has ceased, and users are encouraged to migrate to CentOS.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Distribution release cycles and LTS releases:

A

It is a structured timeline that defines when new versions or updates of a software product will be released to the public.

Long-Term Support releases, such as Ubuntu LTS or Debian LTS, receive extended maintenance and support, typically for a period of several years.

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

Ubuntu: Releases published

A

twice yearly in April and October (e.g., Ubuntu 22.04, Ubuntu 22.10)

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

Ubuntu LTS or ‘Long Term Support’ releases are published

A

every 2 years (e.g., even years only; 22.04 is an LTS release

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

Ubuntu LTS releases are supported for

A

5 years

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

Other distro LTS releases may be as short as

A

3 years (e.g., OpenSuSE Leap, SLES)

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

Some distros use a ‘rolling’ release model which means the distro is

A

continually updated after installation (KALI Linux, OpenSuse, Tumbleweed)

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

Debian package management tools

A

Low-level is dpkg; High-level are apt, apt-get, aptitude (gui)

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

Red Hat package management tools

A

Low-level is rpm; High-level are yum, dnf

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

SuSE is a _____-based distro but shares some elements of _____ (e.g., _____ package format for interoperability via the _____ pacakge manager)

A

SuSE is a distribution based on Slackware, but it incorporates certain elements from Red Hat, such as the rpm package format, enabling seamless interoperability through the zypper package manager.

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

Purpose of the /proc psuedo-virtual filesystems

A

The /proc filesystem provides a way to access information about processes and system resources. It offers a structured interface where you can access details such as process IDs, CPU information, memory usage, and much more.

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

Purpose of the /sys psuedo-virtual filesystems

A

The /sys filesystem exposes information about various devices and device drivers in a hierarchical manner. It provides a standardized interface to access and configure device-specific settings and attributes. This filesystem is particularly useful when managing hardware and troubleshooting device-related issues.

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

Purpose of the /dev psuedo-virtual filesystems

A

The /dev filesystem is used to access and interact with devices on your system. It represents devices as special files, allowing you to read from and write to them as if they were regular files. This enables applications and system processes to communicate with hardware devices, such as disk drives, printers, sound cards, and more.

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

UID of the root user and the first standard user

A

Assigning the root user a UID of 0 helps ensure that it has the highest level of privileges and can carry out critical system operations. Giving the first standard user a UID of 1000.

The IDs from 1-99 are also reserved for use by other system accounts.

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

The importance of the /etc/passwd and /etc/shadow files

A

The/etc/passwdfile includes details such as the username, user ID (UID), group ID (GID), home directory path, default shell, and more. This file acts as a user database, storing the basic user information required for system processes and user authentication.
the/etc/shadowfile works in conjunction with the/etc/passwdfile to enhance security. It stores the encrypted password hashes for each user on the system.

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

Why a standard user can execute the passwd command, how is it possible when the binary is owned by root?

A

The setuid (set user ID) is a special permission that can be assigned to an executable file, allowing it to be executed with the permissions of the file’s owner instead of the user executing it. In the case of the passwd binary, the setuid bit is set, and the owner is the root user.

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

Difference between ‘#’, ‘/’, ‘/root’, and the ‘root’ user

A

represents the root user’s command prompt, / is the root directory in the file system hierarchy, /root is the home directory for the root user, and the ‘root’ user is the superuser account with unlimited privileges.

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

What is umask is used for?

A

The umask command is used to set the default file permissions for newly created files and directories.

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

What are the permissions on the /tmp directory

A

The /tmp directory typically has the following default permissions:

drwxrwxrwt (or 1777 in octal notation)
Owner: The owner of the /tmp directory is usually the root user (or another privileged user).
Group: The group ownership can vary, but it is commonly set to a group like root or wheel.
The first character d indicates that it is a directory.

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

How to change the user and group of a file

A

To change the ownership of a file or directory, you will need to specify the desired user and group. The format for the chown command is as follows:

chown [user]:[group] [file/directory]
For example, if you have a file called “example.txt” and you want to change its ownership to the user “john” and the group “staff”, you would run:

chown john:staff example.txt

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

Domain 1 commands

A

File and Directory Operations: Commands for navigating, creating, deleting, and modifying files and directories.

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

figlet is a command-line tool used to generate ASCII art banners and large letters from ordinary text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q
  • apt-cache search figlet
A

The apt-cache search figlet command searches for packages related to “figlet” in the package cache on a Debian-based system. Use sudo apt-get install figlet to install the “figlet” package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q
  • sudo apt-get install figlet
A

This command will prompt you to enter your password (since sudo grants elevated privileges) and then proceed to download and install the “figlet” package along with any necessary dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q
  • figlet I Love C851!
A

```bash
figlet “I Love C851!”

~~~

This command generates ASCII art for the text “I Love C851!” using figlet.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q
  • sudo apt-get remove figlet
A

This command removes the “figlet” package from a Debian-based system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q
  • yum search speaking cow
A

yum: The package manager used for managing software packages on Red Hat-based systems like Fedora and CentOS.

search: A yum subcommand that searches for packages based on keywords.

speaking cow: In this case, “speaking cow” is treated as a search term, but it’s not a recognized package name or keyword in the standard package repositories.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q
  • sudo yum install cowsay
A

This command installs the “cowsay” package on a Red Hat-based Linux system using the yum package manager. After the installation, you can use the cowsay command to display text with an ASCII art cow and speech bubble in the terminal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q
  • cowsay “Brought to you by C851!”
A

This command uses the cowsay program to display the message “Brought to you by C851!” with an ASCII art representation of a cow and a speech bubble in the terminal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q
  • sudo yum remove cowsay
A

This command removes the “cowsay” package from a Red Hat-based Linux system using the yum package manager.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q
  • ls /usr/share/common-licenses/
A

This command lists the contents of the directory “/usr/share/common-licenses/” on a Unix-like system. The directory typically contains common software licenses used by various packages on the system.

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

Domain 2 Commands

A

User and Group Management: Commands for handling user accounts, permissions, and groups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q
  • command, [options]… [arguments]… (e.g., ls -la /home /tmp has multiple options and arguments)
A

Command: Refers to the executable or command to be executed in the terminal.

[options]…: Denotes optional flags or switches that modify the behavior of the command. Options are typically preceded by a hyphen (e.g., -l).

[arguments]…: Denotes input values or additional information that the command may require to execute properly. Arguments are usually non-flag parameters (e.g., directory or file names).

Example: The example provided, ls -la /home /tmp, illustrates the usage of the ls command with the options -la and the arguments /home and /tmp. This command would list detailed information about the contents of the “/home” and “/tmp” directories.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q
  • how to wrap a command in the shell (e.g., using the \ character at the end of the line)
A

To wrap a command in the shell, you can use the backslash \ character at the end of the line. This is known as line continuation, and it allows you to break a command into multiple lines for better readability.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q
  • -h, –help, man, info, ls /usr/share/doc/
A

These are various ways to access help and documentation for commands in a Unix-like operating system:

  1. -h or –help:
    • Usage: command -h or command --help
    • Purpose: Displays a brief help message or usage information for a command.
  2. man (manual):
    • Usage: man command
    • Purpose: Opens the manual page for a command, providing detailed documentation, usage, and options.
  3. info:
    • Usage: info command
    • Purpose: Opens the info page for a command, offering more extensive documentation with hyperlinks.
  4. ls /usr/share/doc/:
    • Usage: ls /usr/share/doc/
    • Purpose: Lists the contents of the /usr/share/doc/ directory, which often contains additional documentation for installed packages.

These methods allow you to access various levels of documentation, from quick help messages to detailed manuals and additional documentation files. Choose the method that best suits your needs based on the level of detail you require.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q
  • less/more (and how to exit)
A

less and more are terminal pager programs that allow you to view the contents of files or command output one screen at a time. Here’s how to use them and how to exit:

less:

  • Usage:
    bash
    less filename

    or
    bash
    command | less
  • Navigation:
    • Move forward one screen: Spacebar
    • Move backward one screen: b
    • Scroll up/down line by line: Arrow keys or j and k
    • Search: / followed by the search term, then press Enter
    • Quit: q

more:

  • Usage:
    bash
    more filename

    or
    bash
    command | more
  • Navigation:
    • Move forward one screen: Spacebar
    • Move backward one screen: b
    • Quit: q

Exiting:

  • Exiting less:
    • Press q to quit.
  • Exiting more:
    • Press q to quit.

Both less and more allow you to navigate through the content and quit easily. less provides more advanced features, such as searching and scrolling, while more is a simpler pager. Choose the one that fits your needs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q
  • type echo
A

This command displays information about the type of the echo command, indicating whether it’s a shell built-in command or an external executable. The output will typically indicate that echo is a shell built-in command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q
  • type man
A

This command will likely indicate that man is an external executable and not a shell built-in. The man command is used to display the manual pages for other commands or programs installed on a Unix-like operating system.

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

The pwd command stands for “print working directory.” When you run pwd in the terminal, it outputs the absolute pathname of the current working directory – that is, the directory you are currently in within the file system.

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

Domain 3 Commands

A

Process Management: Commands for managing running processes, background tasks, and job control.

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

Domain 5 Commands

A

Networking: Commands for network-related tasks, such as configuring network settings, checking connectivity, and troubleshooting.

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

Linux Command Domain 1

A

File and Directory Operations: Commands for navigating, creating, deleting, and modifying files and directories.

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

Linux Command Domain 2

A

User and Group Management: Commands for handling user accounts, permissions, and groups.

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

Linux Command Domain 3

A

Process Management: Commands for managing running processes, background tasks, and job control.

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

Linux Command Domain 4

A

System Information and Monitoring: Commands to gather information about the system, hardware, and monitor system performance.

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

Linux Command Domain 5

A

Networking: Commands for network-related tasks, such as configuring network settings, checking connectivity, and troubleshooting.

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

/usr/

A

(MULTI-)USER UTILITIES AND APPLICATIONS SECONDARY HIERARCHY REQUIRED DIRECTORIES: BIN, INCLUDE, LIB, LOCAL, SBIN, SHARE

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

/opt/

A

ADD-ON APPLICATION SOFTWARE PACKAGES

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

/srv/

A

DATA FOR SERVICES PROVIDED BY THIS SYSTEM

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

/dev/

A

DEVICE FILES

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

/lib/

A

ESSENTIAL SHARED LIBRARIES AND KERNEL MODULES

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

/bin/

A

ESSENTIAL USER COMMAND BINARIES

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

/root/

A

HOME DIRECTORY FOR THE ROOT USER

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

/mnt/

A

MOUNT POINT FOR A TEMPORARILY MOUNTED FILESYSTEMS

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

/media/

A

MOUNT POINT FOR REMOVABLE MEDIA

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

/etc/

A

SPECIFIC SYSTEM CONFIGURATION REQUIRED DIRECTORIES: OPT, XII, SQML, XML

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

/boot/

A

STATIC FILES OF THE B00T LOADER

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

/sbin/

A

SYSTEM BINARIES

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

/tmp/

A

TEMPORARY FILES

113
Q

/home/

A

USER HOME DIRECTORIES

114
Q

/var/

A

VARIABLE FILES

115
Q

/proc/

A

VIRTUAL FILESYSTEM DOCUMENTING KERNEL AND PROCESS STATUS AS TEXT FILES

116
Q

FQDN in Linux

A

The search directive in the /etc/resolv.conf file specifies a list of search domains that the system’s resolver should use when attempting to resolve short, unqualified domain names.

When a user enters a domain name without a fully qualified domain name (FQDN) – meaning it lacks a trailing dot and domain suffix – the system needs to determine how to complete the domain name. The search directive provides a list of domains to append to the short, unqualified domain name in order to create a fully qualified domain name for resolution.

For example, suppose the resolv.conf file contains the following search line:

```plaintext
search example.com subdomain.example.com
~~~

Now, if a user tries to resolve the hostname “server,” the system will try to resolve both “server.example.com” and “server.subdomain.example.com” by appending the specified search domains. This helps users avoid typing the fully qualified domain name every time they want to access a local resource.

It’s important to note that the order of domains in the search line matters. The resolver will try to append the domains in the specified order until it successfully resolves the domain or exhausts the list.

In summary, the search directive in /etc/resolv.conf simplifies domain name resolution by automatically appending specified search domains to short, unqualified domain names, making it more convenient for users to access resources on the network.

117
Q

PTR (Pointer) Record:

A

Used for reverse DNS lookups, mapping an IP address to a domain name.

118
Q

NS (Name Server) Record:

A

Specifies authoritative DNS servers for the domain.

119
Q

SOA (Start of Authority) Record:

A

Contains administrative information about the domain, including the primary DNS server and other settings.

120
Q

TXT (Text) Record:

A

Allows arbitrary text to be associated with a domain. Commonly used for verification or information.

121
Q

Used for querying DNS servers and obtaining information about domain names, IP addresses, or other DNS records.

A

nslookup

122
Q

A versatile tool for DNS queries, providing detailed information about DNS responses.

A

dig (Domain Information Groper):

123
Q

A simple utility for performing DNS lookups.

A

host
Example: host example.com

124
Q

This file contains information about name servers and search domains.

A

/etc/resolv.conf

125
Q

Configures the name service switch, specifying the order of service lookups (e.g., DNS, files, NIS).

A

/etc/nsswitch.conf:

126
Q

Allows manual mapping of IP addresses to hostnames.

A

/etc/hosts

127
Q

In systems using systemd, the systemd-resolved service may handle DNS resolution.

A

systemd-resolved

128
Q

Path in systems using systemd, the systemd-resolved service may handle DNS resolution.

A

Configuration: /etc/systemd/resolved.conf

129
Q

Understanding the upstream-downstream relationship

A

“upstream” and “downstream” refer to the direction of the flow of software changes, updates, and contributions. Here’s what each term means:

  • Upstream:
    • Definition: The term “upstream” refers to the source of the software. It is where the original codebase or project is maintained and developed.
    • Role: Upstream projects are responsible for creating and maintaining the core software. This can include major releases, bug fixes, and new features.
    • Example: If a distribution is getting its software from an original project, that project is considered upstream.
  • Downstream:
    • Definition: “Downstream” refers to distributions or projects that take the software from an upstream source and customize, package, or distribute it.
    • Role: Downstream projects adapt the software for specific needs, integrate it into their distribution, and may add their own patches or modifications.
    • Example: Linux distributions like Ubuntu, Fedora, or Debian are downstream from the Linux kernel, which is maintained upstream.

In a simplified flow, changes and improvements move from upstream projects down to downstream projects. Downstream projects may apply patches, configurations, or other modifications to tailor the software for their specific audience or use case.

130
Q

/etc/passwd

A

The/etc/passwdfile contains details such as the username, user ID (UID), group ID (GID), home directory path, default shell, and more. This file acts as a user database, storing the basic user information required for system processes and user authentication.

131
Q

/etc/shadow

A

the/etc/shadowfile works in conjunction with the/etc/passwdfile to enhance security. It stores the encrypted password hashes for each user on the system.

132
Q

(pronounced as “hash” or “pound” symbol):

A

In a terminal or command line interface, the#symbol typically represents the command prompt for the root user or superuser. When you see#at the beginning of a command line, it indicates that you have elevated privileges and can execute commands with administrative rights.

133
Q

/(pronounced as “root” or “forward slash”):

A

The forward slash is the root directory in a Unix-like operating system, including Linux. It is the top-most directory in the file system hierarchy. All other directories and files are organized under the root directory. It is represented as/in file paths.

134
Q

/root:

A

The/rootdirectory is specific to Linux systems and is the home directory for the root user. The root user, also known as the superuser, is a special administrative account with unrestricted privileges. The/rootdirectory serves as the root user’s personal directory, similar to how regular users have their own home directories.

135
Q

‘root’ user:

A

The root user, as I mentioned earlier, is the superuser account in Unix-like operating systems. It has complete control and unrestricted access to all files, directories, and system resources. The root user can perform administrative tasks, modify system files, and execute privileged commands.

136
Q

How to apply umask to default file permissions?

A

to set the umask to 022 (which results in the default file permissions of 644 as calculated earlier), you would enter: umask 022.

137
Q

examples of octal permissions: 444 705

A

444: Owner/group/others can only read the file, and cannot write to it or execute it 705: The owner has all permissions and world read and execute

138
Q

How to prevent users from deleting files they don’t own

A

“Use the chmod command to set the appropriate permissions on the file or directory. To prevent others from deleting a file, you can remove the write permission for others. Assuming the current permissions are rwxrwxrwx, you can run: chmod o-w example.txt

This command removes the write permission (w) for others (users who are not the owner or part of the group).”

139
Q

The sticky bit

A

“set the ““sticky bit”” on the directory using the chmod command. For example, if you want to set the sticky bit on a directory called ““data””, you would run: chmod +t data

The sticky bit ensures that only the owner of a file can delete or rename it within the directory, even if others have write permissions.”

140
Q

cd '.' and '..'

A

The cd command is used to navigate the directory structure, and . represents the current directory, while .. represents the parent directory.

141
Q

home and ~

A

cd ~ is equivalent to:

cd $HOME

or

cd /home/username # Replace “username” with the actual username

142
Q

ls -l /home

A

Lists detailed information about files in the /home directory.

143
Q

ls -al, ls -a -l

A

Both ls -al and ls -a -l are valid commands to list files and directories in long format, including hidden ones. The first form (ls -al) is more commonly used and is considered a concise and standard way of expressing the combination of the -an and -l options.

144
Q

ls --all --format=long

A

Lists all files with long format, including hidden ones.

145
Q

ls -a ~

A

Lists all files, including hidden ones, in the home directory.

146
Q

ls -lrt

A

Lists files in reverse order of modification time.

147
Q

ls -R ~ (how recursive listings work)

A

When you execute ls -R ~, the command will display a hierarchical listing of all files and directories within the home directory and its subdirectories.

148
Q

mv, cp, rm, touch

A

Commands for moving, copying, removing, and creating files.

149
Q

mkdir, rmdir

A

Commands for creating and removing directories.

150
Q

touch newfile, touch new file, touch "new file"

A

The correct options would be either touch newfile or touch “new file”, depending on whether you want a space in the filename. The option touch new file without quotes would create two separate files, “new” and “file.”

151
Q

man mkdir, info mkdir

A

Accesses the manual and info pages for the mkdir command.

152
Q

ls /usr/share/doc/

A

Lists contents of the /usr/share/doc/ directory.

This directory typically contains documentation files for installed packages on the system.

153
Q

locate -l 3 README /etc

A

Searches for files named README with a limit of 3 matches in /etc.

154
Q

sudo updatedb

A

Updates the locate database.

155
Q

find . -name *.txt

A

Finds files with the .txt extension in the current directory.

156
Q

cat, head, tail

A

Commands for displaying the content of files.

157
Q

tar -c and -x options, -j, -J, and -z options, the -f option and the exact order of the files that follow

A

Commands for creating and extracting tar archives with different compression options.

158
Q

zip -0, -6, and -9 options (-0 is NO compression, -1 the least compression, -9 the most compression) order of file arguments

A

The file arguments should come after the compression level option.
• Example (Create Archive with Maximum Compression):

zip -9 archive.zip file1 file2

159
Q

unzip

A

Command for extracting files from a ZIP archive.

160
Q

grep -i, -e, -R, brace expansion

A

Let’s break down the grep command with the specified options and mention brace expansion:

  1. -i (Case Insensitive):
    • Purpose: Ignore case distinctions in the search.
    • Example:grep -i “pattern” file.txt
  2. -e (Pattern):
    • Purpose: Specify the pattern to be searched. Useful when the pattern begins with a hyphen (-) or when multiple patterns are used.
    • Example:grep -e “pattern1” -e “pattern2” file.txt
  3. -R (Recursive):
    • Purpose: Recursively search subdirectories.
    • Example:grep -R “pattern” /path/to/directory
  4. Brace Expansion:
    • Purpose: Brace expansion allows you to generate arbitrary strings by specifying a part of the string to be altered.
    • Example:grep -i -e “pattern1” -e “pattern2” -R /path/to/{dir1,dir2}/*.txtThis example uses brace expansion to search for patterns in files with a .txt extension within both dir1 and dir2 under /path/to/.

In summary, grep -i, grep -e, and grep -R are options for case-insensitive search, specifying patterns, and recursively searching directories, respectively. Brace expansion is a shell feature that allows you to concisely express multiple strings or patterns, often used when specifying multiple files or directories in a command.

161
Q

sort -d, -n options

A

Let’s break down the sort command with the specified options:

  1. -d (Dictionary Order):
    • Purpose: Specifies dictionary order (ignores punctuation and spaces) when sorting.
    • Example:sort -d file.txt
  2. -n (Numeric Sort):
    • Purpose: Sorts numerically instead of lexicographically (as strings).
    • Example:sort -n numbers.txt
  3. Order of Options:
    • Options are typically combined, and their order matters. In the examples above, you can combine them as:sort -dn file.txtorsort -nd numbers.txt
    • The order of options is significant. In the examples, -d comes before -n, indicating that the sorting should be in dictionary order first and then numerically.

In summary, sort -d is used for dictionary order, considering spaces and punctuation, while sort -n is used for numeric sorting. The order in which these options are specified influences the sorting behavior.

162
Q

cut -d and -f options

A

The cut command is used to extract specific portions of text from a file or input stream. Let’s break down the -d and -f options:

  1. -d (Delimiter):
    • Purpose: Specifies the delimiter character used to separate fields.
    • Example:cut -d’,’ -f2 file.csvThis example uses a comma as the delimiter and extracts the second field from a CSV file.
  2. -f (Fields):
    • Purpose: Specifies the field or fields to be extracted.
    • Example:cut -f1,3 file.txtThis example extracts the first and third fields from a file where fields are separated by the default delimiter (tab).
  3. Order of Options:
    • Options can be combined, and their order matters. For example:cut -d’,’ -f2,3 file.csvThis extracts the second and third fields from a CSV file using a comma as the delimiter.

In summary, cut -d is used to specify the delimiter, and cut -f is used to specify the field or fields to be extracted. Combining these options allows you to precisely cut and extract portions of text from files or input streams based on specific delimiters and field numbers.

163
Q

wc -l

A

Counts the number of lines in a file.

164
Q

$PATH environment variable

A

Shows the current value of the PATH environment variable.

165
Q

use the '=' to create a variable (e.g., animal=dog), call the variable using $animal (e.g., echo $animal)

A

Demonstrates variable creation and usage in the shell.

166
Q

cat /etc/* > newfile 2> /dev/null

A

This command concatenates the contents of all files in the /etc/ directory and redirects the output to a file named newfile. The 2> /dev/null part suppresses any error messages that might occur during the concatenation, directing them to the null device (/dev/null), effectively ignoring errors.

In summary, it creates a single file (newfile) containing the concatenated content of all files in the /etc/ directory, while discarding any error messages.

167
Q

cp newfile newfile2

A

Copies newfile to newfile2.

168
Q

cp newfile newfile3

A

Copies newfile to newfile3.

169
Q

cp newfile newfile4

A

Copies newfile to newfile4.

170
Q

ls -lh

A

Lists files in long format with human-readable sizes.

171
Q

bzip2 newfile2

A

Compresses newfile2 using bzip2.

172
Q

gzip newfile3

A

Compresses newfile3 using gzip.

173
Q

xz newfile4

A

Compresses newfile4 using xz.

174
Q

bunzip2 newfile2.bz2

A

Decompresses newfile2.bz2 using bunzip2.

175
Q

gunzip newfile3.gz

A

Decompresses newfile3.gz using gunzip.

176
Q

unxz newfile4.xz

A

Decompresses newfile4.xz using unxz.

177
Q

cp newfile newfile-gz1

A

Copies newfile to newfile-gz1.

178
Q

cp newfile newfile-gz9

A

Copies newfile to newfile-gz9.

179
Q

gzip -1 newfile-gz1

A

Compresses newfile-gz1 using gzip with the least compression.

180
Q

gzip -9 newfile-gz9

A

Compresses newfile-gz9 using gzip with the most compression.

181
Q

cp newfile newfile-xz1

A

Copies newfile to newfile-xz1.

182
Q

cp newfile newfile-xz9

A

If you attempt to copy a regular (uncompressed) file into a compressed file using a simple cp command, the content of the uncompressed file will be copied as is, and the resulting compressed file will likely be corrupted. Compression formats like gzip, for example, expect specific compression headers and data structures that won’t be present if you simply copy a regular file into a compressed file.

Here’s an example:

cp regular_file.gz compressed_file.gz

This command would copy the content of regular_file.gz into compressed_file.gz, but the resulting compressed_file.gz would not be a valid compressed file, and attempting to decompress it would likely fail.

If you want to create a compressed version of a regular file, you typically use a compression command like gzip, bzip2, or xz. For example:

gzip regular_file

This command would compress regular_file and create a new file named regular_file.gz.

183
Q

xz -1 newfile newfile-xz1

A

If you enter the command xz -1 newfile newfile-xz1 in the terminal, it will attempt to compress the file named “newfile” using the xz compression utility with compression level 1 and save the compressed output in a new file named “newfile-xz1.”

184
Q

xz -9 newfile newfile-xz9

A

Compresses newfile-xz9 using xz with the most compression.

185
Q

ls -lh newfile newfile-* *

A

Lists files and their sizes after compression.

The command ls -lh newfile newfile-* * lists detailed information about the files in the current directory, including “newfile,” files matching the pattern “newfile-*,” and all other files. Here’s a breakdown:

  • ls: Command for listing directory contents.
  • -lh: Options for long format and human-readable sizes.

Now, let’s break down the file patterns:

  • newfile: Lists details about the file named “newfile.”
  • newfile-*: Lists details about files matching the pattern “newfile-*,” which may include “newfile-xz1” or similar names.
  • *: Lists details about all other files in the current directory.

The output will show information like permissions, owner, group, file size, modification time, and file name for each file.

Example output might look like:

-rw-r--r-- 1 user group 1.5K Dec 22 10:30 newfile
-rw-r--r-- 1 user group 1.2K Dec 22 10:30 newfile-xz1
-rw-r--r-- 1 user group  800 Dec 22 10:30 otherfile.txt
...

This output would show details for “newfile,” “newfile-xz1,” and other files in the directory. Adjustments to the actual output may vary based on the contents of your directory.

186
Q

cp /etc/hosts ./

A

Copies the hosts file to the current directory.

187
Q

gzip hosts

A

Compresses the hosts file using gzip.

188
Q

zcat hosts.gz

A

Displays the content of hosts.gz without decompressing.

189
Q

tar -czf gzip.tar.gz newfile newfile2 newfile3

A

Creates a tar archive with gzip compression.

190
Q

tar -cjf bzip.tar.gz newfile newfile2 newfile3

A

Creates a tar archive with bzip2 compression.

It will execute without error, but there’s a discrepancy in the file extension. The resulting archive will be compressed using bzip2 compression, but the file extension will be “.tar.gz,” which conventionally indicates gzip compression.

191
Q

tar -cJf xz.tar.gz newfile newfile2 newfile3

A

Creates a tar archive with xz compression.

192
Q

ls -l | grep tar

A

Lists files and filters for those containing “tar”.

193
Q

tar cf gzip.tar.gz

A

Creates a tar archive without compression.

194
Q

tar tf gzip.tar.gz

A

Lists files in a tar archive without extracting.

195
Q

tar uf gzip.tar.gz

A

Updates a tar archive by adding new files.

The command tar uf gzip.tar.gz is not complete. The uf options in the tar command require additional arguments specifying the files you want to update in the archive. Here’s an example of a complete command:

tar uf gzip.tar.gz file1 file2 file3

196
Q

mkdir zip && cd zip/

A

Creates a directory ‘zip’ and changes to it.

197
Q

mkdir dir && touch dir/file1 dir/file2

A

Creates a directory ‘dir’ and two files inside it.

198
Q

zip -r5 zipfile.zip dir

A

Creates a zip archive named “zipfile.zip” recursively compressing the contents of the “dir” directory with compression level 5.

199
Q

rm -rf dir

A
  1. rm -rf dir:
    • Description: This command forcefully removes the directory “dir” and its contents recursively.
    • Behavior: It ignores errors and removes files and subdirectories within “dir” without prompting for confirmation.
    • Use Case: Typically used when you want to delete a directory and its contents without being prompted for each file or subdirectory.

rm -rf dir

2.	rm dir:
•	Description: This command attempts to remove the directory “dir,” but it does not do so recursively.
•	Behavior: If “dir” is empty, it is removed. If “dir” contains files or subdirectories, it will prompt you for confirmation before removing each one.
•	Use Case: Used when you want to remove an empty directory or when you want to be prompted for confirmation when deleting files within the directory.

rm dir

200
Q

ls

A

Lists files in the current directory.

201
Q

unzip zipfile.zip

A

Extracts files from a ZIP archive.

202
Q

find

A

Finds files and directories in a directory hierarchy.

203
Q

export (and when to use it)

A

Here’s how you can use export:

export VARIABLE_NAME=value

•	VARIABLE_NAME: The name of the environment variable you want to set.
•	value: The value you want to assign to the environment variable.

For example:

export PATH=$PATH:/usr/local/bin

This command adds “/usr/local/bin” to the PATH environment variable, allowing the system to search for executables in that directory.

When to use export:

1.	Setting Environment Variables: When you need to set an environment variable for use by the current shell session and its child processes.
2.	PATH Modification: Often used to modify the PATH variable, allowing the system to locate executable files in additional directories.
3.	Custom Environment Variables: If you have specific variables that need to be accessed by other processes or scripts.
204
Q

echo I am $USER, echo "I am $USER", echo 'I am $USER'

A

echo I am $USER
I am your_username

echo “I am $USER”
I am your_username

echo ‘I am $USER’
I am $USER

205
Q

echo $USER, echo \$USER

A

echo $USER
your_username

echo $USER
$USER

206
Q

greeting=hello, echo greeting, echo $greeting

A

greeting=hello
echo greeting
greeting
echo $greeting
hello

207
Q

echo $greeting world

A

Concatenates a variable with a string.

greeting=hello
echo $greeting world
hello world

208
Q

bash -c 'echo $greeting world'

A

Executes a command in a subshell.

bash -c ‘echo $greeting world’
world

209
Q

echo $greeting world

A

Echoes the value of the variable greeting followed by the word “world”.

210
Q

bash -c 'echo $greeting world'

A

Executes the echo command in a new Bash shell, using the value of the variable greeting.

211
Q

echo $greeting

A

Echoes the value of the variable greeting.

212
Q

unset greeting

A

Unsets (deletes) the variable greeting.

213
Q

unset greeting echo $greeting

A

Attempts to echo the value of the unset variable greeting.

No output

214
Q

greeting=hello

A

Assigns the value “hello” to the variable greeting.

215
Q

export greeting, export greeting=hey

A

Exports the variable greeting to the environment. The second form assigns and exports a new value.

216
Q

TZ=EST date, TZ=GMT date

A

Example:

$ TZ=EST date
Wed Dec 22 12:34:56 EST 2023

$ TZ=GMT date
Wed Dec 22 17:34:56 GMT 2023

In the examples, the first command displays the date and time in Eastern Standard Time, and the second command displays it in Greenwich Mean Time. The time zone information is appended to the output. Adjustments to the displayed time will depend on the difference between the specified time zone and the system’s local time zone.

217
Q

echo $PATH, PATH=$PATH:new_directory

A

Displays and modifies the system’s executable search path, adding a new directory to the end of the existing PATH environment variable. This modification is temporary and lasts only for the duration of the current shell session.

To make it persistent, you would typically add this command to your shell configuration file (e.g., ~/.bashrc or ~/.bash_profile).

218
Q

which nano, which v

A

Shows the path of the executables nano and v.

219
Q

uname -r, uname -s

A

Displays the kernel release and system name.

220
Q

free -m, free -h

A

Shows system memory information in megabytes and human-readable format.

221
Q

cat /dev

A

The ls /dev command is typically used to get a quick overview of the devices in the /dev directory without displaying the content of each device file. The cat /dev command, on the other hand, is generally not recommended as it might produce a large amount of binary data, and it won’t be very informative.

222
Q

lscpu

A

Lists CPU information.

223
Q

lsblk, lsblk -f

A

The lsblk command in Linux is used to list information about block devices, such as hard drives and partitions.
lsblk without any options provides information about block devices, and lsblk -f adds information about the file system types associated with each device.

224
Q

which useradd

A

Shows the path of the useradd executable.

225
Q

ls /etc/apt/sources*

A

The command ls /etc/apt/sources* is used to list files in the /etc/apt/ directory that match the pattern sources*. This typically includes files related to package repositories in Debian-based Linux distributions.

Here’s a brief breakdown:

•	/etc/apt/: The directory where APT (Advanced Package Tool) configuration files are located.
•	sources*: The wildcard * is used to match any file in the /etc/apt/ directory that starts with the term “sources.” .
226
Q

cat /etc/passwd

A

Displays information about user accounts.

227
Q

less .bash_history .bash_logout .bashrc .profile

A

Views the contents of important shell configuration files.

You can navigate through the content of each file using the arrow keys. Press q to exit less.

less .bash_history .bash_logout .bashrc .profile would not display the content of all the specified files at once. The less command, when given multiple file arguments, displays them one at a time, allowing you to navigate through each file separately.

If you want to display the content of multiple files simultaneously, you might consider using separate cat commands for each file or using a tool like cat combined with process substitution. Here’s an example:

$ cat .bash_history .bash_logout .bashrc .profile

Or using less with process substitution:

$ less <(cat .bash_history .bash_logout .bashrc .profile)

The first approach with cat concatenates the content of the specified files, and the second approach uses process substitution to achieve a similar result.

228
Q

cat /boot

A

Displays information about the boot directory.

229
Q

cat /proc/cpuinfo

A

Displays information about the CPU.

230
Q

cat /proc/cmdline

A

Shows the command-line parameters passed to the kernel during boot.

231
Q

cat /proc/modules

A

The command cat /proc/modules is used to display a list of currently loaded kernel modules on a Linux system. Kernel modules are pieces of code that can be loaded and unloaded into the kernel as needed to extend its functionality or support specific hardware.

232
Q

ls /proc/sys

A

Lists various system configuration parameters.

233
Q

cat /proc/sys/net/ipv4/ip_forward

A

Displays the current status of IP forwarding parameter in the Linux kernel. This parameter determines whether the kernel forwards IP packets between network interfaces. A value of 1 typically indicates that IP forwarding is enabled, while 0 indicates that it is disabled.

Enabling IP forwarding is crucial in scenarios where a device needs to act as an intermediary for directing traffic between different networks.

234
Q

cat /proc/sys/kernel/pid_max

A

Shows the maximum process ID allowed.

235
Q

top

A

Interactive system monitoring tool with various display options.

236
Q

ps, ps -f, ps -uf, ps -v

A
  1. ps:
    • Result: Displays a snapshot of currently running processes in a compact format.
    • Interpretation: This provides basic information about the processes, including their PID (process ID), TTY (terminal type), STAT (process status), TIME (cumulative CPU time), and CMD (command).
    1. ps -f:
      • Result: Displays a more detailed format with additional information.
      • Interpretation: This includes more columns like UID (user ID), PPID (parent process ID), C (CPU utilization), STIME (start time), and CMD (command). It provides a fuller view of the process details.
    2. ps -uf:
      • Result: Similar to ps -f, but with a specific user’s processes.
      • Interpretation: Displays detailed information for processes belonging to a specific user. It’s useful for examining the processes of a particular user.
    3. ps -v:
      • Result: Displays virtual memory-related information.
      • Interpretation: This includes columns like SZ (size in physical pages), RSS (resident set size, the portion of a process’s memory held in RAM), and TTY (terminal type). It provides insights into memory usage.
237
Q

echo $$

A

The command echo $$ is used to print the process ID (PID) of the currently running shell or script. Here’s a brief explanation:

•	echo: Command used to print text or values to the terminal.
•	\$\$: Special variable in Unix-like operating systems that represents the PID of the current process.
238
Q

pstree

A

Displays a tree of processes.

239
Q

ls /proc, ls /proc/1/

A
  1. ls /proc:
    • This command lists the contents of the /proc directory, displaying information about all running processes and various system-related details.
    1. ls /proc/1/:
      • This command lists the contents of the /proc/1/ directory, specifically providing information about the process with PID (Process ID) 1, which is the init process. The init process is the first process started by the kernel during system initialization.
240
Q

cat /proc/1/cmdline; echo

A

The command cat /proc/1/cmdline is used to display the command-line arguments passed to the process with PID (Process ID) 1, which is typically the init process on a Linux system. The echo command is used to insert a newline, making the output more readable.

Here’s an example:

$ cat /proc/1/cmdline; echo
/sbin/init

In this example, the output shows that the init process was started with the command /sbin/init. Keep in mind that the contents of /proc/1/cmdline represent the command line used to start the process, and it may contain the full path to the executable along with any command-line arguments.

The trailing echo command is used to add a newline, so the next command prompt appears on a new line for better readability.

241
Q

uptime

A

Shows system uptime and load averages.

It provides information about how long the system has been running, the current time, the number of users logged in, and the system load averages.

242
Q

less /var/log/messages

A

Views system log messages.

System log messages, often referred to as system logs or system log entries, are records of events, activities, and status information generated by various components of an operating system. These messages are stored in system log files and serve several purposes, including monitoring system health, troubleshooting issues, and providing a historical record of system events. Key components related to system log messages include:

  1. Syslog: The syslog system is a standard logging protocol used by Unix-like systems. It categorizes log messages into different facilities (e.g., auth, kern, user) and priorities (e.g., info, warning, error).
  2. Log Files: System log messages are typically stored in log files located in the /var/log directory on Linux systems. Common log files include /var/log/messages, /var/log/syslog, and others, depending on the distribution.
  3. Log Rotation: Log rotation mechanisms ensure that log files do not grow indefinitely, preventing exhaustion of disk space. Rotated log files may have names like messages.1, messages.2.gz, and so on.
  4. Logging Levels:
    • Debug: Detailed messages for debugging purposes.
    • Info: General information about system activities.
    • Warning: Indication of potential issues.
    • Error: Report of errors that did not prevent normal operation.
    • Critical: Critical conditions requiring immediate attention.
    • Alert: Urgent situation requiring immediate action.
    • Emergency: System is unusable; emergency alert.
  5. Log Messages Examples:
    • Authentication events (e.g., login attempts, user authentication).
    • Kernel messages (e.g., hardware or network events).
    • Service-related events (e.g., startup, shutdown, errors).
    • Security-related events (e.g., firewall denials, security breaches).
    • Application-specific messages (e.g., web server requests, database errors).

Sysadmins and system operators regularly review system log messages to detect anomalies, diagnose issues, and maintain system security and stability. Monitoring tools and log analysis utilities can assist in automating this process, making it easier to identify trends and potential problems in the logs.

243
Q

tail -f /var/log/messages

A

Monitors and displays new log messages in real-time.

•	tail: Command used to display the last part of a file.
•	-f: Option for “follow,” which means to keep the file open and display new lines as they are appended to the file.
•	/var/log/messages: The path to the log file being monitored. In this case, it’s the system messages log file.
244
Q

file /var/log/wtmp

A

Identifies the file type of the wtmp log file.

245
Q

last

A

The last command reads information from the /var/log/wtmp file, which keeps track of login and logout information.

246
Q

dmesg | grep boot, journalctl -k

A

In this example, dmesg | grep boot focuses on the kernel messages containing the term “boot,” providing details from the kernel ring buffer.

journalctl -k complements this by displaying kernel-related messages from the systemd journal. It covers a broader range of kernel messages and includes timestamps, making it easier to correlate events.

247
Q

journalctl, journalctl -f

A

Views messages from the journal, with optional real-time updates.

248
Q

ip link show

A

The ip link show command is used to display information about network interfaces on a Linux system.

249
Q

ip addr show

A

Shows IP addresses assigned to network interfaces.

250
Q

ping -c 3 8.8.4.4

A

In the ping command, the -c option is used to specify the number of ICMP echo requests (pings) to send before stopping. When you run ping -c 3 8.8.4.4, it sends three ICMP echo requests to the IP address 8.8.4.4 and then stops, providing a summary of the results.

251
Q

ip route show

A

Displays the routing table.

252
Q

cat /etc/resolv.conf

A

Shows DNS resolver configuration.

253
Q

host learning.lpi.org, dig learning.lpi.org

A

In this example, the host command provides the IP address (93.184.216.34) associated with the domain learning.lpi.org and indicates that there is no specific mail server configured (mail is handled by 0).

The dig command provides more detailed information, including query time, the DNS server used for the query, and other details. In this example, it confirms that learning.lpi.org resolves to the IP address 93.184.216.34.

Both commands serve similar purposes, but dig is more feature-rich and provides more detailed information.

254
Q

ss -t

A

Lists TCP socket connections.

255
Q

dpkg, apt-get, rpm, yum/dnf

A

Package management commands for Debian, Ubuntu, Red Hat, and CentOS systems.

256
Q

chsh, chsh -s

A

Changes the login shell for a user. The -s option specifies the new shell.

257
Q

whoami, id

A

Displays the current username and user ID information.

258
Q

last

A

Shows a list of last logged-in users and their sessions.

259
Q

who -a, who -r, w

A

Here are brief explanations for the mentioned commands:

  1. who -a:
    • who is a command used to display information about currently logged-in users.
    • -a option shows additional information, including the system’s last reboot time and run level.
    Output might include information about logged-in users, as well as the system’s run level and last reboot time.
  2. who -r:
    • -r option displays the current run level of the system.
    Output might show information about the current run level.
  3. w:
    • w is a command that displays information about currently logged-in users, along with additional details such as load average and uptime.

Output typically includes details about logged-in users, system load averages, and uptime.

Each of these commands provides information related to user sessions and system status in different ways.

260
Q

sudo, sudo su, sudo -

A

• sudo is for running a single command with elevated privileges.
• sudo su is for starting a new shell session as the superuser or another specified user.
• sudo - is for running a command with an environment similar to a root login.

261
Q

cat /etc/passwd /etc/shadow, /etc/group

A

Displays information about user accounts and groups.

The /etc/group file in Linux is a system file that stores information about user groups. Each line in this file represents a group and contains information such as the group name, group password (if used), group ID (GID), and a list of user names that are members of the group.

262
Q

!! (in /etc/shadow)

A

In the context of the /etc/shadow file on a Linux system, the !! entry typically represents a disabled user account. Specifically, it means that the account has been locked or disabled, preventing the associated user from logging in.

The /etc/shadow file stores password information, including hashed passwords, for user accounts on the system. When a user account is disabled, the password field is often replaced with !! to indicate that no password is set or valid for that account. As a result, attempting to log in with a user account marked with !! will fail.

263
Q

cat /etc/skel/

A

Shows the contents of the skeleton directory, used as a template for new user home directories.

264
Q

chfn

A

Changes information for a user’s full name and other details.

265
Q

cat /etc/gshadow

A

Displays information about group passwords.

266
Q

useradd newuser

A

Adds a new user account named “newuser.”

267
Q

passwd newuser

A

Sets a password for the new user account.

268
Q

cat /etc/passwd | grep newuser

A

Searches for the “newuser” entry in the /etc/passwd file.

269
Q

grep newuser /etc/passwd

A

Searches for the “newuser” entry in the /etc/passwd file.

270
Q

id

A

Displays information about the current user’s user ID and group memberships.

271
Q

groups

A

Shows the groups to which the current user belongs.

272
Q

useradd -M, useradd -m, useradd -d

A

Adds a new user without creating a home directory, with a home directory, and with a specified home directory, respectively.

273
Q

groupadd

A

Adds a new group.

274
Q

ls -l, ls -a

A

Lists files in long format and includes hidden files, respectively.

275
Q

chmod, chown

A

Changes file permissions and ownership, respectively.

276
Q

/tmp/, /var/tmp/, and Sticky Bit

A
  1. /tmp/:
    • /tmp/ is a directory in Linux designated for temporary files. It allows users and applications to store temporary data that may be needed during the system’s current session. The contents of /tmp/ are typically cleared upon system reboot to free up space.
    1. /var/tmp/:
      • /var/tmp/ is another directory for temporary files, but its contents persist across reboots. It is intended for temporary files that should survive a system restart. Users typically have write access to /tmp/ but may have more restricted access to /var/tmp/ due to its persistent nature.
    2. Sticky Bit:
      • The sticky bit is a permission that can be set on a directory. When the sticky bit is set on a directory, only the owner of a file within that directory can delete or rename their own files. Other users, even if they have write permissions to the directory, cannot delete or rename files owned by someone else. This is commonly applied to directories like /tmp/ to enhance security.
277
Q

ls -d

A

Lists directories themselves, not their contents.

278
Q

ln -

A

Creates links between files.