brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Alt-u and Alt-l fix the case of a word on the shell line

Shell
~/tips/tip-shell-alt-u-alt-l-case

Alt-u UPPERCASE the rest of the word

Change a word to upper, lower or title case while you type a command.

Typed export path=... when it should have been PATH? You do not have to delete the word. Readline changes case from the cursor to the end of the word.

Put the cursor at the start of the word and press:

Alt-u   UPPERCASE the rest of the word
Alt-l   lowercase the rest of the word
Alt-c   Capitalize the word

With the cursor on the p of export path=/usr/local/bin, Alt-u turns it into PATH and moves the cursor past it. The = ends the word, so the rest of the line stays as it was.

I’d use Alt-u for environment variable names and Alt-c for the odd name in a commit message typed on the command line. After a change the cursor sits at the end of the word, so pressing it again works on the next word, handy for two or three words in a row.

It works from the cursor onward, not on the whole word. With the cursor in the middle, only the second half changes, so jump to the word start with Alt-b first. On a Mac, set Option to act as Meta in your terminal or press Esc and then the letter.

Further reading: Bash manual: Commands For Changing Text

More Shell tips zmv -n '(*).log' '$1.txt' zoxide query -ls project f=$(mktemp --suffix=.json) shopt globskipdots echo $EPOCHSECONDS All Shell tips (78) All topics

Link