gt
for "Goto" is a custom cd for bash
- Download
gt
, - Move
gt
into your script directory, - Add this line in your
.bashrc
:
alias cd='f(){ cd "$(echo $(gt $1))"; unset -f f; }; f'
Thanks to :
https://stackoverflow.com/questions/7131670/make-a-bash-alias-that-takes-a-parameter
- Restart your console,
- Tape
cd [your command]
.
- Delete or comment this line in your
.bashrc
:
alias cd='f(){ cd "$(echo $(gt $1))"; unset -f f; }; f'
- Restart your console.
Just for help me,
And Move faster in the file system.
- You are in /home/$USER/
You want to move into documents
Without gt
:
$ cd Documents/
$ pwd
/home/$USER/Documents
With gt
:
$ cd doc
$ pwd
/home/$USER/Documents
- You are in /home/$USER/
You want to go in /home/$USER/Documents/MyWorks/
Without gt
:
$ cd Documents/MyWorks/
$ pwd
/home/$USER/Documents/MyWorks
With gt
:
$ cd works
$ pwd
/home/$USER/Documents/MyWorks
To validate a version, we need to pass all these tests:
Command | Result | Version 1 |
---|---|---|
~ $ cd . |
~ $ |
✔️ |
~ $ cd .. |
/home/ $ |
✔️ |
~ $ cd ./ |
~ $ |
✔️ |
~ $ cd [DDE] |
bash: cd: [DDE]: No such file or directory |
✔️ |
~ $ cd doc |
~/Documents $ |
✔️ |
NOTE: DDE
: Directory Doesn't Exist
Command | Result | Version 1 |
---|---|---|
/ $ cd . |
/ $ |
✔️ |
/ $ cd ./ |
~ $ |
✔️ |
/ $ cd [DDE] |
bash: cd: [DDE]: No such file or directory |
✔️ |
/ $ cd etc |
/etc/ $ |
✔️ |
/ $ cd doc |
~/Documents $ |
TEST? |
NOTE: DDE
: Directory Doesn't Exist