
If you delete an important file with rm, it is gone forever. You've learned your first command that you need to be careful with. Notice that you don't get a warning that you're about to delete it, and you don't even get a confirmation that it is deleted. Now, you can delete the file with the rm (remove) command:

Then save it as you have already learned, and confirm that it exists by listing ( ls) the contents of the directory.

Create a new file called 'testtrash.txt': your home, or 'downloads' or 'public_html'), you can create a new files. #Delete Files and Directories, with rm and rmdirĪs long as you're in one of your own directories (e.g. Verify this with ls in your home directory and in 'downloads'. It did not touch the original file in your home directory. This is because cp made a copy of 'filetwo.txt' and put the copy in 'downloads'. Now if you ls the contents of your home directory, 'filetwo.txt' will still be there. Next, copy 'filetwo.txt' into 'downloads' as follows: If you 'ls' the contents of 'downloads' (a shortcut command is ls downloads), you will see it there. Now if you ls the contents of your home directory, you will no longer see 'fileone.txt', because it has been moved into 'downloads'. Lets move those into your 'downloads' directory using two different commands, to demonstrate how they workd differently.

#Moving Files Between Directories, with mv or cpįirst, cd back to your home directory, and use nano to create two new files called 'fileone.txt' and 'filetwo.txt'. Use ls to see that it was created, and even move into the new directory with cd downloads. Now create a new directory called 'downloads' in your home directory: #Create a New Directory, with mkdirįirst, hop back to your home directory with the cd command (remember that cd from anywhere in the file system will take you back to your home directory). Later in this tutorial, we will come back to this file and make it viewable in your web space. Type ls to view the contents of your directory an confirm that you did indeed make the file. Then Ctrl+x to save, you will have created a new file. Now, add some quick contents by opening the file for editing with nano, and adding whatever you want. 'testing.html' did not exist before you opened it with nano, so it was created for you. Let's create a new file in your public_html directory, called 'testing.html'. Now you can pull up a browser to see the change at your tilde.team URL:

Now, save and quit by hitting the key combination Ctrl+x, and then typing 'y' in response to the question about wanting to save the modified buffer. Leave the and tags as they are, but change the sentence in between them. Just log in with your secure internet shell to change this file!
