Bash / Zsh / Fish
- ssh
- should have just an installer / profile for my alias as well
- have bats in another page
- https://github.com/hychan48/devcontainer/blob/updating-scripts/assets/profile-utils/append-zsh-alias.sh
- command-not-found.com
- game changer
- OMZ Install Notes
Install Oh My Zsh
bash
# new script somewhere
# Delete if exists / continue
sudo apt update -y
sudo apt install tree git curl zsh tldr -y
# chsh -s $(which zsh) # enter password again
sudo chsh -s $(which zsh) $USER
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# using antigen
#git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# only if not using antigen
#sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
# exec zsh -l
# set TERM=xterm-256color
# export TERM=xterm-256color # for bash
#
txt
# https://github.com/devcontainers-contrib/features/tree/main/src/zsh-plugins
# https://github.com/devcontainers-contrib/features/tree/main/test/zsh-plugins
bash
# Delete if exists / continue
sudo dnf update
# sudo dnf install zsh tree git curl -y # skipping curl because aws already has it's own curl
sudo dnf install zsh tree git -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
exec zsh -l
bash
# Delete if exists / continue
sudo pacman -S zsh tree git curl -y
chsh -s $(which zsh) # enter password again
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# not really needed now adays
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
exec zsh -l
Dependencies
bash
#* curl is more basic than wget
#* https://ohmyz.sh/#install
sudo apt update
sudo apt install tree git curl -y
# ssh keys / config ln for wsl?
# +tmux
Git Setup
bash
# https://github.com/zsh-users/zsh-autosuggestions/issues/557
# git config --global core.autocrlf false
git config --show-origin core.autocrlf
git config --show-scope core.autocrlf
git config --global core.autocrlf input
git config --global core.eol lf
git config --global pull.rebase false # merge (the default strategy)
sudo git config --system core.autocrlf input
sudo git config --system core.eol lf
sudo git config --system pull.rebase false # merge (the default strategy)
init(){
rm -rf ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git config --global --list
git config --global user.name "hychan48"
git config --global user.email "jchan48@gmail.com"
git config --global pull.rebase false # merge (the default strategy)
ZSHRC
bash
# Installing antigen plugin to ~/.local/share/antigen.zsh
# using zshrc plugin manager
mkdir -p ~/.local/share/ ~/.local/bin
sudo apt install tmux
curl -L git.io/antigen > ~/.local/share/antigen.zsh # git clone would work too
bash
# .zshrc
# using zshrc plugin manager
# plugins=(git zsh-autosuggestions)
source ~/.local/share/antigen.zsh
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
antigen bundle zsh-users/zsh-history-substring-search
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle git # default
antigen bundle ssh
#antigen bundle ssh-agent
#antigen bundle docker
#antigen bundle docker-compose
# antigen bundle fd
# antigen bundle fzf
antigen bundle gh
antigen bundle tmux
antigen bundle vscode
antigen bundle colorize
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/timer
antigen bundle timer # TIMER_THRESHOLD in seconds
export TIMER_THRESHOLD=5
antigen bundle colored-man-pages
antigen bundle debian # todo... check if it is debian / ubuntu before adding
#antigen bundle copypath # clipcopy: Platform linux-gnu not supported or xclip/xsel not installed
antigen bundle sudo # esc esc toggle for sudo or sudo -e
source $ZSH/oh-my-zsh.sh
antigen apply # use. omz must be sourced first
zsh
PROMPT="$USERNAME@`hostname`%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%}"
PROMPT+=' $(git_prompt_info)'
# export TERM=xterm-256color
zsh
# -z is for empty. i.e. if code cmd is not found (empty)
if [[ -z $(whence code) ]]; then
# check if this works, i think it's when ssh is invoked, so wrong path.
alias code="/usr/bin/code"
fi
# technically full path
alias cd-current-file="cd $(dirname \"$1\")"
zsh
function cd-current-file(){
TMP1=$1
# local TMP1="C:\Program Files\Sublime Merge\Git\usr\bin\echo.exe"
local TMP1P=$(cygpath -u "$TMP1")
# echo $TMP1P
cd "$(dirname "$TMP1P")"
# pwd
}
zsh
if [[ -z $(whence code) ]]; then
# msys2
alias code="/c/Users/$USER/AppData/Local/Programs/Microsoft\ VS\ Code/Code.exe"
fi
function cd-current-file(){
TMP1=$1
# local TMP1="C:\Program Files\Sublime Merge\Git\usr\bin\echo.exe"
local TMP1P=$(cygpath -u "$TMP1")
# echo $TMP1P
cd "$(dirname "$TMP1P")"
# pwd
}
bash
# use alt click to copy it seems in vscode
echo "setw -g mouse on" >> ~/.tmux.conf
# default zsh
echo "set-option -g default-shell /bin/zsh" >> ~/.tmux.conf
# source right away
tmux source ~/.tmux.conf
bash
# PROMPT and color
## add username ##
#1. todo refactor into a few aliases or something? or just use tmux
#PROMPT="$USERNAME %(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) "
#2. this one username@ hostname - no color though
# PROMPT="$USERNAME@SOME_NAME%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%}"
# this one has hostname. can choose not to use it
PROMPT="$USER@`hostname`%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%}"
PROMPT+=' $(git_prompt_info)'
# git prompt. self explainitory
PROMPT="$USERNAME %(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) "
# https://superuser.com/questions/382503/how-can-i-put-a-newline-in-my-zsh-prompt-without-causing-terminal-redraw-issues/986820#986820
#NEWLINE=$'\n'
# PROMPT="$USERNAME@`hostname`-debian${NEWLINE}└─ %(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%} "
# use tree command to get the ascii. either tree or tree -A
#PROMPT="$USERNAME@`hostnamectl --pretty`%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%} "
# there's also like tmux xterm-color debian etc.
# export TERM=xterm-256color || export TERM=xterm
if [ $(tput colors -T xterm-256color) == "256" ]; then
# maybe i should check before doing so. and add my own little snippet
# tput colors -T xterm-256color
# only relevant for onetime setup:
# echo 'export TERM=xterm-256color' >> ~/.zshrc
# arg
# export TERM=xterm-256color || export TERM=xterm
# this was the culprit
fi
export TERM=xterm-256color
#sudo apt-get install tmux -y
# test $TMUX && tmux setw -g mouse on # allows scroll
# export PASSWORD=password
# export VISUAL="`whence code` --wait --new-window"
# depending on which one... --reuse-window is faster
# export VISUAL="`whence code` --wait --reuse-window"
# sudo -e /etc/default/grub
# alias type-login='DISPLAY=:0 ; PASSWORD=password ; xdotool type --delay 100 $PASSWORD && xdotool key KP_Enter'
# pipx autocompletion with micromamba - can use env variable i believe
autoload -U bashcompinit
bashcompinit
# eval "$(register-python-argcomplete pipx)"
# eval "$(/home/DEFAULT/micromamba/envs/311/bin/register-python-argcomplete pipx)"
#eval "$(/root/micromamba/envs/311/bin/register-python-argcomplete pipx)"
#eval "$($HOME/micromamba/envs/311/bin/register-python-argcomplete pipx)"
alias conda="micromamba"
#export PATH="$PATH:$HOME/micromamba/envs/311/bin"
bash
echo 'PROMPT="$USERNAME@`hostname`%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%} "' >> ~/.zshrc
source ~/.zshrc
bash
# use alt click to copy it seems in vscode
echo "setw -g mouse on" >> ~/.tmux.conf
# default zsh
echo "set-option -g default-shell /bin/zsh" >> ~/.tmux.conf
# source right away
tmux source ~/.tmux.conf
bash
tmux setw -g mouse on # allows scroll
# use alt click to copy it seems in vscode
code ~/.tmux.conf
echo "setw -g mouse on" >> ~/.tmux.conf
cat ~/.tmux.conf
setw -g mouse on
tmux setw -g mouse on # allows scroll
bash
# Start D-Bus on WSL startup
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
eval "$(dbus-launch --sh-syntax --exit-with-session)"
# eval "$(dbus-launch --sh-syntax)"
fi
gsettings list-recursively | grep virt-manager
gsettings list-recursively | grep virt-manager |grep xml
# org.virt-manager.virt-manager xmleditor-enabled false
gsettings set org.virt-manager.virt-manager xmleditor-enabled true
virt-manager --no-fork
# <domain name="SOME.home.arpa" localOnly="yes"/>
bash
# IBus (Intelligent Input Bus) on a Linux system
# For international
# It is an input method framework for multilingual input in Unix-like operating systems.
# untested:
sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4
# place this in the .zshrc or .bashrc or .xprofile
# -d is daemon -r is replace -x is xim
ibus-daemon -drx
# ibus-daemon -d -x
# .xprofile or .bashrc etc
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
source ~/.xprofile
source ~/.bashrc
source ~/.zshrc
sudoers
bash
# don't use any ~ or . extentions or it wont work
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER
# i.e.
## echo "jason ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/jason
bash
# as su
echo "jason ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/jason
- change logic to append /etc/sudoers.d/nopasswd-all
- generate / populate ssh config
- SSH Docs
GSUDO
- Game changer
- https://github.com/gerardog/gsudo
- add to path iirc
powershell
PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; [Net.ServicePointManager]::SecurityProtocol = 'Tls12'; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"
ps1
winget install gerardog.gsudo
ps1
$existingPath = [Environment]::GetEnvironmentVariable('Path', 'User')
$existingPath # prepend takes priority
$existingPath = "C:\Program Files\gsudo\2.4.2;$existingPath"
$existingPath
# replace any ;;
$existingPath = $existingPath -replace ';;',';'
# in windows path priority is given to user path and priority is from left to right?
[Environment]::SetEnvironmentVariable('Path', $existingPath, 'User')
$env:Path=$existingPath
gsudo
ps1
# windows is bottom priority?
# uh i think it's top... confusing stuff
$pathsToAdd = @(
'C:\Program Files\gsudo\2.4.2',
'C:\Program Files\JetBrains\WebStorm 2020.3\bin',
'C:\Program Files\OpenSSH',
# apparently has max length
# power toys dont
}
# $existingPath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
$existingPath = [Environment]::GetEnvironmentVariable('Path', 'User')
$newPaths = $existingPath.Split(';') + $pathsToAdd
$newPath = $newPaths -join ';'
$envKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey('System\CurrentControlSet\Control\Session Manager\Environment', $true)
$envKey.SetValue('Path', $newPath, 'ExpandString')
$envKey.Close()
ps1
Get-ChildItem Env: # powershell print w/o cygwin
$env:PATH = "SomeRandomPath"; #(replaces existing path)
$env:PATH += ";SomeRandomPath" #(appends to existing path)
$env:PATH="C:\Program Files\OpenSSH;$env:PATH" # prepend takes precedence
# c:/progra~1/openssh # didnt seem to work?
- https://www.techtarget.com/searchitoperations/answer/Manage-the-Windows-PATH-environment-variable-with-PowerShell
- good module to try out
Cockpit
bash
#!/usr/bin/env bash
# as root
sudo apt update && sudo apt install wget cockpit -y # i think build utils as well
sudo cat /etc/cockpit/disallowed-users # empty on ubuntu / comment our #root or remove
sudo sed -i 's/^root/#root/' /etc/cockpit/disallowed-users
sudo systemctl enable --now cockpit.socket # default is :9090
# Plugins:
# 1. file directory navigation
## https://github.com/45Drives/cockpit-navigator
## might no be latest:
wget https://github.com/45Drives/cockpit-navigator/releases/download/v0.5.10/cockpit-navigator_0.5.10-1focal_all.deb
apt install ./cockpit-navigator_0.5.10-1focal_all.deb
bash
# /etc/cockpit/cockpit.conf
# for proxying
# assuming nginx is local - working
# maybe change port? iunno it's 9090 by default
[WebService]
Origins = https://www.domain.amd.com
ProtocolHeader = X-Forwarded-Proto
ForwardedForHeader = X-Forwarded-For
LoginTitle = https://www.domain.amd.com
# replaces the servername on the webgui login page
nginx
todo...
cwd
sh
#!/usr/bin/env sh
current_script_path="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")"
script_directory="$(dirname "$current_script_path")"
bash
#!/usr/bin/env bash
current_script_path="${BASH_SOURCE[0]}"
script_directory="$(dirname "$current_script_path")"
zsh
#!/usr/bin/env zsh
current_script_path=$0:A # for zsh only
script_directory=$0:A:h
- source dir
- current dir
Snippets
bash
#!/usr/bin/env bash
# reversed... logic i believe
grep bla ~/.ssh/ ; echo $?
# 2 if it doesnt exist...
bash
dpkg -l | grep -qw "ii git" || sudo apt-get install -y git
Make public repo
- using stackblitz / codepsace
- jsh?
- no
bash
VMS=()
while IFS= read -r line; do
if [[ -n "$line" ]]; then # Check if line is not empty
VMS+=("$line")
fi
done < <(virsh list --inactive --name)
echo "${VMS[0]}" # First element
echo "${VMS[1]}" # Second element
for VM in "${VMS[@]}"
do
echo "$VM"
done
exit 0
Common Environment Variables
TMPDIR
*ls /tmp
- +cygwin
- $env:TMP
- $env:TEMP
$env:LocalAppData/Temp
Notes
bash
# find filename glob
find <starting_directory> -type f -name "<filename_pattern>"
myls() {
ls "$@" # "$@" represents all the arguments passed to the function
}
# find and chmod
# find and git chmod
Download file
- wget is the package manager
- curl is the communication client that can also download
bash
# only download if new or updated?
apt install wget curl -y
wget -N URL
curl -O -z local_filename URL
#* wget is mostly to download
#* curl does a lot mroe
sh
#!/usr/bin/env bash
# open in cygwin
function hardcoded7zTarXZ {
# -N = newer -P = path. # might want to check or keep?
wget -N -P /tmp/ https://www.7-zip.org/a/7z2301-linux-x64.tar.xz
# -xf for .tar ?
# --xz (J) or -z for gzip (gz) or --gzip
mkdir -p /tmp/7z2301-linux-x64
tar -xf /tmp/7z2301-linux-x64.tar.xz -C /tmp/7z2301-linux-x64/ # works
mv /tmp/7z2301-linux-x64 /usr/local/lib/7z2301-linux-x64
ln -sf /usr/local/lib/7z2301-linux-x64/7zz /usr/local/bin/7zz
# validate
which 7zz |grep 7zz # this works
}
# to make smarter later
function downloadTar(){
}
exit 0
# later... make universal
# like 7z?
# For cygwin 7z is already in /usr/bin
# just making it to /usr/local/bin for testing
ll /usr/local/bin
ll /usr/local/lib
# might want to keep the 7z for checking but maybe later
# folder struct is like this /usr/lib/zsh/5.8
# but python may be like this : node_modules python2.7 python3.5 python3.6 python3.8
# ln -sf /usr/local/lib/7z2301-linux-x64/7zzs /usr/local/bin/7zzs
# so it really depends
# dry run - maybe just zip something iuno but it's working
# tree /tmp |grep 7z # it's 7zz and 7zzs for this. interesting
# wget -N -P /tmp/ https://www.7-zip.org/a/7z2301-extra.7z
# 7zz l /tmp/7z2301-linux-x64 /usr/local/lib/7z2301-extra.7z -slt
# windows /cygwin buggy with the grep
term256
bash
tput colors
export TERM=xterm
export TERM=xterm-256color
# https://www.linuxquestions.org/questions/slackware-14/xterm-doesn%27t-support-256-colors-because-linked-against-termcap-not-terminfo-4175651435/
Set Hostname
bash
# Don't add domain... that's fqdn
NEWHOSTNAME=somename;
# NEWHOSTNAME=somename.localdomain; # WRONG
hostnamectl set-hostname $NEWHOSTNAME;
hostnamectl set-hostname $NEWHOSTNAME --pretty;
# check with
hostnamectl
hostname
hostname --fqdn
hostname -A # --all-ip-addresses
x11 / xubuntu keyboard
- password workaround / notes
bash
export DISPLAY=:0
xeyes
xhost # print list
# set root
xhost si:localuser:root
# send keyboard input
sudo apt-get update
sudo apt-get install -y xdotool
xdotool key Return
# search for firefox
xdotool search --onlyvisible --name firefox
xdotool click 3 # left or right?
xdotool getactivewindow
# get name of active window
xdotool getwindowname $(xdotool getactivewindow)
xdotool windowfocus --sync 12345
xdotool type --delay 500 "Hello world"
xdotool key KP_Enter
# added env variable
source ~/.zshrc
xdotool type --delay 100 $PASSWORD && xdotool key KP_Enter
xdotool type --delay 100 "hello there" && xdotool key KP_Enter
# --sync waits for the mouse to move
xrandr --query # shows all
xrandr --query | grep ' connected' | grep -oP '\d+x\d+\+\d+\+\d+'
xrandr --query | grep ' connected'
# DP-1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 546mm x 352mm
xdotool getmouselocation --shell
xdotool mousemove x y
xdotool mousemove_relative --sync -- 50 50
txt
The KP keyboard code refers to the keycodes associated with the numeric keypad on a keyboard.
Keypad keycodes commonly used:
Numeric Keypad Keys (KP):
KP0 to KP9: Numeric keypad keys 0 to 9
KP_Add: Addition key (+)
KP_Subtract: Subtraction key (-)
KP_Multiply: Multiplication key (*)
KP_Divide: Division key (/)
KP_Decimal: Decimal point key (.)
KP_Enter: Enter key on the numeric keypad
screensaver xfce
- there's disable lock screen
- and also it's in the Power Manager
bash
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/lock-screen-suspend-hibernate # default returns 'true'
# not sure if this worked...
xfconf-query -c xfce4-screensaver # needs a property
xfconf-query -c xfce4-screensaver -l # list
xfconf-query -c xfce4-screensaver -p /lock/sleep # check. empty... interesting
# -c channel -p property -s value --create -t type
xfconf-query -c xfce4-screensaver -p /lock/sleep -s false --create -t bool
clipboard
shared directory
- for ubuntu / debian
bash
# create alias ~shared to /srv/shared
sudo mkdir -p /srv/shared
sudo mkdir -p /srv/shared/downloads
sudo ls -l /srv/shared # root:root
# sudo chgrp users /srv/shared
sudo chgrp -R users /srv/shared
sudo chmod -R 2775 /srv/shared
# The chmod 2775 command sets the permissions to rwxrwsr-x
# optional acl...
# sudo setfacl -m u:username:rwx /srv/shared_downloads
# sudo setfacl -m d:u:username:rwx /srv/shared_downloads
getent group users
create tmp folder for workdir
bash
temp_dir=$(mktemp -d) # /tmp/tmp.XXXXXXXXXX
cd $temp_dir ; pwd
# Set read permissions for all users
chmod a+r $temp_dir
# clear temp_dir
# maybe set non empty var
# https://stackoverflow.com/questions/687014/removing-created-temp-files-in-unexpected-bash-exit
trap '{ rm -f -- "$temp_dir"; }' EXIT
# isnt it rm -rf? interesting
bash
# checker
temp_dir=$(mktemp -d) # /tmp/tmp.XXXXXXXXXX
echo $temp_dir
cd $temp_dir
pwd
# Set read permissions for all users
sudo ls -l `dirname $temp_dir` | grep `basename $temp_dir` # 700
chmod a+r $temp_dir # 755. optional
sudo ls -l `dirname $temp_dir` | grep `basename $temp_dir` # 755
# get chmod number from folder
stat -c "%a %n" $temp_dir # -c is for format. %a is for permissions. %n is for file name
storage size
bash
du -sh / # usage
df -h / # f for filesystem
lsblk -d
lsblk -f
lsblk -a # empty drives as well
# lsblk --output NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT,...
lsblk --output NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT
lsblk --output NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE
lsblk --output NAME,MODEL,TRAN,TYPE,SIZE,FSTYPE
lsblk -a --output NAME,MODEL,TRAN,TYPE,SIZE,FSTYPE
lsblk -a --output NAME,MODEL,TRAN,TYPE,SIZE,FSTYPE | grep -i disk
hostname && lsblk -a --output NAME,MODEL,TRAN,TYPE,SIZE,FSTYPE | grep -i disk
# lsblk -d -o NAME,SIZE,MODEL,SERIAL
zsh
RAWLIST="jc-01 jc-02 jc-03 jc-04"
# split list by space into an array
LIST=(${(s/ /)RAWLIST})
# print all elements of the array
for raw_item in "${LIST[@]}"; do
item=$raw_item
echo "$item"
done
Find Command
zsh
# This will output a list of all completions (commands) available.
# -v is for verbose # only shows one
command -v code
# You can script this to loop through common commands. -a is for all
which -a code
whence -a code
bash
command -v code
command code # ignores aliases
zsh
# https://tldr.inbrowser.app/pages/common/compgen
# not sure if it's working properly
# aliases
compgen -a
# commands
compgen -c
# combined but not working
compgen -ac code
compgen -ac ls
compgen -ac ls
compgen -ac grep
compgen -c |grep code
Download ref
- https://jupyter.org/install
- https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html
Github search
owner:codeforwings OR owner:hychan48 DBUS_SESSION_BUS_ADDRESS
- potentially search shortcut in chrome?
- org:codeforwings OR owner:hychan48 DBUS_SESSION_BUS_ADDRESS
- $XDG_RUNTIME_DIR
APT
- Useful For Docker
- /var/lib/apt/lists/*
- can be restored / backed up
apt update / apt install
bash
set -eo pipefail # exit on error and pipefail
sudo apt update
sudo apt install -y curl wget git tree zsh
rm -rf /var/lib/apt/lists/* # clean up
bash
docker run -it --rm --name deb0 --hostname deb0 debian:bookworm-slim bash
tree /var/lib/apt/lists/
set -eo pipefail apt update && apt install -y curl wget git tree zsh && rm -rf /var/lib/apt/lists/*
set -eo pipefail ;
apt update && apt install -y curl wget git tree zsh rsync
tree -ADpugs /var/lib/apt/lists/
apt update
# -au for archive and update
# just keeping those files there
rsync -au /var/lib/apt/lists/ /tmp/list # backup
rm -rf /var/lib/apt/lists/*
rsync -a /tmp/list/ /var/lib/apt/lists # restore
tree -fADpugs /var/lib/apt/lists/
tree /tmp/list
bash
# -eo exit on error and pipefail. no
set -eo pipefail apt update && apt install -y curl wget git tree zsh && rm -rf /var/lib/apt/lists/*
# clean up apt
exit
tree /var/lib/apt/lists/
# clean up
rm -rf /var/lib/apt/lists/*
txt
root@deb0:/# tree -fADpugs /var/lib/apt/lists/
[drwxr-xr-x root root 4096 Mar 5 02:45] /var/lib/apt/lists
├── [drwxr-xr-x _apt root 4096 Mar 5 02:44] /var/lib/apt/lists/auxfiles
├── [-rw-r--r-- root root 47951 Mar 4 20:46] /var/lib/apt/lists/deb.debian.org_debian-security_dists_bookworm-security_InRelease
├── [-rw-r--r-- root root 278607 Mar 4 20:45] /var/lib/apt/lists/deb.debian.org_debian-security_dists_bookworm-security_main_binary-amd64_Packages.lz4
├── [-rw-r--r-- root root 55443 Mar 4 20:18] /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm-updates_InRelease
├── [-rw-r--r-- root root 22092 Dec 29 13:58] /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm-updates_main_binary-amd64_Packages.lz4
├── [-rw-r--r-- root root 151082 Feb 10 11:17] /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm_InRelease
├── [-rw-r--r-- root root 18833895 Feb 10 09:44] /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm_main_binary-amd64_Packages.lz4
├── [-rw-r----- root root 0 Mar 5 02:44] /var/lib/apt/lists/lock
└── [drwx------ _apt root 4096 Mar 5 02:46] /var/lib/apt/lists/partial
zsh plugin searcher
bash
# lazy way?
tmpdir=$(mktemp -d)
# git clone main only and depth 1
# git clone https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins
git clone --depth 1 --branch master https://github.com/ohmyzsh/ohmyzsh.git $tmpdir/ohmyzsh
tree -d $tmpdir/ohmyzsh/plugins -L 1
ls $tmpdir/ohmyzsh/plugins
ls $tmpdir/ohmyzsh/plugins |grep -i pyg # nothing
ls $tmpdir/ohmyzsh/plugins |grep -i py
ls $tmpdir/ohmyzsh/plugins |grep -i docker
ls $tmpdir/ohmyzsh/plugins |grep -i fzf
ls $tmpdir/ohmyzsh/plugins |grep -i gh
ls $tmpdir/ohmyzsh/plugins |grep -i jsontools # but not jq?
ls $tmpdir/ohmyzsh/plugins |grep -i zsh
ls $tmpdir/ohmyzsh/plugins |grep -i tmux
ls $tmpdir/ohmyzsh/plugins |grep -i vscode
ls $tmpdir/ohmyzsh/plugins |grep -i npm
# ls $tmpdir/ohmyzsh/plugins |grep -i yarn # no pnpm????
ls $tmpdir/ohmyzsh/plugins |grep -i node
ls $tmpdir/ohmyzsh/plugins |grep -i ubuntu
ls $tmpdir/ohmyzsh/plugins |grep -i rsync
ls $tmpdir/ohmyzsh/plugins |grep -i ssh
ls $tmpdir/ohmyzsh/plugins |grep -i ssh-agent
ls $tmpdir/ohmyzsh/plugins |grep -i sudo # spam esc twice
ls $tmpdir/ohmyzsh/plugins |grep -i systemd # aliases
ls $tmpdir/ohmyzsh/plugins |grep -i timer # very interesting
ls $tmpdir/ohmyzsh/plugins |grep -i copy
ls $tmpdir/ohmyzsh/plugins |grep -i color
trap "rm -rf $tmpdir" EXIT
# list traps
trap