Skip to content

GoodM4ven/CLI_LINUX_bash-aliases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

بسم الله الرحمن الرحيم

bash-aliases

Some quick helper scripts that I use in Ubuntu; added in .bashrc as aliases.

Ubuntu Linux

update

Updates the system packages, including Flatpak's and Snap's.

alias update='sudo apt update && sudo apt upgrade && sudo flatpak update && sudo snap refresh'

clean

Cleans off various directories of temporary files and dependency accumulated update caches. Moreover, it does clean the system logs (keeping only the last 7 days') that could do accumulate size over time.

alias clean='sudo rm -rf /var/lib/snapd/cache/* && flatpak uninstall --unused && sudo rm -rf /tmp/* /var/tmp/* && sudo journalctl --vacuum-time=7d'

gdmres

Attempts to recover from Gnome-Shell display manager (GDM) crashes... -Which usually fails anyway!

alias gdmres='sudo systemctl stop gdm3 && sudo systemctl restart display-manager && sudo systemctl start gdm3 && sudo loginctl terminate-user $(whoami) && sudo reboot now'

Arabic

Dealing with Arabic strings.

aranum

Converts Arabic-to-Indian numerals and vice-versa.

Input:

aranum 1234

Output:

١٢٣٤

arastrip

Strips away common Arabic tashkeel real quick.

Input:

arastrip "أَيُّ سَمَاءٍ تُظِلُّنِي ، أَوْ أَيُّ أَرْضٍ تُقِلُّنِي ، إِنْ أَنَا قُلْتُ فِي كِتابِ اللَّهِ مَا لَا أَعْلَمُ ؟"

Output:

أي سماء تظلني ، أو أي أرض تقلني ، إن أنا قلت في كتاب الله ما لا أعلم ؟

Development - Version Control

oops

Resolves the situation of an accidental last push commit without checking for possible commits to pull them first; basically being stuck between pulling and pushing. And it works in 2 steps:

  • Pulls in the latest changes from the correct remote repository.
  • Rebases the local commits on top of those prior to keep the commit history clean.
alias oops='git pull --rebase origin $(git rev-parse --abbrev-ref HEAD)'

grim

Removes files/folders from the cached version control, when they have been committed before.

alias girm='f() { git rm -r --cached "$1"; }; f'

Important

It obviously needs the correct path of a file/directory, passed as an argument, in order to be removed.

chest

Stashes the current changes local changes properly; meaning that it's done including the untracked files. (New files that weren't committed from before!)

alias chest='git stash push -u'

Note

Who would have thought that this was not the default bahavior to git stash push command, am I right?! (curbs furiousness)

grit

When dealing with dev-branch conflict resolving, this command eases out the default process by miles; since it accounts for the dev branch to be the "source of truth" during the merging process.

alias grit='git merge -X theirs origin/dev'

Development - TALL Stack

cda

Stands for composer dump-autoload, which is a very common back-end packages stabalizer!

alias cda='composer dump-autoload'

art

The awesome shortcut for using Laravel's Artisan scripts runner.

alias art='php artisan'

wipe

Wipes out the current database content, using the art above.

alias wipe='php artisan db:wipe'

fresh

Cleans and migrates the database, using the art above.

alias fresh='php artisan migrate:fresh'

mfs

Stands for migrate-fresh and seed; bascially, doing the wipe and fresh together.

alias mfs='php artisan migrate:fresh --seed'

opt

A shortcut for running optimize:clear, which is another art to quickly clear all possible caching techniques in Laravel; ensuring there is no Cache driver failure that results "stuck" files and stuff!

alias opt='php artisan optimize:clear'

dev

Quickly spins up ViteJS watcher to keep track of front-end asset changes; depending on your configuration file.

alias dev='bun run dev'

pail

Another quick art to start listening and capturing Laravel's dumps, dies and logs within the terminal.

alias pail='php artisan pail'

que

Runs a Laravel's Queues worker real quick.

alias que='php artisan queue:work'

pest

Executes a huge amount of processes regarding testing the TALL app, including:

  • Formatting Laravel Blade files, via the superb, yet unofficial, Laravel Blade Formatter.
  • Formatting CSS/JS files using Prettier.
  • Formatting PHP files, using Laravel's official: Pint.
  • Performing static-analysis over PHP files using Larastan.
  • Running PestPHP for powerful and expressive PHP testing; in parallel mode, and while logging the results to a [phpunit.results.xml] file.
alias pest='f() { bunx blade-formatter --write "resources/views/**/*.blade.php"; bunx prettier --write "resources/js/**/*.js" "resources/css/**/*.css"; ./vendor/bin/pint; ./vendor/bin/phpstan; ./vendor/bin/pest "$1" --parallel --processes=8 --log-junit phpunit.results.xml; }; f'

Note

Possible pest arguments can be passed to the command as well.

bench

Calls Testbench's Artisan script that is used for simulating a Laravel environment and test packages.

alias bench='f() { ./vendor/bin/testbench "$1"; }; f'

lara (Extra)

It's just a shortcut to run lara-stacker CLI, in order to manage simultaneous development of TALL stack apps on Linux.

alias lara='cd /home/goodm4ven/Code/Scripts/lara-stacker && sudo ./lara-stacker.sh'

Personal Preferences (AKA. Opinions)

code

Typing codium is much harder than just code, where the latter is the official VSC's by default, sadly...

alias code='f() { codium "$1"; }; f' 

vsix

Since I'm still on team-VSC, techincally, building VSIX packages is quite usual for me, hence the command.

alias vsix='bun install && vsce package'

Todos

  • // TODO A command for "clearing" TALL apps
  • // TODO A command for logging in the PHPUnit results log using Bash
    • // TODO Adding it to the pest command, and running it right after the tests.
    • // TODO Meaning separating it to a full Bash script file
  • // TODO A command to pull in and display a random aya, plus its transcriptive aathar
  • // TODO A command to pull in and display a random hadeeth, plus its English translation

Support

Support ongoing package maintenance as well as the development of other projects through sponsorship or one-time donations if you prefer.

And may Allah accept your strive; aameen.

License

This package is open-sourced software licensed under the MIT license.

Credits


والحمد لله رب العالمين

About

A personal developer's collection of commands and scripts.

Topics

Resources

License

Stars

Watchers

Forks

Languages