Skip to content

Instantly share code, notes, and snippets.

@sebastiancarlos
sebastiancarlos / info-man.bash
Last active October 27, 2023 10:34
Efficient info command, interoperable man command
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=ISKzBlzXRWE
# Add this to your .bashrc:
# get the texinfo node for a command
# - takes a command name, like 'cat'
@sebastiancarlos
sebastiancarlos / diffc-diffh.bash
Last active August 15, 2024 06:07
Custom variations of diff: diffh (diff history) and diffc (diff commands)
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=nf3ddQniw-o
# diffc - diff commands
# - allows to call as: diffc 'command one' 'command two'
# instead of: diff <(command one) <(command two)
# (Just to save typing a few characters. Lol I'm a lazy programmer)
@sebastiancarlos
sebastiancarlos / useradd-color.bash
Created September 11, 2023 09:30
Custom version of useradd which adds color and extra information to "useradd --defaults"
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
### Make sure this file is visible from your $PATH and called 'useradd'
# Video demo: https://www.youtube.com/watch?v=Nzl2YzYDFlI
### Sample output:
#
@sebastiancarlos
sebastiancarlos / fdisk-color.bash
Last active December 17, 2024 18:36
Custom version of the "fdisk" command, with color.
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=Dl2n_fcDjkE
### Add this to your .bashrc
# custom fdisk
# - add color when called with -l or -x
# - prepend sudo
function fdisk () {
@sebastiancarlos
sebastiancarlos / free-color.bash
Last active September 8, 2023 20:37
Custom version of the "free" command, with color.
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=Dl2n_fcDjkE
### Add this to your .bashrc
# custom free
# - add common options
# - add color
# - add footer
@sebastiancarlos
sebastiancarlos / less-horizontal.bash
Last active September 6, 2023 09:06
The less command... now with horizontal scrolling too!
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=lSOVozD7Iio
### Add this to your .bashrc
export LESS="--RAW-CONTROL-CHARS --quit-if-one-screen --clear-screen --tilde"
# version of less that scrolls
alias less="less --chop-long-lines --status-column --rscroll='>'"
@sebastiancarlos
sebastiancarlos / colorgpg.bash
Last active January 7, 2024 12:48
Color output for GnuPG
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=cDlWF48xaGQ
# Add this to your .bashrc
# custom gpg
# - add color output
# - replace $HOME with ~
# - Add footer with explanation of terms
@sebastiancarlos
sebastiancarlos / sourceme.bash
Last active August 25, 2023 17:19
Template for a sourceable but non-executable shell script. Useful for initialising an interactive shell environment.
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=cOYVjk26504
red="\e[31m"
green="\e[32m"
reset="\e[0m"
@sebastiancarlos
sebastiancarlos / open_links_with_keyboard.bash
Last active August 25, 2023 02:55
Opening links in your Bash terminal with the keyboard
@sebastiancarlos
sebastiancarlos / custom-type.bash
Last active August 23, 2023 11:48
Custom version of the Bash 'type' command, navigating symlinks and aliases.
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/shorts/mYfEIZFlIwo
# Put this in your .bashrc or something like that
# pretty_print_directory
# - replace $HOME with ~
# - make everything before the last '/' green, and everything after white and
# bold