Dimas Maulana

Dimas Maulana

Developer

Welcome to my website! I am a developer with a current focus on React and Go. My experience encompasses both front-end and back-end development, enabling me to design and develop seamless and efficient applications.

How to Sync With Rsync but Ignore .DS_Store Files

Rsync is a powerful command-line tool for synchronizing files and directories between two locations. However, when syncing macOS files to another location, you may encounter pesky .DS_Store files, which are hidden metadata files created by the Finder. To exclude these files from your rsync operation, you can use the --exclude flag. Below is an example of how to sync files while ignoring .DS_Store files:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
### Command Explanation

Let's break down the command step by step:

- `rsync`: This is the command itself.
- `--force`: This option tells rsync to overwrite files without asking for confirmation.
- `-ahviP`: These are a combination of options:
  - `-a`: Archive mode, which preserves various attributes of files and directories.
  - `-h`: Output numbers in a human-readable format (e.g., 1K, 2M).
  - `-v`: Verbose mode, which displays detailed information about the sync process.
  - `-i`: Itemize changes, displaying a summary of the changes made.
  - `-P`: Equivalent to `--partial --progress`, it keeps partially transferred files and shows progress during transfer.
- `--exclude '.DS_Store'`: This flag tells rsync to exclude any file or directory named `.DS_Store`.
- `--delete`: This option deletes files in the destination that are not present in the source. Be cautious with this option as it can result in data loss if not used carefully.
- `/Users/dimas/Vaults/Photos/`: This is the source directory you want to sync.
- `/Volumes/example/Photos/`: This is the destination directory where you want to sync the files.

### Usage Notes

1. **Source and Destination Paths**: Make sure to replace `/Users/dimas/Vaults/Photos/` and `/Volumes/example/Photos/` with your actual source and destination paths.

2. **Be Careful with --delete**: The `--delete` option can remove files in the destination that are not in the source. Use it with caution to avoid unintentional data loss.

3. **Backup**: Before running any rsync command with the `--delete` option, ensure you have a backup of your data in case something goes wrong.

4. **Hidden Files**: `.DS_Store` files are just one example of hidden files on macOS. You can use the same `--exclude` flag to exclude other hidden files or directories if needed.

With this command, you can effectively synchronize your files and directories while excluding `.DS_Store` files, keeping your destination directory clean and clutter-free.

Feel free to customize the command according to your specific needs, such as excluding other hidden files or directories or adjusting the sync options to suit your preferences.

Mac Install Default Path Languange

It looks like you want to provide instructions for installing Python 3 and Java 11 on a Mac using Homebrew and setting their default paths. Here’s a step-by-step guide in Markdown format:

Installing Python 3

  1. Install Python 3 using Homebrew:

How to Enable Bash Autocompletion on Mac

Bash autocompletion is a handy feature that can save you time and keystrokes when working in the terminal. It allows you to press the Tab key to automatically complete commands, file names, and more. Here, we’ll walk you through the process of enabling bash autocompletion on macOS using Homebrew.

Prerequisites

Before you begin, ensure that you have Homebrew installed. If you don’t have it installed, you can get it from Homebrew’s official website.

Using Terminal Completion on ITerm2

iTerm2 is a popular terminal emulator for macOS that comes with a variety of features to enhance your command-line experience. One such feature is Terminal Completion, which allows you to quickly and efficiently complete commands, file paths, and more using keyboard shortcuts. In this article, we’ll explore how to use Terminal Completion in iTerm2 using the Cmd + ; shortcut.

What is Terminal Completion?

Terminal Completion, also known as tab completion, is a feature that helps you save time when typing commands in the terminal. It works by automatically suggesting and completing commands, file paths, directory names, and more as you type. This can be especially useful when working with long and complex commands or navigating through a directory structure with many nested folders.

Storing GIT Credentials Locally

When working with Git repositories, it’s often convenient to store your credentials locally to avoid repeatedly entering your username and password or personal access token. Git provides several methods for managing credentials, including caching and using credential helpers. Here, we’ll discuss how to store Git credentials locally on different operating systems and how to set a token for each project folder.

Storing Git Credentials Locally

On Linux

To store Git credentials locally on a Linux system, you can use the git config command with the credential.helper setting set to cache. This will cache your credentials for a specified period, typically 15 minutes, before requiring you to re-enter them.

Understanding Command Line Syntax

When working with command line interfaces (CLI), it’s essential to understand the syntax and formatting used to create and execute commands. The command line syntax can include special characters and conventions that dictate how commands should be structured and what elements are required or optional. Let’s break down the common command line syntax elements using examples from both a general explanation and a specific CLI usage sample.

Command Line Syntax Elements

Square Brackets [ ]

The square brackets ( [ ] ) in command line syntax indicate that the enclosed element, which can be a parameter, value, or information, is optional. Users have the choice to include one or more items within the square brackets or omit them entirely. It’s important not to type the square brackets themselves in the actual command line.

0%