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 istifadəçi bunu faydalı hesab edir
Bu cavab sizə kömək etdi?

Uyğun məqalələr

Linux tar Command

The Linux tar command is used to compress and extract files to and from an archive. In this...

How to Install WordPress via SSH

Since WordPress is the most widely used CMS it’s installation process has been made as simple and...

SSH Execute Command on a Remote server

Via SSH you can connect to a remote server’s shell. This will allow you to execute commands on...

How to connect to your shared hosting account via SFTP with FileZilla

SFTP is a convenient way to use SSH, while also using the interface of a simple FTP. In order to...

SSH netstat command

If you wish to debug or track statistics of your network in a Linux environment you can use SSH...