Bash: History Expansion

Event Designators (found on man bash) These commands help to save time on Linux based tests: ! # Start a history sub. * # All the words but the zeroth. After the 1st command all the words $ # The last word. So if you add it all together: !$ # The last word of the previous command. !* # All the words of the previous command except the first. !! # The previous command. Examples kubectl apply -f my-pod.yaml vim !$ # vim my-pod.yaml touch file1.txt file2.txt rm !* # rm file1.txt file2.txt kubectl get pods !! -n kube-system # kbuectl get pods -n kube-system 202506210844 ...

21 June 2025 · Pedro Tae Young Chang