Discover how a properly formatted workspace can help you unleash your creative potential and bring your ideas to life with optimized configurations and scripts. Streamline your workflow, reduce errors, and create with ease by trying them out today.
Previously, aliases were rolled into the .bashrc file. As of the 16 September commits, all aliases have been moved over to a ".bash_aliases" file, as appropriate per userlevel.
The .bashrc
files in this project improve your experience and productivity when working in the BASH shell.
Notable features include a visually appealing divider displaying the time and date stamp between prompts, which enhances the shell's appearance and aids in debugging:
PROMPT_COMMAND='separator'
# Prompt command to print a graphical divider with time and date stamp between shell prompts.
function separator() {
local datestring=$(date +"%Y%m%d, %A")
local timestring=$(date +"%H%M%S")
local separator_length=80
local date_length=${#datestring}
local time_length=${#timestring}
local space_length=$((separator_length - date_length - time_length - 8))
local line_top="β$(printf "%78s" | tr ' ' ' ')β"
local line_middle="β $(printf " %s %${space_length}s %s " "$datestring" "" "$timestring") β"
local line_bottom="β$(printf "%78s" | tr ' ' ' ')β"
printf "%s\n"
printf "%s\n" "$line_top"
printf "%s\n" "$line_middle"
printf "%s\n" "$line_bottom"
}
β β
β 20230925, Monday 153648 β
β β
The pictured .conkyrc file can be found at https://github.com/apple-fritter/.conkyrc
.
The separator()
function in the provided code generates a graphical divider with a time and date stamp between shell prompts.
-
datestring
: This variable stores the formatted current date and day of the week, using the format%Y%m%d, %A
. For example, it might be "20230615, Thursday". -
timestring
: This variable stores the formatted current time, using the format%H%M%S
. For example, it might be "132900" for 1:29 PM. -
separator_length
: This variable represents the desired length of the separator line. In the provided code, it is set to80
characters, which is often the default width of a terminal window. You can adjust this value to fit your preferred design. -
date_length
: This variable calculates the length of thedatestring
using${#datestring}
. It represents the number of characters in the combined date and day of the week. -
time_length
: This variable calculates the length of thetimestring
using${#timestring}
. It represents the number of characters in the time. -
space_length
: This variable calculates the number of spaces needed to fill the remaining space on the line. It is determined by subtracting thedate_length
,time_length
, and4
(for the spaces and vertical bars) from theseparator_length
. -
line_top
: This variable constructs the top line of the separator, consisting of an upper left corner character, a line of spaces (space_length
, and an upper right corner character. -
line_middle
: This variable constructs the middle line of the separator, containing a vertical bar (|
), a space, thedatestring
, a dynamic number of spaces to align thetimestring
, thetimestring
, a space, and another vertical bar. -
line_bottom
: This variable constructs the bottom line of the separator, similar toline_top
but with a lower left corner character and a lower right corner character.
The printf
statements are used to print each line of the separator.
Make sure to adjust the separator_length
to your desired width, and feel free to modify the formatting to match your preferences.
PS1
and PS2
have been defined, enhancing the prompt's appearance.
PS1='\n\u@\h\n[\w]\n'
PS2='\n βββ '
PS1='\n\u@\h\n[\w]\n'
sets the prompt to display the username , hostname, and current working directory, with a newline to form the prompt:
GitHubFAN23@macbookpro
[~/Downloads]
Prompt text goes here_
PS2='\n βββ '
sets the secondary prompt to show a pattern of block characters. This prompt level provides visual indication that more input is expected.
These files also comprise various settings and aliases that streamline frequently used commands, making them more efficient while the history command and history ignoring commands' format have been tailored to enhance productivity, and they includes aliases for referencing system management shell scripts also provided in this repository.
export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n'
This alias includes the status=progress
option, which provides real-time information on the transfer speed, amount of data transferred, and estimated time remaining.
alias dd='dd status=progress'
alias du='du -kh'
alias df='df -kTh'
alias ls='ls -aclX --color'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history | tail -n1 | sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias wget='wget -c --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0"'
Executes a sequence of cleanup tasks to optimize system performance. It scans for all schema files that are not utilized by any installed applications and removes them to free up space.
THE SCHEMA CLEANER HAS BEEN DISABLED until it is reliable.
ββ Start Script
β
===============[BEGIN BROKEN SECTION]
ββ Check if the schema directory exists
β ββ Directory doesn't exist
β β ββ Display "Directory <schema_dir> not found." and exit
β ββ Continue to next step
β
ββ Find unused schema files
β ββ Find all schema files in <schema_dir> that are not referenced by installed applications, utilizing gsettings
β ββ Store list of unused schema files in UNUSED_SCHEMAS
β
ββ Remove unused schema files
β ββ Loop for each schema in UNUSED_SCHEMAS
β β ββ Remove the schema file
β β ββ Display "Removed <schema_file>"
β ββ Compile the remaining schema files
β
ββ Compile schemas
β ββ Compile the remaining schema files in <schema_dir> using glib-compile-schemas command
β ββ Binary cache files for the schemas are generated
=================[END BROKEN SECTION]
ββ Clean up
β ββ bash history
β ββ backup files
β ββ DS_Store files
β ββ Thumbs.db files
β ββ tmp files
β ββ Java cache
β ββ SQLite3 history
β ββ system cache
β ββ rotated logs
β ββ trash
β ββ thumbnail cache
β ββ X11 debug logs
β
ββ Remove packages that are no longer needed
ββ Clear the local package cache
β
ββ End Script
Automates the process of updating all installed software packages on your system. By running the script from a root prompt, it will automatically search for and install any available updates. This saves time and effort while also keeping your system secure and up-to-date.
ββ Start Script
β
ββ Run apt-get update command
β ββ Automatically answer "yes" to any prompts
β
ββ Run apt-get dist-upgrade command
β ββ Automatically answer "yes" to any prompts
β
ββ End Script
Optimizes system performance by rebuilding the Mozilla Firefox configuration from scratch using a backup skeleton, if available. The script also cleans up various files and directories that tend to accumulate over time and occupy valuable storage space.
ββ Start Script
β
ββ Set working directory to the user's home
β
ββ Home Directory Cleanup
β ββ Remove ~/.cache/ and ~/.android/
β ββ Remove specific files: .xsession-errors*, .wget-hsts, .bash_history, .sudo_as_admin_successful
β
ββ Rebuild Browser Configuration
β ββ Remove browser config directories: ~/.config/BraveSoftware, ~/.config/chromium, ~/.mozilla/
β ββ Rebuild browser config from skeleton file (browser-skel.7z)
β
ββ Clean Up Backup Files
β ββ Delete files with .bak extension
β
ββ Clean Up DS_Store Files
β ββ Delete .DS_Store files
β
ββ Clean Up Thumbs.db Files
β ββ Delete Thumbs.db files
β
ββ Clean Up tmp Files
β ββ Delete files with .tmp extension
β
ββ Remove Editor Cruft
β ββ Remove editor config directories: ~/.config/geany/, ~/.config/Code/, ~/.config/featherpad/, ~/.vscode
β
ββ Clean Up Desktop Entry Files
β ββ Delete .desktop files in ~/.local/share/applications/
β
ββ Clean Up Trash
ββ Delete contents of ~/.local/share/Trash/
Sorts a text file alphabetically and eliminates duplicated lines, saving time and effort while ensuring data accuracy and integrity.
ββ Start Script
β
ββ Sort the contents of file <input_file>
β ββ Store the sorted output in a temporary file <input_file>.tmp
β
ββ Remove duplicate lines from the sorted output
β ββ Store the unique lines in the temporary file <input_file>.tmp
β
ββ Rename the temporary file <input_file>.tmp to <input_file>
β
ββ End Script
This script is a bash shell script designed to convert text files from DOS/Windows
line endings CRLF - Carriage Return Line Feed
to Unix
line endings LF - Line Feed
. When you run this script with a folder path as an argument or without any argument, it will convert all the text files in that folder and its subfolders from DOS/Windows line endings to Unix line endings using the dos2unix command. This is useful when you have files that were created or edited on Windows systems and need to be used on Unix-based systems.
The run_dos2unix_recursive
function is defined to handle the recursive conversion of files in subfolders. It takes one argument, which is the folder path to be processed.
- It loops over all files and folders within the provided folder path using the for loop.
- If the current item in the loop is a subfolder (directory), the function calls itself
run_dos2unix_recursive
recursively to process files within that subfolder. - If the current item is a regular file, it uses the
dos2unix
command to convert the file's line endings from DOS/Windows format to Unix format.
The main
function is defined to handle the execution of the script.
- It checks if any command-line arguments are provided using
$# -eq 0
. If no arguments are provided, it sets the folder_path variable to the current working directory using$(pwd)
. If an argument is provided, it uses that as thefolder_path
. Finally, themain
function is called with the provided command-line argumentsmain "$@"
.
ββ Start Script
β
ββ Check if command-line arguments are provided
β ββ No arguments provided:
β β β
β β ββ Set folder_path to the current working directory ($(pwd))
β β
β ββ Arguments provided
β ββ Set folder_path to the provided argument
β
ββ Call the run_dos2unix_recursive() function with folder_path
β
ββ End Script
Quickly fills a target file with a specified input pattern, making it useful for generating large amounts of sample data for testing or demonstration purposes.
ββ Start Script
β
ββ Define input_file and output_file variables from command line arguments
β ββ Assign the value of the first command line argument to input_file
β ββ Assign the value of the second command line argument to output_file
β
ββ Check if either input_file or output_file is empty
β ββ If either file is empty
β β ββ Prompt user for input file path
β β ββ Prompt user for output file path
β ββ If both input_file and output_file are provided
β ββ Check if the number of arguments is greater than 2
β ββ Display an error message to stderr
β ββ Exit the script with status code 1
β
ββ Use a while loop to continuously append input_file contents to output_file
β ββ Append the contents of input_file to output_file
β
ββ End Script
The while loop continuously appends the contents of the input file to the output file indefinitely, which may result in an infinite loop. You may want to consider adding a condition or an exit condition within the loop to ensure it doesn't run indefinitely.
This software is provided "as is" and without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
The authors do not endorse or support any harmful or malicious activities that may be carried out with the software. It is the user's responsibility to ensure that their use of the software complies with all applicable laws and regulations.
These files released under the MIT License.