Skip to content

Commit

Permalink
Added more quick tips
Browse files Browse the repository at this point in the history
  • Loading branch information
guinuxbr committed Nov 7, 2023
1 parent 1c3a31e commit 95c282b
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 13 deletions.
38 changes: 25 additions & 13 deletions content/posts/arch-linux-arm-raspberry-pi-4/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ I think everyone already knows the Raspberry Pi, but if you haven't heard about
Now that you know what it is about, let's get down to business.
It is worth mentioning that a good part of this guide is found in the instructions on the project's own page, available [here](https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4).

The first thing to do is to format your MicroSD card. I recommend a good Class 10 card or better.
The first thing to do is to format your Micro SD card. I recommend a good Class 10 card or better.

The choice of the partitioning tool is up to you. I will use _fdisk_ which is available by default on most Linux distributions.
The choice of the partitioning tool is up to you. I will use `fdisk` which is available by default on most Linux distributions.

## Format the device

First, we start microSD with fdisk. You need to use _sudo_ or perform the process as _root_.
First, we start microSD with `fdisk`. You need to use `sudo` or perform the process as `root`.

```shell
fdisk /dev/sdX
Expand All @@ -34,12 +34,12 @@ Replace "sdX" with your device identifier.

At the first prompt, delete (!!!) the partitions and create a new one:

* Press **o** and **ENTER**. This will clear the current partitions.
* Press **p** to list the partitions. There should be none listed.
* Press **n** and **ENTER** for a new partition and **p** to choose the "Primary" type. Now **1** for the first partition and **ENTER** to accept the default value for the first sector. Now type **+ 100M** for the last sector.
* Press **t** and then **c** to configure the first partition with type **W95 FAT32 (LBA)**
* Now press **n** for a new partition and **p** again for "Primary". Then **2** for the second partition on the card and press **ENTER** twice to accept the default values ​​for the first and last sectors of the second partition.
* Press **w** to write the partition table and exit.
- Press **o** and **ENTER**. This will clear the current partitions.
- Press **p** to list the partitions. There should be none listed.
- Press **n** and **ENTER** for a new partition and **p** to choose the "Primary" type. Now **1** for the first partition and **ENTER** to accept the default value for the first sector. Now type **+ 100M** for the last sector.
- Press **t** and then **c** to configure the first partition with type **W95 FAT32 (LBA)**
- Now press **n** for a new partition and **p** again for "Primary". Then **2** for the second partition on the card and press **ENTER** twice to accept the default values ​​for the first and last sectors of the second partition.
- Press **w** to write the partition table and exit.

This way you guarantee the rest of the card to the system. We will talk about this later.

Expand All @@ -63,12 +63,18 @@ mount /dev/sdX2 root

## Download and extract the filesystem

The parameters of the _bsdtar_ command are **x** to extract, **p** to restore permissions, and **f** indicates the input file. The _C_ after the input file indicates the directory to which we must change before extracting the files, in this case, the _root_ directory we have created.
The parameters of the `bsdtar` command are **x** to extract, **p** to restore permissions, and **f** indicates the input file. The `C` after the input file indicates the directory to which we must change before extracting the files, in this case, the `root` directory we have created.
This part MUST be done as the root user:

```shell
wget <http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-4-latest.tar.gz>
```

```shell
bsdtar -xpf ArchLinuxARM-rpi-4-latest.tar.gz -C root
```

```shell
sync
```

Expand All @@ -90,23 +96,29 @@ umount boot root

## Starting the Raspberry Pi

Insert the card into the Raspberry Pi, and connect the ethernet cable and the power supply.
Insert the card into the Raspberry Pi, and connect the Ethernet cable and the power supply.

If you do not use the Raspberry Pi connected directly to a video, keyboard, and mouse, you can connect via SSH. Check the IP assigned by your router's DHCP, for example.

* Log in with the standard user _alarm_ and password _alarm_.
* The default root password is _root_.
- Log in with the standard user **alarm** and password **alarm**.
- The default **root** password is **root**.

Last, but not least: Start the Pacman keychain and populate it with the Arch Linux ARM keys.

```shell
pacman-key --init
```

```shell
pacman-key --populate archlinuxarm
```

Arch Linux ARM is ready to be used for the project you want. I recommend updating the system and restarting it to start the game.

```shell
pacman -Syu
```

```shell
systemctl reboot
```
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions content/posts/find-linux-broken-symlinks/index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "FIND LINUX BROKEN SYMLINKS"
date: 2023-11-07T20:46:53Z
draft: false
tags: ["Linux", "symlinks"]
categories: ["tips"]
align: left
featuredImage: banner.en.png
---

## Find broken symbolic links

A while ago, I was willing to contribute with a GitHub project, but I found some issues with broken links. This situation led me to a question: how can I recursively find all broken links within a directory?

The command below will print the path to any broken symbolic links found in the specified folder and its subfolders.

```shell
find /path/to/folder -type l ! -exec test -e {} \; -print
```

Let's explain each part of the command does:

- `find /path/to/folder`: Search recursively starting from the specified folder.
- `-type l`: Only look for symbolic links.
- `! -exec test -e {} \;`: Use the test command to check if each symbolic link exists. The `{}` is a placeholder for the path to the symbolic link. The `-e` option to test checks if the file exists. The `!` negates the result of the test, so the command will succeed if the file does not exist (i.e., if the symbolic link is broken).
- `-print`: Print the path to any broken symbolic links found.

## Conclusion

With the list of broken symbolic links, to fix the issue, it is just a matter of recreating the links pointing to the right locations.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions content/posts/linux-how-to-find-files-by-age/index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "LINUX, HOW TO FIND FILES BY AGE"
date: 2023-11-07T21:15:56Z
draft: false
tags: ["Linux", "find"]
categories: ["tips"]
align: left
featuredImage: banner.en.png
---

## Find files by age

A while ago I needed to find old files in a Linux server. The `find` utility have the `-mtime` option to complete this task.

Here's an example command:

```shell
find /path/to/directory -type f -mtime +730
```

Running this command will list all the files in the specified directory (and its subdirectories) that are older than two years.

Let's break down the command:

- `find /path/to/directory`: Search recursively starting from the specified folder.
- `-type f`: This option specifies that we are looking for regular files (excluding directories and other special file types).
- `-mtime +730`: This option specifies the modification time of the files. The +730 means files older than 730 days (365 days x 2 years).

Note that the modification time of a file is based on the last time it was modified, including changes to its content, permissions, or ownership.

## Conclusion

The `find` utility have several options and possibilities, always check the software manual pages with `man find` or [online](https://linux.die.net/man/1/find).

0 comments on commit 95c282b

Please sign in to comment.