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.

  • 0 brukere syntes dette svaret var til hjelp
Var dette svaret til hjelp?

Relaterte artikler

SSH ip command

If you wish to obtain information about your server’s IP on a Linux machine using SSH you can use...

SSH rm command

If you wish to remove a file or folder from your Linux system you can use SSH rm command. In this...

SSH echo command

One of the most useful commands in a Linux environment is echo. With it, you can provide output...

SSH history command

If you wish to find what commands you have previously executed in a Linux environment you can use...

SSH cd command

SSH cd command is mainly used to navigate in your Linux environment. In this article, we’ll show...

Powered by WHMCompleteSolution