我已经从我的系统根创建了一个指向我的WordPress主题根的符号链接 - 所以/
我有
mytheme -> /Applications/MAMP/htdocs-wordpress/wp-content/themes/mytheme
我一直用这个来快速到达终端中的主题根。但我经常也想从那里导航到WordPress层次结构中的更高目录,如wp-content
。当我运行cd ..
时,终端会将我带回/
。是否有任何简单的方法来跳过文件层次结构而不是符号链接的“父”?或者以任何方式获得我的主题根的别名,这将允许这个?
答案 0 :(得分:1)
I would go with an alias, it makes things easier. Put this into your $HOME/.bashrc
or $HOME/.bash_profile
file:
alias mytheme="cd /Applications/MAMP/htdocs-wordpress/wp-content/themes/mytheme"
After that, either source it in your current terminal source $HOME/.bashrc
or open a new Terminal window. This is available for any Terminal window you open and you can navigate easily from there. Another advantage is, that you don't have this symlink in your /
directory.
Jumping into the directory of your theme is done by calling the name of the alias:
user@machine> mytheme
And if you want to navigate one directory back, just do it the usual way:
user@machine> cd ..
user@machine> pwd
/Applications/MAMP/htdocs-wordpress/wp-content/themes