> For the complete documentation index, see [llms.txt](https://42-guide.gitbook.io/42-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://42-guide.gitbook.io/42-guide/piscine-life/shell00/testshell00.md).

# testShell00

**Objective**

The goal of this exercise is to create a file named `testShell00` with specific **file permissions** and **attributes**. After creating the file, you need to package it into a `.tar` archive for submission.

The file should have the following attributes when viewed with the `ls -l` command:

```
total 1
-r--r--x--x 1 XX XX 40 Jun 1 23:42 testShell00
```

* **File permissions**: `r--r--x--x` (read-only for owner and group, execute-only for others).
* **Size**: 40 bytes.
* **Timestamp**: June 1st, 23:42 (or any valid date/time).

***

**What You Need to Do**

1. Create a file named `testShell00`.
2. Set the file permissions to `r--r--x--x`.
3. Set the file size to 40 bytes.
4. Set the file's timestamp to a specific date and time (e.g., June 1st, 23:42).
5. Package the file into a `.tar` archive named `testShell00.tar`.

***

**Step-by-Step Explanation**

1. **Create the File**:
   * Use the `touch` command to create an empty file:

     ```bash
     touch testShell00
     ```
2. **Set File Permissions**:
   * Use the `chmod` command to set the file permissions to `r--r--x--x`.
   * The permission code for `r--r--x--x` is `445` (read `4`, read `4`, execute `1`).

     ```bash
     chmod 445 testShell00
     ```
   * Alternatively, you can use symbolic notation:#

     ```bash
     chmod u=r,g=r,o=x testShell00
     ```
3. **Set the File Size to 40 Bytes**:
   * You can use the `echo` command to add content to the file until it reaches 40 bytes.
   * For example, add 40 characters to the file:

     ```bash
     echo "This file is exactly 40 bytes long." > testShell00
     ```
   * Verify the file size using the `ls -l` command:

     ```bash
     ls -l testShell00
     ```

     The output should show a size of 40 bytes.
4. **Set the File's Timestamp**:
   * Use the `touch` command with the `-t` option to set a specific timestamp.
   * The format for the timestamp is `YYYYMMDDHHMM.SS`.
   * For example, to set the timestamp to June 1st, 23:42:

     ```bash
     touch -t 202306012342 testShell00
     ```
   * Verify the timestamp using `ls -l`:

     ```bash
     ls -l testShell00
     ```
5. **Package the File into a `.tar` Archive**:
   * Use the `tar` command to create a `.tar` archive:

     ```bash
     tar -cf testShell00.tar testShell00
     ```
   * This creates a file named `testShell00.tar` containing `testShell00`.

***

**Key Concepts to Learn**

1. **File Permissions**:
   * File permissions in Unix are divided into three categories: **owner**, **group**, and **others**.
   * Permissions are represented as `rwx` (read, write, execute) or as a numeric code (e.g., `755`).
   * Use `chmod` to change file permissions.
2. **File Size**:
   * The size of a file is determined by its content.
   * You can use commands like `echo` or `dd` to create files of specific sizes.
3. **File Timestamp**:
   * The `touch` command can be used to modify a file's access and modification timestamps.
   * The `-t` option allows you to set a specific timestamp.
4. **Creating `.tar` Archives**:
   * The `tar` command is used to create archives (`.tar` files).
   * The `-c` option creates a new archive, and the `-f` option specifies the archive's filename.

***

**Resources for Further Learning**

* **File Permissions**:
  * [Linux File Permissions](https://linux.die.net/man/1/chmod)
* **File Timestamps**:
  * [Touch Command in Linux](https://linux.die.net/man/1/touch)
* **Tar Command**:
  * [Tar Command in Linux](https://linux.die.net/man/1/tar)

***

**Final Steps**

1. Create the file:

   ```bash
   touch testShell00
   ```
2. Set permissions:

   ```bash
   chmod 445 testShell00
   ```
3. Set the file size to 40 bytes:

   ```bash
   echo "This file is exactly 40 bytes long." > testShell00
   ```
4. Set the timestamp:

   ```bash
   touch -t 202306012342 testShell00
   ```
5. Verify the file attributes:

   ```bash
   ls -l testShell00
   ```
6. Create the `.tar` archive:

   ```bash
   tar -cf testShell00.tar testShell00
   ```

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://42-guide.gitbook.io/42-guide/piscine-life/shell00/testshell00.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
