How to create a new file and save it in Putty

Mihai B.

Well-known member
Registered
Joined
Apr 19, 2016
Messages
232
Points
18
Can you guide me how to create a new file and save it in Putty? I don't want to switch to FTP client program and making a file there, using Putty SSH may be faster.
 

AlbaHost

Well-known member
Moderator
Hosting Provider
Joined
Jan 18, 2017
Messages
774
Points
43
Can you guide me how to create a new file and save it in Putty? I don't want to switch to FTP client program and making a file there, using Putty SSH may be faster.
nano filename
CTRL O
CTRL X

Done
 

HostingWaves

Member
Registered
Joined
Jan 16, 2017
Messages
53
Points
0
You can also use 'vi filename' command. If you want to write programming code, use vim command. To start write, press 'i' and to save, first press 'Esc' and type ':wq'+ press enter. wq means write and quit.
 

24x7CSM

Well-known member
Registered
Joined
Sep 27, 2016
Messages
263
Points
28
simple step , use the command touch file name and file will be created
in order to edit the file just use either vi or nano command
you can install nano command by yum install nano
 

Mihai B.

Well-known member
Registered
Joined
Apr 19, 2016
Messages
232
Points
18
You can also use 'vi filename' command. If you want to write programming code, use vim command. To start write, press 'i' and to save, first press 'Esc' and type ':wq'+ press enter. wq means write and quit.
I used vi editor once but I could not remember its commands, especially shortcut keys.

nano filename
CTRL O
CTRL X

Done
Seem this way is easy and worked for me.

Thanks!
 

wpspeedster

Well-known member
Registered
Joined
May 6, 2016
Messages
120
Points
18
Yes I used both nano and vi editor but I find nano more convenient.

If you want to use vi then here's commands

Code:
vi filename
Code:
i to insert
a to append
x to delete
dd to delete a line
: to begin a command sequence
:w to save
:q to quit
:q! to quit without saving
:wq to save and quit
Anyway, vi didn't show its command at the bottom of screen like nano editor, that will help you easily use commands even you don't need to remember them.

Hope that helped.
 

24x7serverman

Well-known member
Hosting Provider
Registered
Joined
Jul 25, 2017
Messages
651
Points
28
I would recommend VI editor. Use the vi command to create the file. Below are the detailed command -

vi file name
Now as you wan to enter in the file for writing the content then press i
Enter the content
Now for saving the file press Escape key :wq

It will save the file.

Make sure to update the ownership and permission of the file for proper functioning. chown command is used to update the ownership and chmod is used for updating the permission.
 

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
djsmiley2k
Sometimes I forgot to use chown command after created a new file or uploaded a new zip file to server and unzip it, this if I don't use chown, it will not allow me to write/read to the file. Is there a way to auto chown for a file without running chown command from the terminal?
 
Newer Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top