dev-resources.site
for different kinds of informations.
How to execute any command from anywhere to anywhere in your laptop !
Published at
12/18/2022
Categories
bash
linux
unix
terminal
Author
darker
Sometimes i got in situations where i want to execute a specific command or multiple commands inside a given directory without moving there as quickly as i can !
This may sound obvious to just jump there, do the stuff and come back but as a lazy guy, i like doing that as quickly as possible and hit enter once !
So in this tip, you will need zoxide, a nice tool that cache all your paths by their finals dirname, that mean wherever you are in your linux system ~/zig/zag/toum/yyyy
, you just have to type cd xxxx (which is here ~/boum/bam/xxx
), to go there !
So this is my tip:
- go to the target dir (
$1
as the given dir) - execute the command (
{$@:2}
as all strings after the dir) - get back from where i was (
cd -
)
Then add it inside your ~/.bash_aliases
and you're good to go !
You can copy the source code from here !
Articles
12 articles in total
How to execute any command from anywhere to anywhere in your laptop !
currently reading
How to list commits from the current branch.
read article
How to git resolve conflicts quickly from two commands lines.
read article
Bash and exclamation marks !!!!
read article
How to count lines of your code from your SHELL.
read article
How to copy/paste files/directories into non-existent destination path
read article
How to clone a sub directory of a git project (not a zip)
read article
Delete multiple locals branches in two commands
read article
git search for code whatever the branch, the time or the commit
read article
Asymetric RSA encryption/decryption of your clipboard
read article
Test your entire project(Php, Js, Python, Ruby) with just comments.
read article
Video+Audio conferencing in your terminal !
read article
Featured ones: