Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Seriously, though, "!!" is just a special case of Bash's history expansion

man bash, and search for "^HISTORY EXPANSION" for all the details.

I often find myself running commands like

cp !:2 !:1 # reverses the order of the last two args

cd /somedir && !! # run the last command in a better directory




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: