Skip to content

Enhances Linux environments with the Starship prompt, personalized aliases, and essential packages. A go-to for setting up new Linux VMs quickly and efficiently.

License

Notifications You must be signed in to change notification settings

LukeWait/custom-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Shell for Linux

Description

Enhances Linux environments with the Starship customizable prompt for visual fanciness, personalized aliases for lazy people, and essential packages. The packages have been selected to enhance navigation and provide a user-friendly experience that, for the most part, seamlessly integrates into everyday use through the use of alias and functions. Further details on the packages and their functionality can be found in the Usage section.

Installing is easy - the setup.sh file takes care of everything, including installing the dependencies and creating symbolic links to the included shell/Starship config files. The script will automatically detect the following and act accordingly:

  • The Linux distribution in use determines how to install dependencies based on the required syntax and package managers (as of v2.0.0, only apt has been tested)
  • The shell type in use determines which shell config file to link (currently only .bashrc is provided however .zshrc is in the works).
  • If you're using a basic terminal with limited color range/font choices it will link to an alternative Starship config that is tailored to these restrictions. It will also skip installation of a Nerd Font as it won't be supported.

The default Starship config features a two-line prompt format as follows:

username@host | ip | dir |
git | py venv | languages | docker >

Note: There are several alternative presets included which will drastically alter the prompt appearance. Manually editing the file is also quite simple, so customize it with what works for you. Details on modifying any of the config files can be found in the Development section.

Example Starship Prompt Appearance

App Screenshot

App Screenshot

Example Starship Prompt Appearance for Basic Terminal (CLI environment)

App Screenshot

App Screenshot

Table of Contents

Installation

Linux

  1. Clone the repository:

    git clone https://github.com/LukeWait/custom-shell.git
    cd custom-shell
  2. Make executable if necessary and run the setup script:

    chmod -x setup.sh
    ./setup.sh
  3. The script will automatically proceed with installations until it gets to Starship. Accept the Starship installation query and upon completion you'll be prompted to restart the terminal to see the changes. You can restart the config file without leaving the terminal with the following command:

    source ~/.bashrc
  4. Change the default font for your terminal to a Nerd Font by checking the available settings. The FiraCode Nerd Font has been installed as part of the setup script at:

    ~/.local/share/fonts/FiraCode

    Note: Basic terminals/CLI environments will not support Nerd Fonts. If the environment running setup.sh is a basic terminal, the Nerd Font won't be installed. Install more Nerd Fonts by visiting https://www.nerdfonts.com/ and extracting the download into the above directory.

Windows

