When I found that the instances of me copying the path of the current working directory has become huge, I wanted to make it a seamless task. There, I found the power of zsh.
Just few step and you are good to go.
- Open the
.zshrc
file in your terminal with the below command:
open ~/.zshrc
- Add this line to the end of the file:
alias cpwd="pwd|pbcopy"
- Save and Close the file.
- You can close your terminal and open a new terminal to see the new changes.
- Now, if you just enter
cpwd
you can copy the current path of the directory you are in to your clipboard. - Go ahead and paste in anywhere you want.
Glad that helped! See ya in another hack!
Top comments (0)