codedecoder

breaking into the unknown…

editing file on remote server

Leave a comment

Recently, I want to change database.yml file manually on server. This file is not versioned in git due to security reason and we are creating it directly on the server. I tried with gedit but it do not worked . I think gedit will not work for remote server, though I have not confirmed it  🙂 Anyway, I have used below Editors.

Virtual Editor – vi

STEP 1:  login to your server
$ ssh your_server_root_path
your_server_root_path’s password:
$ cd to_your_project

STEP 2: open the file to edit
$ vi your_file_path #this will open your file in the terminal

STEP 3: edit the file
-> press i on you keyboard #it will activate the insert option so now you can change the file
-> use up down left right keys of keyboard to reach the line you want to edit
-> make the changes as you want

STEP 4: exiting the opened file
Now, you have done your changes and want to go back
-> press Esc on your keyboard # it will take you to bottom of the file
-> type below from your keyboard depending on you want to save or not
:q! #you will exit the file without saving the change you made
:wq! # it will write and quit i,e will save your changes

 

NANO EDITOR – nano

STEP 1:  login to your server
$ ssh your_server_root_path
your_server_root_path’s password:
$ cd to_your_project

STEP 2: open the file to edit
$ nano your_file_path #this will open your file in the terminal

STEP 3: edit the file
-> use up down keys to reach the point to make chages

STEP 4: exiting the opened file
Now, you have done your changes and want to go back
-> press ctr+x

-> It will ask you option Y or N. press Y if you want to save the changes or N if you do not want to save

 

Advertisements

Author: arunyadav4u

over 7 years experience in web development with Ruby on Rails.Involved in all stage of development lifecycle : requirement gathering, planing, coding, deployment & Knowledge transfer. I can adept to any situation, mixup very easily with people & can be a great friend.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s