The setup.sh file will not work with Windows however you can take advantage of the Starship custom prompt styles.

  1. Install Starship with winget package manager (details on winget and how to install: https://learn.microsoft.com/en-us/windows/package-manager/winget/):

    winget install --id Starship.Starship
  2. Create a starship.toml file somewhere (clone the repo and choose a preset).

  3. Install a Nerd Font by visiting https://www.nerdfonts.com/ and adding the extracted download files to Control Panel\Fonts.

  4. Install Clink to utilize Starship with Command Prompt. This package includes auto completion and other features present in Linux distros (details on clink and features: https://chrisant996.github.io/clink/clink.html):

    winget install clink
  5. Create config files for Command Prompt and PowerShell to initialize Starship and provide path to starship.toml file:

    • Command Prompt - Create file at %LocalAppData%\clink\starship.lua with properties:
    load(io.popen('starship init cmd'):read("*a"))()
    os.setenv('STARSHIP_CONFIG', 'C:\\<path\\to>\\starship.toml')
    • Powershell - Add the following to PowerShell Configuration (use $PROFILE to find and create if it doesn't exist):
    Invoke-Expression (&starship init powershell)
    $ENV:STARSHIP_CONFIG = "$HOME\<path\to>\starship.toml"
  6. Lastly, configure the Command Prompt and PowerShell windows to use a Nerd Font:

    • Right click on taskbar of Command Prompt and choose Settings\Profiles\Defaults. Scroll to the bottom and click Appearance and then change the font face to a Nerd Font.
    • Admin versions of need to be addressed individually, open an admin Command Prompt/PowerShell and right click on taskbar and choose Properties\Font and then choose a Nerd Font.

Usage

Included Packages

starship The minimal, blazing-fast, and infinitely customizable prompt for any shell!

https://github.com/starship/starship

Starship Video

ble.sh Bash Line Editor (ble.sh) is a command line editor written in pure Bash which replaces the default GNU Readline. It enhances the Bash shell experience by adding advanced features like auto-completion and syntax highlighting.

https://github.com/akinomyoga/ble.sh

ble.sh Screeenshot

zoxide zoxide is a smarter cd command, inspired by z and autojump.

It remembers which directories you use most frequently, so you can "jump" to them in just a few keystrokes.

https://github.com/ajeetdsouza/zoxide

zoxide Video

fzf fzf is a general-purpose command-line fuzzy finder.

It's an interactive filter program for any kind of list; files, command history, processes, hostnames, bookmarks, git commits, etc. It implements a "fuzzy" matching algorithm, so you can quickly type in patterns with omitted characters and still get the results you want.

https://github.com/junegunn/fzf

fzf Screeenshot

tldr The tldr-pages project is a collection of community-maintained help pages for command-line tools, that aims to be a simpler, more approachable complement to traditional man pages.

https://github.com/tldr-pages/tldr

tldr Screeenshot

btop Resource monitor that shows usage and stats for processor, memory, disks, network and processes.

C++ version and continuation of bashtop and bpytop.

https://github.com/aristocratos/btop

btop Screeenshot

bat A cat clone with syntax highlighting and Git integration

https://github.com/sharkdp/bat

bat Screeenshot

thefuck A tool that corrects errors in your previous console command.

https://github.com/nvbn/thefuck

thefuck Video

fastfetch Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily. It is written mainly in C, with performance and customizability in mind.

https://github.com/fastfetch-cli/fastfetch

fastfetch Screeenshot

multitail MultiTail allows you to monitor logfiles and command output in multiple windows in a terminal, colorize, filter and merge.

https://github.com/folkertvanheusden/multitail/?tab=readme-ov-file

multitail Screeenshot

trash-cli trash-cli trashes files recording the original path, deletion date, and permissions. It uses the same trashcan used by KDE, GNOME, and XFCE, but you can invoke it from the command line (and scripts).

Overview of Aliases & Functions in .bashrc

Aliases
  • alert - Notify on long-running commands.
  • ebrc - Edit .bashrc with nano.
  • da - Show current date and time.
  • Modified commands:
    • cp - Copy with confirmation.
    • mv - Move with confirmation.
    • rm - Move to trash.
    • mkdir - Create directory with parents.
    • ps - Show process status.
    • ping - Ping 10 times.
    • less - Show less with color.
    • multitail - Multi-tail with no repeat.
    • freshclam, apt, apt-get - Run with sudo.
  • Change directory:
    • home, cd.., .., ..., ...., ..... - Navigate directories.
    • bd - Change to previous directory.
    • web - Go to web directory.
  • rmd - Remove directory recursively and forcefully.
  • List directories:
    • la - List all with details.
    • ls - List all with color.
    • lx, lk, lc, lu, lr, lt, lm, lw, ll, labc, lf, ldir - Various ls options.
  • Chmod commands:
    • mx, 000, 644, 666, 755, 777 - Change permissions.
  • Search:
    • h - Search history.
    • p - Search processes.
    • topcpu - Show top CPU processes.
    • f - Search files.
  • countfiles - Count files, links, directories.
  • openports - List open ports.
  • Reboot:
    • rebootsafe, rebootforce - Safe and forced reboot.
  • Disk space:
    • diskspace - Show disk space.
    • folders, folderssort - Show folder sizes.
    • tree, treed - Show directory tree.
    • mountedinfo - Show mounted filesystems.
  • Archives:
    • mktar, mkbz2, mkgz - Create tar archives.
    • untar, unbz2, ungz - Extract archives.
  • logs - Show all logs.
  • sha1 - Generate SHA1 hash.
  • clickpaste - Paste clipboard content.
  • kssh - Use Kitty features on remote servers.
Functions
  • command_exists() - Checks if a command exists in the system.
  • extract() - Extract various types of archives (tar, gzip, bzip2, etc.) based on file extension.
  • ftext() - Searche for text in all files in the current directory recursively, with case insensitivity and line numbering.
  • cpp() - Copy files with a progress bar showing the completion percentage.
  • cpg() - Copy files and changes directory to the destination if it's a directory.
  • mvg() - Move files and changes directory to the destination if it's a directory.
  • mkdirg() - Create directories recursively and changes directory to the newly created directory.
  • cd() - Change directory using zoxide and lists the contents of the directory automatically.
  • distribution() - Display the current Linux distribution.
  • ver() - Display the current version of the operating system.
  • install_bashrc_support() - Install dependencies and support files for .bashrc based on the Linux distribution.
  • whatsmyip() - Display internal and external IP addresses.
  • apachelog() - Display Apache logs using multitail.
  • apacheconfig() - Edit the Apache configuration file.
  • phpconfig() - Edit the PHP configuration file.
  • mysqlconfig() - Edit the MySQL configuration file.
  • trim() - Trim leading and trailing spaces.
  • gcom() - GitHub: Add files, commit with message.
  • lazyg() - GitHub: Add files, commit with message, and push.

Development

Modifying starship.toml

  • Documentation on modifying the Starship config file, as well as the modules which can be included in the prompt, can be found here.

Modifying setup.sh

  • To add/remove packages from installation script, locate the installDepend() function and add/remove from DEPENDENCIES/PYTHONSTUFF variables. Packages requiring additional steps, such as installing the latest version of fastfetch for apt, can be adjusted directly from the case relevant to each $PACKAGER.
  • If adding an installation by using a downloaded script, and the process is the same for all distros, create a new function using the installStarship() function as a functional template. Ensure to add the function call to the end of the script.
  • Linking shell and Starship config files occurs in the linkConfig() function. If you create addtional shell config files for other shell types you can add them here. You can also change the path for any of the linked files in case you want to store them elsewhere and delete the cloned repo after running the setup.

Modifying .bashrc

  • SYSTEM CONFIG: Fastfetch is set to automatically run whenever a new terminal is started - you can remove that functionality here.
  • EXPORTS: Here you can set the shell default settings such as preferred text editor. Everything is labelled so modify as you see fit.
  • ALIASES/FUNCTIONS: Again, everything is labelled so should be pretty straightforward.
  • INITIALIZATION: Here you can add/remove key bindings for keyboard shortcuts. Some packages, such as Starship, zoxide, thefuck, and bl.esh, require initialization/referencing whenever a shell is launched. Ensure the eval statements for these packages remain intact unless you plan to remove them. As recommended on the bl.esh GitHub repo, it is first instantiated in the SYSTEM CONFIG section and is then initialized here.

Testing

Version v2.1.0 has been tested and is fully functional in the following environments:

  • Advanced Terminal:

    • Kali 2024 using bash
  • Basic Terminal/CLI Environment:

    • Ubuntu 22.04 using bash

Work in progress:

  • Test non-debian package installation process
  • Create .zshrc file based on .bashrc and test

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Modified verison of christitustech's mybash: https://github.com/ChrisTitusTech/mybash

Sourced Aliases and scripts by zachbrowne.me: https://gist.github.com/zachbrowne/8bc414c9f30192067831fafebd14255c

Source Code

The source code for this project can be found in the GitHub repository: https://github.com/LukeWait/custom-shell.

Dependencies

  • Linux operating system
  • Bash

About

Enhances Linux environments with the Starship prompt, personalized aliases, and essential packages. A go-to for setting up new Linux VMs quickly and efficiently.

Topics

Resources

License

Stars

Watchers

Forks

Languages