I want to go to a directory with using filter
For example there is a file named this-is-awsome
ls | grep this-is-awsome | xargs cd
How can I go to a directory with filter?
I want to go to a directory with using filter
For example there is a file named this-is-awsome
ls | grep this-is-awsome | xargs cd
How can I go to a directory with filter?
Salton's comment explains the problem. Here are some solutions:
cd "$(ls | grep this)"
This is probably not so good, with all the usual caveats about parsing the output of ls applying to it.
A slightly better version (assumes GNU find):
cd "$(find -maxdepth 1 -type d -name '*this*')"
Yet another (maybe even better) solution if you're using Bash:
shopt -s nullglob
cd *this*/
This works for me:
>>pwd | xclip
>>cd `xclip -o`
When you have one file with "this", just use
cd *this*