| lime| less| grep <keyword>| sort| sed <pattern>
ripgrep (often shortened to rg) and fd are modern alternatives to the traditional grep and find commands
tree -d -L 2 list only directories with depth level 2
for d (parent-dir/*/*(N/)) (cd -- $d && tree) | lesshttps://unix.stackexchange.com/questions/737234/using-tree-for-sub-subdirectories
ctrl + r(old command search)yes | command(gives auto yes that requires user interaction)aliasfind /home/user -type f sensetive_data.txtfind . -type f -size 100M (size > 100)find . -type d -name ".git"df -hbase64 -d <<< bWluaW8=echo -n "" | base64 -dhead -2 trains-big.csvtar cCf / - usr | cpipe -vt > /dev/null- modify to measure current activity in STDIN / STDOUTread varfc/ctrl + x + e- edit long commands in preffered editorjq '[.[] | select(.config_type | startswith("platform"))]' input.jsonjq '[.[] | select(.config_type | startswith("platform"))]' input.json7z t file.zipcheck zip for corruptionab -k -c 350 -n 5000 http://<rpi ip>:3000/command sends 5k requests in total with a concurrency of 350 requests. One could tweak these numbers as per requirements.rg '\b(in)\w+' Literature/ -i -o | sort -u | less- bruteforce search using ripgrep ref: mock http request- write to a file without editor
| sort -k4,4n- sort based on the numbers present in position 4 of any line. addrnext to4nto reverse- gnu core util’s date.
date -d '2pm ist'date -d 'next friday 4:30am utc'date -d '3 weeks ago 2pm pt'date -d 'now + 1 month'date -d '2025-12-31 18:45 + 7 days
pastel color pink- get color, mix colors, complement and many more: pastel- Find line of code in a github project
git ls-files -z | xargs -0 wc -l→ xargs -0 means, read from stdin, wc -l keeps running as long as it receives the input from source (here it’s stdin), and the git cmd prints all lines from all the files present in the codebase find zips/ -type f -exec mv {} . \;copy nested files to a single directoryzip -r "GameInfoBot_$(date +%Y-%m-%d).zip" . -x "*.git*" -x "*venv/*" -x "*__pycache__/*"- zip files, excluding folders
cat << EOF > file.ext
put contents to a file without a editor....
EOFPrevent sleep temporarily:
Ctrl + C terminate.
# for mac
caffinate -d
# for linux
systemd-inhibit --what=idle:sleep:shutdown sleep infinityjq: Quick Reference
jq 'map({id, key1})'
| Operation | Syntax | Example |
|---|---|---|
| Access field | .field | .name |
| Array index | .[0] | .[0].name |
| Array slice | .[1:3] | .[1:3] |
| Iterate array | .[] | .[].name |
| Filter | select(condition) | select(.age > 25) |
| Map | map(expression) | map(.name) |
| Map (nested) | map(expression) | map({id, key1}) |
| Map (rename) | map(expression) | map({id: .id, key1: .key1}) |
| Sort | sort_by(.field) | sort_by(.age) |
| Group | group_by(.field) | group_by(.city) |
| Length | length | .hobbies | length |
| Unique | unique | .tags | unique |
Nvidia card status
- D0 is full power (https://docs.kernel.org/power/pci.html#native-pci-power-management)
cat /sys/class/drm/card*/device/power_state- see if the card is in D0: cat
cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_statussuspended
Shortcuts
<C w>delete a word backwards<C k>delete entire thing following the cursor<C e>go to end<C a>go to begining
tmux
with tmux.conf
Ctrl + b
-
d - detach
-
v, h - split
-
z full screen
-
https://stackoverflow.com/questions/5609192/how-do-i-set-tmux-to-open-specified-windows-at-startup
-
quick 4 pane launch
tmux new-session \; split-window -v -p 20 \; split-window -h \; select-layout tiled \; resize-pane -t 1 -y 40 \; split-window -h \; -
tmux-sessioner + fuzzy find (avoid cd hell): https://www.reddit.com/r/tmux/comments/1ch9tqp/primeagen_tmux_session_management/
tmux.conf
set -g mouse on
set -g renumber-windows on
set -g history-limit 10000
set -sg escape-time 0 # No command delay
set -g status-keys vi
setw -g mode-keys vi
set -g default-terminal "$TERM"
set-option -g status-position top
set-option -g status-interval 1
# colors
set -g status-style 'bg=#333333 fg=#5eacd3'
#-------------------------------------------------------------------------------
# Keys binding
#-------------------------------------------------------------------------------
unbind C-b
set-option -g prefix C-b
bind-key C-b send-prefix
set -g base-index 1
bind V split-window -h -c "#{pane_current_path}"
bind H split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
bind c new-window -c "#{pane_current_path}"
# Switch panes using like vim keys
bind -r ^ last-window
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# Copy
unbind [
bind Escape copy-mode
bind P paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'wl-copy'
bind-key -T copy-mode-vi Escape send-keys -X copy-pipe-and-cancel 'wl-copy'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'wl-copy'
# Double LMB Select & Copy (Word), then press Escape or Enter to exit copy mode
bind-key -n DoubleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-word \; \
send-keys -X copy-pipe-no-clear 'wl-copy' \; \
# Reload config file while in tmux
bind r source-file ~/.config/tmux/tmux.conf \; display "Reload configurations..."
# Do not display the original window's name when renaming it
bind , command-prompt -p "(rename-window '#W') " "rename-window ''"
# tmux-sessionizer
bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
bind-key -r S run-shell "~/.local/bin/tmux-sessionizer ~/redacted/s-core/services"
bind-key -r P run-shell "~/.local/bin/tmux-sessionizer ~/redacted/p-core"
bind-key -r N run-shell "~/.local/bin/tmux-sessionizer ~/Documents/notes"Commands
tmux a -t 0 attach to the tmux window
tmux ls
Node Version Manager
Need to activate nvm by running init script
nvm - Node version Manager
nvm install lts/jod
nvm use lts/jod
Helm Inspect
Gives diff between helm values vs currently applied kubernetes remote values
pip install helm-inspect
# Callibrate & find the diffs
helm-inspect -r appbackend -n platform -c
helm-inspect -r appbackend -n platformbash.rc
alias timef='/usr/bin/time -f "Memory used (kB): %M\nUser time (seconds): %U"'
alias less='nvim \+":setlocal buftype=nofile" -'
export VISUAL=nvimcron
Commands over SSH
eval "$(ssh-agent -s)"
sshpass -P passphrase -p '#####' ssh-add ~/.ssh/id_ed25519
ssh -T u0_a342@192.168.29.133 -p 8022 << EOF
cd vpc_migrate
pg_dumpall > watgbridge-$(date +"%d-%m-%Y").sql
EOF
scp -P 8022 u0_a342@192.168.29.133:~/vpc_migrate/watgbridge-$(date +"%d-%m-%Y").sql ~/Documents/watg_backup
scp -P 8022 u0_a342@192.168.29.133:~/watgbridge/wawebstore.db ~/Documents/watg_backup
scp -P 8022 u0_a342@192.168.29.133:~/watgbridge/config.yaml ~/Documents/watg_backupfor some reason, this didn’t work… neither did systemd.service, perhaps need to consume STDOUT somewhere
crontab -e
@reboot /home/guts/ssh_scripts/watgbridge_reboot_backup_cron.shkitty
Has TrueColors by default, gpu acceleated, less memory intensive, it’s great. One small caviat - TODO: have to find a solution to search keywords in terminal.
kittens have useful tools for to copy items to clipboard even through ssh. and view images through terminal wahhh.
kitty +kittens icat ./file.png
kitty +kittens diff ./fileone ./filetwoctrl + shift + h to search on screen buffer
alternative to live search
Who are these people!!
https://stackoverflow.com/questions/43573081/fast-i-o-in-c-stdin-out umm, pipes eh
Postgres
When to use which index docs. GIN indexes
# List tables from another schema other than public
/dt schema.*
/dt+
/l
/c database
# List all schemas
SELECT schema_name
FROM information_schema.schemata;
TRUNCATE TABLE "load-test.relational_database_large_test_16gb";
# ERROR: relation "load-test.relational_database_large_test_16gb" does not exist
SHOW search_path;
SET search_path TO "load-test";
# search_path
# -----------------
# "$user", public
# (1 row)
# ref: https://stackoverflow.com/questions/34098326/how-to-select-a-schema-in-postgres-when-using-psql
# Index
# ref: https://gitlab.com/gitlab-org/gitlab/-/issues/336930 (GIN pending-list overhead)
\di+ index_merge_requests_on_description_trigram
exec REINDEX INDEX index_merge_requests_on_description_trigram
Kill Process
killall -9 node
ps aux | grep nodetmux-sessionizer
Place the file in ~/.local/bin/tmux-sessionizer & chmod +x.
#!/usr/bin/env bash
if [[ $#--eq-1-| -eq 1 ]]; then
selected=$1
else
dirs=$(find -L ~/redacted ~/redacted/p-core ~/redacted/s-core/services ~/Documents/preemptive-impressions -mindepth 1 -maxdepth 1 -type d)
selected=$(printf "%s\n%s\n%s\n%s" "$dirs" "$HOME/Documents/notes" "$HOME/logs" "$HOME/test" | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
# OK - tmux is not running
if [[ -z $tmux_running ]]; then
tmux new-session -s $selected_name -c "$selected"
exit 0
fi
# OK - tmux is running but client is not attached, session with selected_name does not exist
if [[ -z $TMUX ]] && ! tmux has-session -t=$selected_name 2> /dev/null; then
tmux new-session -s $selected_name -c "$selected"
tmux a -t $selected_name
exit 0
fi
# OK - tmux is running but client is not attached, session with selected_name exists
if [[ -z $TMUX ]] && tmux has-session -t=$selected_name 2> /dev/null; then
tmux a -t $selected_name
exit 0
fi
# OK - tmux is running and client is attached, session with selected_name does not exist
if [[ ! -z $TMUX ]] && ! tmux has-session -t=$selected_name 2> /dev/null; then
tmux new-session -ds $selected_name -c "$selected"
tmux switch-client -t $selected_name
exit 0
fi
# OK - tmux is running and client is attached, session with selected_name exists
if [[ ! -z $TMUX ]] && tmux has-session -t=$selected_name 2> /dev/null; then
tmux switch-client -t $selected_name
exit 0
fiAccidental
$ nvim .
[1]+ Stopped nvim .when you do this, you push your program to background and stops it.
jobs - list the stopped programs
fg - brings it back to the foreground.
fg %1 - if you have multiple jobs running
PS1 - Default in Arch
PS1='[\u@\h \W]\$ 'Mount a MTP device (android)
sudo apt install go-mtpfs mtp-tools
mtp detect
# note down the vendor / device ids, add to udev rules
sudo nvim /etc/udev/rules.d/69-mtp.rules
go-mtpfs ~/android
rsync -ah --info=progress2 src dest69-mtp.rules:
SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", ATTR{idProduct}=="xxxx", MODE="0666", GROUP="plugdev", SYMLINK+="libmtp"
Quake Mode in Windows terminal
- borderless window mode: win key + backtic
RSYNC
In your termux (android), install rsyc apt update && apt install rsync, and run these:
termux-setup-storage
rsync -azahP --info=progress2 -e ssh storage/shared/Reddit/ shichika@ustable:/srv/samba/share/temp/Reddit/
rsync -azahP --info=progress2 -e ssh shichika@ustable:/srv/samba/share/temp/Reddit/ storage/shared/Reddit/scrcpy
mod = left(Alt)
mod + o turn off screen
mod + shift + o turn on screen
#50 ms
--video-buffer=50
-K
Physical Keyboard (linux)
--otg --hid-keyboard
otg keyboard (windows)
mod = Alt (left)
Alt + LEFT / RIGHT = change orientation
scrcpy --display-buffer=50 --window-borderless --window-x=0 --window-y=0 --window-height=1080
# adb over tcp
scrcpy --tcpip --window-borderless --window-x=0 --window-y=0 --window-height=1080 -e --hid-keyboard=uhid
scrcpy --tcpip --window-borderless --window-x=0 --window-y=0 --window-height=1080 -e -K --video-codec=h265
use device microphone on laptop - with VB-Audio
.\scrcpy.exe --no-video --audio-source=mic-voice-communication --audio-codec=opusWhy VOICE_COMMUNICATION is What You Want:
When a standard app asks for the microphone, it often gets the raw (UNPROCESSED) or default (MIC) audio feed.
When an app specifies the AudioSource.VOICE_COMMUNICATION stream, it’s telling the Android system, “I am a voice call app (like VoIP or a phone call).”
In response, the phone’s operating system automatically applies its built-in, hardware-accelerated (OEM) processing—like acoustic echo cancellation (AEC) and noise suppression (NS) before handing the clean audio to the app.
This is the method scrcpy uses, so you get the benefit of all your phone manufacturer’s audio engineering, not a generic software filter.
interactive screen sharing
.\scrcpy.exe --video-buffer=50 --window-borderless --window-x=0 --window-y=0 --window-height=1080;Slideshow with blur using mpv
mpv . \
--image-display-duration=1200 \
--fullscreen \
--shuffle \
--loop-playlist \
--no-osc \
--no-osd-bar \
--lavfi-complex="
[vid1]split=2[raw][bg];
[raw]scale=-1:1080:force_original_aspect_ratio=decrease[fg];
[bg]scale=1920:1080:force_original_aspect_ratio=increase,
crop=1920:1080,
boxblur=30:1[blur];
[blur][fg]overlay=(W-w)/2:(H-h)/2[vo]
"
OGG to MP3 conversion
ffmpeg -i input.ogg -c:a libmp3lame -q:a 2 output.mp3
# -c -> codec: LAME mp3
# :a -> apply to "audio stream"
# -q -> quality level 0 to 9 (highest to lowest)
wake up agent right after session limit reset:
systemd-run --user --on-calendar="2026-07-02 19:00:00" --unit=tmux-continue /home/shichika/test/tmux_continue.sh
systemctl --user list-timers --all | grep tmux
# tmux_continue.sh contents:
#!/bin/bash
SESSION="fandom"
tmux send-keys -t "$SESSION" "continue" Enter
Find mounted folders through dolphin (KDE) filemanager
find "$(findmnt -rn -t fuse.kio-fuse -o TARGET)" -maxdepth 3 -type d