Skip to content

Commit e25862d

Browse files
Merge pull request #93 from dacrab/main
-Script optimization - organization
2 parents 5cff41e + 64f6512 commit e25862d

File tree

4 files changed

+517
-278
lines changed

4 files changed

+517
-278
lines changed

README.md

Lines changed: 99 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,121 @@
1-
## Overview of ChrisTitusTech's `.bashrc` Configuration
1+
# ChrisTitusTech's `.bashrc` Configuration
22

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
44

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
826
cd mybash
9-
chmod +x setup.sh
1027
./setup.sh
1128
```
1229

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:
1473

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
1777

18-
### Aliases and Functions
78+
### `config.jsonc`
1979

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:
2281

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
2485

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
2787

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)
2991

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
3295

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
34100

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
39104

40-
### Advanced Functions
105+
## Advanced Functions
41106

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
45110

46-
### Installation and Configuration Helpers
111+
## System-Specific Configurations
47112

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
50116

51-
### Conclusion
117+
## Conclusion
52118

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.
54120

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!

config.jsonc

Lines changed: 108 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,116 @@
11
{
22
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
33
"logo": {
4-
"type": "builtin",
5-
"color": {
6-
"1": "white",
7-
"2": "cyan"
8-
}
4+
"padding": {
5+
"top": 2,
6+
"left": 1,
7+
"right": 2
8+
}
99
},
1010
"display": {
11-
"separator": "",
12-
"color": "cyan"
11+
"separator": " "
1312
},
1413
"modules": [
15-
{
16-
"type": "custom", // HardwareStart
17-
"format": "┌─────────── \u001b[1mHardware Information\u001b[0m ───────────┐" // `\u001b` is `\033`, or `\e`
18-
},
19-
{
20-
"type": "host",
21-
"key": " 󰌢"
22-
},
23-
{
24-
"type": "cpu",
25-
"key": ""
26-
},
27-
{
28-
"type": "gpu",
29-
"detectionMethod": "pci",
30-
"key": ""
31-
},
32-
{
33-
"type": "display",
34-
"key": " 󱄄"
35-
},
36-
{
37-
"type": "memory",
38-
"key": ""
39-
},
40-
{
41-
"type": "custom", // SoftwareStart
42-
"format": "├─────────── \u001b[1mSoftware Information\u001b[0m ───────────┤"
43-
},
44-
{
45-
"type": "os",
46-
"key": "" // Just get your distro's logo off nerdfonts.com,
47-
},
48-
{
49-
"type": "kernel",
50-
"key": "",
51-
"format": "{1} {2}"
52-
},
53-
{
54-
"type": "wm",
55-
"key": ""
56-
},
57-
{
58-
"type": "shell",
59-
"key": ""
60-
},
61-
{
62-
"type": "custom",
63-
"format": "|──────────────\u001b[1mUptime / Age\u001b[0m──────────────────|"
64-
},
65-
{
66-
"type": "command",
67-
"key": " OS Age ",
68-
"keyColor": "magenta",
69-
"text": "birth_install=$(stat -c %W /); current=$(date +%s); time_progression=$((current - birth_install)); days_difference=$((time_progression / 86400)); echo $days_difference days"
70-
},
71-
{
72-
"type": "uptime",
73-
"key": " Uptime ",
74-
"keyColor": "magenta"
75-
},
76-
{
77-
"type": "custom", // InformationEnd
78-
"format": "└────────────────────────────────────────────┘"
79-
},
80-
{
81-
"type": "colors",
82-
"paddingLeft": 2,
83-
"symbol": "circle"
84-
}
14+
// Title
15+
{
16+
"type": "title",
17+
"format": "{#1}╭───────────── {#}{user-name-colored}"
18+
},
19+
// System Information
20+
{
21+
"type": "custom",
22+
"format": "{#1}│ {#}System Information"
23+
},
24+
{
25+
"type": "os",
26+
"key": "{#separator}│ {#keys}󰍹 OS"
27+
},
28+
{
29+
"type": "kernel",
30+
"key": "{#separator}│ {#keys}󰒋 Kernel"
31+
},
32+
{
33+
"type": "uptime",
34+
"key": "{#separator}│ {#keys}󰅐 Uptime"
35+
},
36+
{
37+
"type": "packages",
38+
"key": "{#separator}│ {#keys}󰏖 Packages",
39+
"format": "{all}"
40+
},
41+
{
42+
"type": "custom",
43+
"format": "{#1}│"
44+
},
45+
// Desktop Environment
46+
{
47+
"type": "custom",
48+
"format": "{#1}│ {#}Desktop Environment"
49+
},
50+
{
51+
"type": "de",
52+
"key": "{#separator}│ {#keys}󰧨 DE"
53+
},
54+
{
55+
"type": "wm",
56+
"key": "{#separator}│ {#keys}󱂬 WM"
57+
},
58+
{
59+
"type": "wmtheme",
60+
"key": "{#separator}│ {#keys}󰉼 Theme"
61+
},
62+
{
63+
"type": "display",
64+
"key": "{#separator}│ {#keys}󰹑 Resolution"
65+
},
66+
{
67+
"type": "shell",
68+
"key": "{#separator}│ {#keys}󰞷 Shell"
69+
},
70+
{
71+
"type": "terminalfont",
72+
"key": "{#separator}│ {#keys}󰛖 Font"
73+
},
74+
{
75+
"type": "custom",
76+
"format": "{#1}│"
77+
},
78+
// Hardware Information
79+
{
80+
"type": "custom",
81+
"format": "{#1}│ {#}Hardware Information"
82+
},
83+
{
84+
"type": "cpu",
85+
"key": "{#separator}│ {#keys}󰻠 CPU"
86+
},
87+
{
88+
"type": "gpu",
89+
"key": "{#separator}│ {#keys}󰢮 GPU"
90+
},
91+
{
92+
"type": "memory",
93+
"key": "{#separator}│ {#keys}󰍛 Memory"
94+
},
95+
{
96+
"type": "disk",
97+
"key": "{#separator}│ {#keys}󰋊 Disk (/)",
98+
"folders": "/"
99+
},
100+
{
101+
"type": "custom",
102+
"format": "{#1}│"
103+
},
104+
// Colors
105+
{
106+
"type": "colors",
107+
"key": "{#separator}│",
108+
"symbol": "circle"
109+
},
110+
// Footer
111+
{
112+
"type": "custom",
113+
"format": "{#1}╰───────────────────────────────╯"
114+
}
85115
]
86-
}
116+
}

0 commit comments

Comments
 (0)