I actually use this a lot to pipe, for example, GPG output directly into the clipboard and then paste it into some GUI application.
pstree -s $$ to show me the path from PID 1 to my current shell. This is really useful when you often start shells from within shells to manage context.
I also have aliases like
alias server='ssh server -t ''tmux a -t home \|\| tmux new-session -s home'''
This way I only have to type server and I get a persistent serssion that lasts until server restart, that I can detatch from easily with Ctrl+D and reattach by just calling server again.
Other than that, I have more than 1k lines in my .vimrc, so I will just leave a link to that instead of telling you about everything it does ;)
Hello! My name is Thomas and I'm a nerd. I like tech and gadgets and speculative fiction, and playing around with programming. It's not my day job, but I'm working on making it a side gig :)
Geek. Polyglot. Developer. Tolkienian. Westerosi. Trekkie. Loves Epic Fantasy and OSS. Evangelical Atheist. Open for Chats, Rants and Chants. Draws comics at Insta @abhnvkmr | https://abhnv.dev
Location
Bangalore, India
Education
Bachelor of Technology (Computer Science and Engineering)
I love to build and help others build software. Fullstack engineer at BombBomb.com on the integrations team. Open source maintainer in my free time at nteract.io.
Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
The git shorthands above are actually kind of a lie; I actually have a (probably unnecessarily) complicated couple of bash functions, supported by a python script that parses git status output and assigns a number to each changed file, to allow easier shorthands. gs shows git status with the numbers inline before each file, then ga and gd will accept those numbers as arguments, so I can do ga 3 to stage the 3rd modified file for commit or gd 3 to show the diff for that file. Maybe I'll write a post about those functions at some point so someone can show me how to improve them...
alias npr='pnpm run'alias vi-s='nvim -S Session.vim'alias pomd='tmux new-session -A -D -s pomodoro'alias pmd-start='pomd gone -e "$HOME/pmd-timer.sh"'alias dcc-up='docker-compose up -d'alias dcc-down='docker-compose down'
npr: Run Node scripts in package.json vi-s: As in Vim session to resume my work on a project using neovim. pomd: Starts a tmux session named pomodoro or creates one if it doesn't. I used it to track the time on my working session. pmd-start: Is what start the working session using this handy tool. dcc-up: Starts docker compose in detach mode. dcc-down: Stops docker compose.
Another handy tool for searching that I recommend is fzf.
ripgrep + fzf + Ctrl-R to search is the bee's knees.
alias pt="vendor/bin/phpunit"alias dt="php artisan dusk --env=dusk.local"alias test="pt && dt"
Which roughly translates to pt = Integration + Unit Tests, dt = tests that uses a real browser (IDK the correct term for this) and test = run the whole suite.
I'm using macOS, not sure if things work in other UNIX environments (esp. pbcopy/pbpaste are macOS-specific), and some commands require external tools like Node.js or PHP to be installed.
# The prime one, can't live without it:# Create a directory and cd to it immediately
mcd (){mkdir-p"$1"&&cd"$1"}# Copy the absolute path of the current working directory to the clipboard# without trailing newline (e.g. to paste into quotes of a string)
here (){pwd | tr-d'\n' | pbcopy }# Show all git tags of the current repository that represent# valid SemVer versions
semver (){ npx semver $(git tag)}# lazygit is a great tool for quick git commits, check it out:# https://github.com/jesseduffield/lazygitalias lg="lazygit"# Recursively search the current directory for PHP files# and lint them for syntax errors
php-lint (){ find .-iname"*.php"-exec php -l{}\; | grep-i"Errors.parsing"}# Get the gzipped size (in bytes) of text in the clipboard# (useful when writing JavaScript libraries)
gzipped (){ pbpaste | gzip-c | wc-c | sed-e's/^[[:space:]]*//'}
At the beginning of the year I broke my arm and was forced to type one handed for 3 weeks. It was ROUGH but because of it I now have a list of super simple 2 letter aliases which I still use :D
alias rs="git reset --soft HEAD^"
alias pp="git pull origin master"
alias mm="git checkout master"
alias ss="git status"
alias aa="git add ."
alias gc="git checkout ."
alias gcb="git checkout -b"
alias gp="git push origin HEAD"
alias gf="git fetch origin"
alias gr="git rebase origin/master"
Hello! My name is Thomas and I'm a nerd. I like tech and gadgets and speculative fiction, and playing around with programming. It's not my day job, but I'm working on making it a side gig :)
I don't use many aliases, but I have replaced ls with exa. It's got saner defaults and great options for neat behaviour like grouping directories first, changing sorting mode, and respecting .gitignore and showing git status in long-form mode.
I'm not the biggest fan of aliases because if you move to a different workspace you're going to have to use the original command and you might forget it
FYI, you can use Ctrl+L in most shells to handle screen clearing, and would allow you to free up 'c' for another action. Also doesn't require an enter key press!
For a more compact git history:
To easily pipe into and out of my clipboard on the terminal:
I actually use this a lot to pipe, for example, GPG output directly into the clipboard and then paste it into some GUI application.
pstree -s $$to show me the path from PID 1 to my current shell. This is really useful when you often start shells from within shells to manage context.I also have aliases like
This way I only have to type
serverand I get a persistent serssion that lasts until server restart, that I can detatch from easily with Ctrl+D and reattach by just callingserveragain.Other than that, I have more than 1k lines in my .vimrc, so I will just leave a link to that instead of telling you about everything it does ;)
I use
tmux new-session -A -s session-name. It will create the session if it doesn't exist and reattach if it does exist.Instead of
history | grep 'something', you can just use Ctrl+R to search your history. I use zsh + prezto which adds sub-string search.+1. Also, when you've narrowed the search, you can continue hitting Ctrl+R to navigate backward in time, through all the commands that match.
I'm sold if you can tell me a way to get back to exactly where I was when I started after I find what I need.
IIRC, you can press tab and that will dump your cursor at the end of the line, once you've found the command you want.
Some of my
.bashrcaliases:The git shorthands above are actually kind of a lie; I actually have a (probably unnecessarily) complicated couple of bash functions, supported by a python script that parses
git statusoutput and assigns a number to each changed file, to allow easier shorthands.gsshowsgit statuswith the numbers inline before each file, thengaandgdwill accept those numbers as arguments, so I can doga 3to stage the 3rd modified file for commit orgd 3to show the diff for that file. Maybe I'll write a post about those functions at some point so someone can show me how to improve them...npr: Run Node scripts in package.jsonvi-s: As inVim sessionto resume my work on a project using neovim.pomd: Starts a tmux session named pomodoro or creates one if it doesn't. I used it to track the time on my working session.pmd-start: Is what start the working session using this handy tool.dcc-up: Starts docker compose in detach mode.dcc-down: Stops docker compose.Another handy tool for searching that I recommend is fzf.
ripgrep + fzf + Ctrl-R to search is the bee's knees.
Awesome find with
gone. I'm gonna have to add that to my arsenal (no more browser tab pomodoro!)Which roughly translates to
pt= Integration + Unit Tests,dt= tests that uses a real browser (IDK the correct term for this) andtest= run the whole suite.I use
i3wmandfish-shell, so I aliased:So that VSCode opens up immediately to edit those files whenever I need.
I also really like the Git-bare approach to syncing Config-files, so I have
Useful git history (I absolutely ❤️ this one):
Clean up stray docker containers/images (it's a personal script not an alias):
I'm using macOS, not sure if things work in other UNIX environments (esp.
pbcopy/pbpasteare macOS-specific), and some commands require external tools like Node.js or PHP to be installed.At the beginning of the year I broke my arm and was forced to type one handed for 3 weeks. It was ROUGH but because of it I now have a list of super simple 2 letter aliases which I still use :D
I don't use many aliases, but I have replaced ls with exa. It's got saner defaults and great options for neat behaviour like grouping directories first, changing sorting mode, and respecting .gitignore and showing git status in long-form mode.
I'm not the biggest fan of aliases because if you move to a different workspace you're going to have to use the original command and you might forget it
I write a fair amount of script-y tooling, so this one saves me a lot of keystrokes:
alias dc="docker-compose"alias c=clear
alias b=cd..
alias zshrc='vim. zshrc && source ~/. zshrc'
alias ypx='yarn run'
FYI, you can use Ctrl+L in most shells to handle screen clearing, and would allow you to free up 'c' for another action. Also doesn't require an enter key press!
I use ‘lan’
ifconfig | grep ‘inet ‘
To get my ip address
ip a | grep ‘inet ‘
On latest debian releases
function rm --description 'alias rm rm -rf'command rm -rf $argv;
end
Wouldn't recommend it to anyone though.