Creation and Destruction

  1. Let's all get back to the same point in the hierarchy before moving on.
  2. To make a new directory, use the mkdir command.
  3. Now we have a new folder for our manuscript, but how can we edit it at the command line?
  4. Change into the manuscript directory (not going to tell you how at this point) and run nano draft.txt to create a new text file. Write anything inside. The list of commands for nano are at the bottom of the window. The ^ symbol represents holding the Control key, so to exit nano, hold Control and press-X (which I'll write as ^X in the future.)
  5. How can we peek at the contents of the file?
  6. That draft was awful, and we aren't smart enough to use a version control system yet, so we're just going to delete it and start over again. To delete a file, use the rm command and pass the filename as an argument.
  7. Recreate draft.txt using nano and move up to the parent directory containing the manuscript folder. If we want to delete the entire folder, how would you do it?
  8. Here be dragons: Sure would be tedious to delete every file in a folder before deleting the folder, right? Well, there's a shortcut, but be very careful with it.
  9. Recreate the manuscript folder, along with a thesis folder. Change directories into manuscript and create the draft.txt file with some filler contents yet again. What if you decided that draft.txt would no longer go in your manuscript, but would go into your thesis instead? You can move files using the mv command.
  10. mv is also used to rename files and folders.
  11. Create a new text file, template.txt, and type and save some filler text. If this were a real template, you might want to make a copy to edit. You can do this with the cp command.
  12. In addition to the . and .. special directories that we talked about earlier, there's another alias, ~, that points to your home directory. This is the directory that is intially opened when you start a new terminal window.
<< Challenges 2 >> Challenges 3