Kishore Puvvada:
This is a Bash question. I wish there is an option to save typing long directory names, for oft-used directories, when navigating as well as when running various command-line utilities in K?
/etc/kubernetes/
/etc/kubernetes/pki/
/etc/kubernetes/manifests
/var/log/containers
The above are some folders that come to my mind, but there would obviously be some other ones that we frequently deal with on lab exercises, including exam. Thanks in advance!
Roi B:
You could set an alias or variable. But personally what I do is use the cd
(change directory) command. For example I cd into the manifests folder: cd "/etc/kubernetes/pki"
then I can run commands on the files in that directory directly: for example vi etcd.yaml
instead of vi "/etc/kubernetes/manifests/etcd.yaml"
. Once you’re done using that directly simply run cd
to get back to the home directory.
Roi B:
Also use tab autocompletion whenever possible!
Kishore Puvvada:
One hundred percent. Good idea to change directories. It would be lovely if I could use the PS1='\w\$ '
or similar to see the path on the prompt too. Note: the syntax will work? Thanks so much!!
Roi B:
You can always check your current own with pwd
(present working directory). I’m not familiar with that specific PS1 command but I think you will have access to editing your bashrc using vi ~/.bashrc
. This is also where you can set your aliases and export variables.
Roi B:
It’s up to you if you want to “waste” time doing this at the start of the exam. Some people say it’s not worth doing but for me a few aliases are worth it.
Roi B:
What I would want in my PS1 is something that displays the current kubectl context. I’m sure it’s possible somehow.
Kishore Puvvada:
Exactly. The prompt text can come in handy for important contextual data.