|
1 |
| -## Overview of ChrisTitusTech's `.bashrc` Configuration |
| 1 | +# ChrisTitusTech's `.bashrc` Configuration |
2 | 2 |
|
3 |
| -The `.bashrc` file is a script that runs every time a new terminal session is started in Unix-like operating systems. It is used to configure the shell session, set up aliases, define functions, and more, making the terminal easier to use and more powerful. Below is a summary of the key sections and functionalities defined in the provided `.bashrc` file. |
| 3 | +## Overview |
4 | 4 |
|
5 |
| -## How to install |
6 |
| -``` |
7 |
| -git clone --depth=1 https://github.com/ChrisTitusTech/mybash.git |
| 5 | +This repository provides a comprehensive `.bashrc` configuration along with supporting scripts and configuration files to enhance your terminal experience in Unix-like operating systems. It configures the shell session by setting up aliases, defining functions, customizing the prompt, and more, significantly improving the terminal's usability and power. |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +- [Installation](#installation) |
| 10 | +- [Uninstallation](#uninstallation) |
| 11 | +- [Configuration Files](#configuration-files) |
| 12 | + - [.bashrc](#bashrc) |
| 13 | + - [starship.toml](#starshiptoml) |
| 14 | + - [config.jsonc](#configjsonc) |
| 15 | +- [Key Features](#key-features) |
| 16 | +- [Advanced Functions](#advanced-functions) |
| 17 | +- [System-Specific Configurations](#system-specific-configurations) |
| 18 | +- [Conclusion](#conclusion) |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +To install the `.bashrc` configuration, execute the following commands in your terminal: |
| 23 | + |
| 24 | +```sh |
| 25 | +git clone --depth=1 https://github.com/dacrab/mybash.git |
8 | 26 | cd mybash
|
9 |
| -chmod +x setup.sh |
10 | 27 | ./setup.sh
|
11 | 28 | ```
|
12 | 29 |
|
13 |
| -### Initial Setup and System Checks |
| 30 | +The `setup.sh` script automates the installation process by: |
| 31 | + |
| 32 | +- Creating necessary directories (`linuxtoolbox/mybash`) |
| 33 | +- Cloning the repository |
| 34 | +- Installing dependencies (bash-completion, neovim, starship, fzf, zoxide) |
| 35 | +- Installing the MesloLGS Nerd Font required for the prompt |
| 36 | +- Linking configuration files (`.bashrc` and `starship.toml`) to your home directory |
| 37 | +- Setting up additional utilities like `fastfetch` |
| 38 | + |
| 39 | +Ensure you have the required permissions and a supported package manager before running the script. |
| 40 | + |
| 41 | +## Uninstallation |
| 42 | + |
| 43 | +To uninstall the `.bashrc` configuration, run: |
| 44 | + |
| 45 | +```sh |
| 46 | +cd mybash |
| 47 | +chmod +x uninstall.sh |
| 48 | +./uninstall.sh |
| 49 | +``` |
| 50 | + |
| 51 | +The `uninstall.sh` script reverses the installation process by: |
| 52 | + |
| 53 | +- Removing installed dependencies |
| 54 | +- Uninstalling fonts |
| 55 | +- Removing symbolic links to configuration files |
| 56 | +- Deleting the `linuxtoolbox` directory |
| 57 | +- Cleaning up additional utilities like `starship`, `fzf`, and `zoxide` |
| 58 | + |
| 59 | +After running the script, it's recommended to restart your shell to apply the changes. |
| 60 | + |
| 61 | +## Configuration Files |
| 62 | + |
| 63 | +### `.bashrc` |
| 64 | + |
| 65 | +The `.bashrc` file defines aliases, functions, and environment variables to enhance your shell experience. Key features include: |
| 66 | + |
| 67 | +- **Aliases**: Shortcuts for common commands (e.g., `alias cp='cp -i'`) |
| 68 | +- **Functions**: Custom functions for tasks like extracting archives and copying files with progress |
| 69 | + |
| 70 | +### `starship.toml` |
| 71 | + |
| 72 | +The `starship.toml` file configures the [Starship](https://starship.rs/) prompt, providing a highly customizable and informative shell prompt. It includes: |
14 | 73 |
|
15 |
| -- **Environment Checks**: The script checks if it is running in an interactive mode and sets up the environment accordingly. |
16 |
| -- **System Utilities**: It checks for the presence of utilities like `fastfetch`, `bash-completion`, and system-specific configurations (`/etc/bashrc`). |
| 74 | +- **Theme Settings**: Defines colors and symbols for different prompt segments |
| 75 | +- **Module Configurations**: Customizes modules like `python`, `git`, `docker_context`, and various programming languages |
| 76 | +- **Format Customization**: Structures the layout and truncation of paths for a cleaner look |
17 | 77 |
|
18 |
| -### Aliases and Functions |
| 78 | +### `config.jsonc` |
19 | 79 |
|
20 |
| -- **Aliases**: Shortcuts for common commands are set up to enhance productivity. For example, `alias cp='cp -i'` makes the `cp` command interactive, asking for confirmation before overwriting files. |
21 |
| -- **Functions**: Custom functions for complex operations like `extract()` for extracting various archive types, and `cpp()` for copying files with a progress bar. |
| 80 | +The `config.jsonc` file configures [fastfetch](https://github.com/AlexRogalskiy/fastfetch), a system information tool. It includes: |
22 | 81 |
|
23 |
| -### Prompt Customization and History Management |
| 82 | +- **Logo and Display Settings**: Customizes the appearance of system logos and separators |
| 83 | +- **Modules**: Defines which system information modules to display, such as CPU, GPU, OS, kernel, and uptime |
| 84 | +- **Custom Sections**: Adds custom formatted sections for hardware and software information |
24 | 85 |
|
25 |
| -- **Prompt Command**: The `PROMPT_COMMAND` variable is set to automatically save the command history after each command. |
26 |
| -- **History Control**: Settings to manage the size of the history file and how duplicates are handled. |
| 86 | +## Key Features |
27 | 87 |
|
28 |
| -### System-Specific Aliases and Settings |
| 88 | +1. **Aliases and Functions** |
| 89 | + - Shortcuts for common commands |
| 90 | + - Custom functions for complex operations (e.g., extracting archives, copying with progress) |
29 | 91 |
|
30 |
| -- **Editor Settings**: Sets `nvim` (NeoVim) as the default editor. |
31 |
| -- **Conditional Aliases**: Depending on the system type (like Fedora), it sets specific aliases, e.g., replacing `cat` with `bat`. |
| 92 | +2. **Prompt Customization and History Management** |
| 93 | + - Configures PROMPT_COMMAND for automatic history saving |
| 94 | + - Manages history file size and handles duplicates |
32 | 95 |
|
33 |
| -### Enhancements and Utilities |
| 96 | +3. **Enhancements and Utilities** |
| 97 | + - Improves command output readability with colors |
| 98 | + - Introduces safer file operations (e.g., using `trash` instead of `rm`) |
| 99 | + - Integrates Zoxide for easy directory navigation |
34 | 100 |
|
35 |
| -- **Color and Formatting**: Enhancements for command output readability using colors and formatting for tools like `ls`, `grep`, and `man`. |
36 |
| -- **Navigation Shortcuts**: Aliases to simplify directory navigation, e.g., `alias ..='cd ..'` to go up one directory. |
37 |
| -- **Safety Features**: Aliases for safer file operations, like using `trash` instead of `rm` for deleting files, to prevent accidental data loss. |
38 |
| -- **Extensive Zoxide support**: Easily navigate with `z`, `zi`, or pressing Ctrl+f to launch zi to see frequently used navigation directories. |
| 101 | +4. **Installation and Configuration Helpers** |
| 102 | + - Auto-installs necessary utilities based on system type |
| 103 | + - Provides functions to edit important configuration files |
39 | 104 |
|
40 |
| -### Advanced Functions |
| 105 | +## Advanced Functions |
41 | 106 |
|
42 |
| -- **System Information**: Functions to display system information like `distribution()` to identify the Linux distribution. |
43 |
| -- **Networking Utilities**: Tools to check internal and external IP addresses. |
44 |
| -- **Resource Monitoring**: Commands to monitor system resources like disk usage and open ports. |
| 107 | +- System information display |
| 108 | +- Networking utilities (e.g., IP address checks) |
| 109 | +- Resource monitoring tools |
45 | 110 |
|
46 |
| -### Installation and Configuration Helpers |
| 111 | +## System-Specific Configurations |
47 | 112 |
|
48 |
| -- **Auto-Install**: A function `install_bashrc_support()` to automatically install necessary utilities based on the system type. |
49 |
| -- **Configuration Editors**: Functions to edit important configuration files directly, e.g., `apacheconfig()` for Apache server configurations. |
| 113 | +- Editor settings (NeoVim as default) |
| 114 | +- Conditional aliases based on system type |
| 115 | +- Package manager-specific commands |
50 | 116 |
|
51 |
| -### Conclusion |
| 117 | +## Conclusion |
52 | 118 |
|
53 |
| -This `.bashrc` file is a comprehensive setup that not only enhances the shell experience with useful aliases and functions but also provides system-specific configurations and safety features to cater to different user needs and system types. It is designed to make the terminal more user-friendly, efficient, and powerful for an average user. |
| 119 | +This `.bashrc` configuration offers a powerful and customizable terminal environment suitable for various Unix-like systems. It enhances productivity through smart aliases, functions, and integrated tools while maintaining flexibility for system-specific needs. Whether you're a developer, system administrator, or power user, this setup aims to make your terminal experience more efficient and enjoyable. |
54 | 120 |
|
| 121 | +For any issues, suggestions, or contributions, please open an issue or pull request in this repository. We welcome community involvement to make this configuration even better! |
0 commit comments