Lesson 3 from DrupalEasy: Know Where You Are

Hello again, friends! I hope that your Drupal learning journey is going well so far. I’m now almost midway through DrupalEasy's Drupal Career Online program and everything’s been going great -- except for one recent setback. Although this setback was extremely annoying, I obtained a few takeaways in the process. I’ll share what I've learned with you in the hope that you won't make the same mistake I did.

Mistakes happen

Having reached nearly the midway point of the course, I'd been feeling great about what I’d been learning, knocking out my homework, and even looking ahead to prepare for the upcoming week’s lesson.

So on a recent Sunday night, with class on Monday, I decided to go ahead and set up my website, anticipating possibly having to share my screen during the lesson. I began the somewhat familiar process of setting up a Drupal site from my command line, and navigating to my sites directory where all of my previous class sites are saved. I used the mkdir command to create a new directory for the week and called it dcowk6. Everything was going smoothly—until it wasn't.

What I should have done from there was navigate into the dcowk6 folder using cd dcowk6 and then run the ddev config command to begin the set-up process from there. What I actually did was begin the configuration process from my sites directory (the directory containing all my other class project websites). I continued the process, running the ddev start command and following with ddev composer create drupal/recommended-project. Little did I know I was making a big mistake.

At this point, the warning, "All existing content of the project root will be deleted" popped up, followed by the option to select "yes" or "no". This is where I should have slowed down and taken note of what directory I was in on my computer. It's so very important to know where you are before you begin this process (or any process for that matter) in the command terminal on your computer. (Using pwd would have been a good idea at this point.) By running that last command from my sites directory instead of the appropriate dcowk6 directory, I deleted ALL of my previous class projects, along with all the homework I was so proud to be keeping up with and completing. I was devastated.

Luckily, the homework is mostly for practice and the previous sites aren't necessary to move forward in the class. But it hurt nonetheless. I've gone back and rebuilt some of the sites just to test out my skills. The silver lining in this whole experience is that I've been pleasantly surprised by how far I've come. The moral of the story? Always know where you are in your computer when using the command line.

More information

The command line can be a scary place for someone not familiar with interacting with a computer through text-only. We are so used to using GUIs to point and click our way through tasks. In this series we'll walk through some of the most common command line tasks to help you understand what is going on and be able to do some cool tricks yourself.

This is the first video in a series that shows basic command line usage for *nix systems, such as Linux, Mac OS X, and on Windows, using applications like Cygwin. This video shows the following commands and spends the most time explaining how to move around your file structure from the command line:

  • pwd
  • ls (and ls -al)
  • less
  • cd
  • man
  • clear

Note: this video was originally released August 31, 2009 on Lullabot.com.

Comments

Oh no! That seems like a pretty easy mistake to make. I wonder if there are version control tools (like git?) that could undo the damage, or maybe computer backup systems.

Also, thanks for typing out the `composer create drupal/recommended-project command`. I didn't know that it existed. I looked it up and saw the command I learned (just over one year ago!) is deprecated.

No problem!! I'm glad that you found something useful in all of that :)

And I'm sure you're right about using version control systems like git that would have helped. I'm still learning :) And this is definitely a mistake I won't make again. (fingers crossed)

Add new comment

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code class> <ul type> <ol start type> <li> <dl> <dt> <dd><h3 id> <p>
  • Lines and paragraphs break automatically.

About us

Drupalize.Me is the best resource for learning Drupal online. We have an extensive library covering multiple versions of Drupal and we are the most accurate and up-to-date Drupal resource. Learn more