How to Create and Edit files/directories using SSH?

There are a lot of ways on how to create and edit files on your Linux machine and one of the most popular ways is to use the touch command:

touch index.html

This command will create you a file called index.html  in the current folder.

To start editing the you can use the nano command, which is one of the most easiest editors

nano index.html

Once you are done editing you can save and exit with ctrl + and exit without saving ctrl + x

To rename the file we use the mv command and with the same command you can move a file to a different location. For example:

mv index.html newindex.html

and if you want it to move it or copy it to a different folder

mv index.html /path/to/directory/index.html ( this will move it)

cp index.html /path/to/directory/index.html

As for creating directories you can use the mkdir command

mkdir DirectoryName

Note that unlike windows, Linux files are key sensitive, so if you are going to edit a file you must type the exact name.

WebHostFace

Share
Published by
WebHostFace