I have a VPS server and I need to edit a file from my server. I am using ssh bash for accessing my server files.
I can access the files and list them by the command ls
but when I need to edit it I just cannot find a command to do it. I tried with
[root@vps1 webmin]# nano miniserv.conf -bash: nano: command not found [root@vps1 webmin]# /usr/bin/nano miniserv.conf -bash: /usr/bin/nano: No such file or directory [root@vps1 webmin]# open -e file.txt -bash: open: command not found [root@vps1 webmin]# open -t file.txt -bash: open: command not found [root@vps1 webmin]# $ open -a TextEdit hi.txt -bash: $: command not found [root@vps1 webmin]# open -a TextEdit hi.txt -bash: open: command not found [root@vps1 webmin]#
My default editor is brackets by adobe and i want to use the same. I just need to know the command in my bash terminal to edit the file and save it back.
Advertisement
Answer
You can use “vim” or “vi”.
you will be able to open and edit the files via shell. You can do that with emacs too, but less likely it is already installed.
vi/vim require some key-strokes in order to edit and save 🙂
i = insert, which means you have to press ‘i’ before you start writing.
esc = exit mode (such as after you press ‘i’).
:w = save. only after you pressed ‘esc’.
:q = quit.
:q! = force quit.
*For further information google it. this is just to help you start