Edit

Using nano (simpler):

# Open file
nano file.txt

# Save file
CONTROL + O
ENTER

# Exit
CONTROL + X

Using vi (powerful):

# Open file
vi file.txt

# Search for "string" and go to line
/string

# Enter insert mode
i

# Exit insert mode
ESC

# Get the : prompt
SHIFT + Q

# From : prompt, save and quit
x!