Drupal 7 Advanced Training
Illustration by John Hersey

Using Unix's command-line interface


From:

Drupal 7 Advanced Training

with Tom Geller

Video: Using Unix's command-line interface

Drupal can run on a variety of operating systems, but an overwhelming majority of the time your web host will be running on a UNIX-like operating system such as Linux. For the sake of convenience, I'll call all such operating systems UNIX, although technically that's not quite true. The primary way that you interact with UNIX is by typing command into what's commonly called the command-line interface. There's no dragging and dropping, no double clicking, and the command themselves can be kind of obscure. The good news is that you only need to know a few of them to maintain, update, and tweak your Drupal site.
Expand all | Collapse all
  1. 4m 51s
    1. Welcome
      1m 7s
    2. Planning your Drupal career
      3m 44s
  2. 25m 46s
    1. Comparing development and production environments
      6m 22s
    2. Configuring your settings.php file
      7m 10s
    3. Running multiple sites from one Drupal installation
      7m 32s
    4. Troubleshooting common issues
      4m 42s
  3. 51m 20s
    1. Understanding your Drupal site's place on the web
      2m 44s
    2. Selecting a web host
      7m 20s
    3. Using Unix's command-line interface
      8m 23s
    4. Working with your web host's access restrictions
      4m 51s
    5. Using cPanel and other graphical web host interfaces
      3m 40s
    6. Transferring files to and from your web host
      5m 49s
    7. Moving databases using phpMyAdmin
      6m 34s
    8. Moving databases using Unix commands
      6m 8s
    9. Modifying server configuration files
      5m 51s
  4. 27m 11s
    1. Learning from case studies
      3m 13s
    2. Planning your site
      4m 18s
    3. Populating your site with Devel Generate
      3m 43s
    4. Managing URL paths
      3m 20s
    5. Restricting access to downloadable files
      5m 55s
    6. Reusing site components with the Features module
      6m 42s
  5. 21m 54s
    1. Understanding and installing Drush
      5m 23s
    2. Installing Drupal using Drush
      7m 24s
    3. Building a site using Drush
      9m 7s
  6. 32m 0s
    1. Backing up with the Backup and Migrate module
      8m 17s
    2. Moderating comment spam
      6m 47s
    3. Migrating from Drupal 6
      4m 28s
    4. Migrating to Drupal 7
      12m 28s
  7. 22m 24s
    1. Letting users log in through OpenID
      5m 10s
    2. Letting users log in through Facebook, Twitter, and other services
      9m 43s
    3. Republishing posts on Facebook and Twitter
      7m 31s
  8. 1h 5m
    1. Understanding Drupal's base themes
      5m 55s
    2. Introducing base themes: Zen and subtheming
      11m 35s
    3. Introducing base themes: Fusion and extensibility
      10m 44s
    4. Introducing base themes: AdaptiveTheme and responsive design
      7m 25s
    5. Introducing base themes: Omega and mobile devices
      7m 9s
    6. Using Firebug and other theming tools
      7m 20s
    7. Modifying themes with Sweaver
      6m 59s
    8. Modifying themes with Livethemer
      8m 45s
  9. 49m 36s
    1. Understanding the Rules module
      6m 49s
    2. Demonstrating how Rules works in Drupal Commerce
      3m 53s
    3. Creating practical rules
      6m 37s
    4. Improving rules
      9m 10s
    5. Defining conditions with the Context module
      7m 51s
    6. Varying layout with the Context and Delta modules
      5m 0s
    7. Varying layout with the Panels module
      10m 16s
  10. 52m 46s
    1. Enabling social features
      9m 46s
    2. Implementing a voting system
      9m 15s
    3. Rewarding good behavior with the Userpoints module
      5m 57s
    4. Setting up Organic Groups
      6m 28s
    5. Adding content to groups
      2m 21s
    6. Seeing group activity better with views and panels
      10m 13s
    7. Making groups private
      4m 54s
    8. Letting each group have its own permissions
      3m 52s
  11. 25m 32s
    1. Understanding packaged Drupal distributions
      2m 8s
    2. Getting a head start with Acquia Drupal
      7m 28s
    3. Creating online storefronts with Drupal Commerce
      6m 53s
    4. Creating government web sites with OpenPublic
      9m 3s
  12. 1h 30m
    1. Taking the assignment
      3m 26s
    2. Planning the project
      3m 43s
    3. Preparing the infrastructure
      8m 42s
    4. Starting the design
      7m 35s
    5. Filling in the content
      7m 29s
    6. Developing the layout
      10m 27s
    7. Finishing the layout
      7m 8s
    8. Refining the CSS
      6m 32s
    9. Setting up sections for regional offices
      4m 53s
    10. Configuring regional offices
      7m 18s
    11. Connecting to social media
      5m 9s
    12. Cleaning up
      12m 32s
    13. Securing the site
      5m 56s
  13. 37s
    1. Next steps
      37s

Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now
please wait ...
Watch the Online Video Course Drupal 7 Advanced Training
7h 50m Intermediate May 17, 2012

Viewers: in countries Watching now:

This course teaches web site designers how to take their sites to the next level with a few advanced techniques and the free and open-source Drupal software. Author Tom Geller shows how to configure the most popular add-on modules; use *nix commands and an FTP program to manage a Drupal site on a web server; change its visual appearance using the latest graphical tools; automate and speed through common tasks with Drush; integrate with social media sites; and see how "supermodules" like Panels, Context, Rules, and Features open up new worlds of code-free development.

Drupal 7 Advanced Training was designed as a follow-up to Drupal 7 Essential Training and it also dovetails nicely with our other Drupal courses, such as Drupal 7 Reporting and Visualizing Data and Create Your First Online Store with Drupal Commerce.

Topics include:
  • Moving a site from the development environment to production
  • Hosting a Drupal site
  • Moving databases with phpMyAdmin and Unix commands
  • Making site administration more efficient with Drush
  • Backing up site data
  • Moderating comments
  • Migrating from previous versions of Drupal
  • Working with themes
  • Creating variable layouts
  • Enabling social features
  • Creating an online store with Drupal Commerce
Subjects:
Developer Web
Software:
Drupal
Author:
Tom Geller

Using Unix's command-line interface

Drupal can run on a variety of operating systems, but an overwhelming majority of the time your web host will be running on a UNIX-like operating system such as Linux. For the sake of convenience, I'll call all such operating systems UNIX, although technically that's not quite true. The primary way that you interact with UNIX is by typing command into what's commonly called the command-line interface. There's no dragging and dropping, no double clicking, and the command themselves can be kind of obscure. The good news is that you only need to know a few of them to maintain, update, and tweak your Drupal site.

A quick warning though: UNIX is extremely powerful. It's actually possible to wipe out everything you have with only a few quick commands. So I do recommend further study before you dive in. Here we go with the basics. The first thing that you'll need to do is to connect to your web host using a terminal program such as I have here on Mac OS. On the Mac, you'll find that inside the Applications folder, then inside Utilities, and then it's simply called Terminal. On Windows, you can use a third-party client such as PuTTY or OpenSSH, or type "telnet" at the command line.

Click the Start menu and then search for SSH. Now let's talk about how you tell the computer to do things. Commands in UNIX generally follow the pattern, command; followed by options; followed by arguments. Let's take a look at some examples. ls means list everything that's in the directory that you're currently looking at. It's basically like double-clicking a folder and seeing all the files inside it. It doesn't require any options. However, you can add them. For example, ls -al means list, but show all files in a long form.

Some commands, including ls, can also include arguments. For example, ls -al sites/ means list everything that's in the sites folder in a long format and show all files, including the invisible ones. Some commands take more than one argument. For example, the copy command, cp. The one that I have here is copy recursively, cp -R, that is, copy this directory and everything below it from temps/sites to something new called website. And this continues to go on, so some commands can actually be quite complicated.

You see this tar command here, which is a stuffing and unstuffing program, which has several different parts to it. It's actually just the command, followed by the options, followed by several arguments. One thing that's confusing about UNIX is that it often uses single characters as shorthands. Here's a list. It's not a complete list, but it shows you the most important ones. A period (.) means the Current directory. Also you'll sometimes see it at the beginning of hidden files, such as .htaccess; that particular file shows up a lot when you're working with Drupal. Two periods (..) means go one level up.

It's like clicking that button in Windows that shows a little folder with an arrow coming out of it. A tilde (~) is your home directory. A slash (/) shows the directory structure. So for example, sites/all, means the all folder inside the sites folder. Finally, we have this asterisk (*), which is the wild card. It means do whatever you want to do, to everything. Here's a short list of the commands you'll use most often. Rather than talk through them all, I recommend you stop the video at this point and keep its window open while you're getting used to them.

You'll notice as you look at the list that they are kind of obscure. I mean, what is cd, what does that have to do with moving from one place to another? It's because it's shorthand for the original meaning of it, which is change directory. So sometimes it's easier to remember these commands if you know sort of where they came from. But enough talk, the best way to explain is to do, so I'm going to perform a quick session on my web host right now to start installing Drupal. The first thing that I do is I connect to my web host. Right now, I'm just looking at the Terminal on my desktop machine, so ssh, my username@ the domain.

The first time you do this, it may ask you whether you want to take a key; that is, so it knows that it's your computer. Just say yes if that happens. I enter my password, and I'm in. One thing that you'll notice is this prompt; that is, the thing that is before everything that you type has changed. It tells you a little bit about where you are. In this case, I'm user tgeller on web41 on my web host, whereas before I was simply booth-06-mac. First thing I'm going to do is to take a look at that list command, ls. That shows me everything that's in this folder.

I can see where I am with pwd, which believe it or not, originally stood for Place Where I Dwell. I can make a directory, mkdir lynda, and then if I ls again, there it is. If I do ls -al, it shows all files, including the hidden ones in a long format. This is what it looks like. You'll notice that it has some of these dot (.) files we didn't see before. That's what the "a" does. I'm going to descend into that lynda directory by doing cd lynda. If I ls again, I see there's nothing in it.

Okay, now we're going to go to drupal. org and get a copy of Drupal itself. That's at drupal.org/project/drupal. Scroll down. I'm going to Copy the Link right here, go back, and use the wget command, and then paste the link that I just copied. It shows a progress bar, and if I type ls, we see that there it is. Now I'll use the tar command. You'll notice I'm using those options. These ones are the ones that I always use to uncompress something from drupal.org. The x is for extract, the z is for a ZIP file, v means verbose, and the f means I'm about to give the file name.

Again, as you learn more about UNIX, you'll get to know these options a little bit better. You'll notice I only typed a few letters of the file name and then hit the Tab key. In many versions of UNIX that completes whatever is there. If there's any ambiguity; if for example, there was more than one file that began with dru; it would give you the different choices that are available. But that's all I have, so we extract. I list again, and now I see both the files I downloaded, the gz, and the uncompressed folder. I'll get rid of the gz by rm *.gz.

And because there's only one .gz file in that folder, that's the only one it gets rid of, even though the star (*) means get rid of all of them. List again, yep, it worked. To send into that drupal folder, see what's in there. You'll find yourself doing this a lot. You go to a place, see what's there, move it, go to another place, and so on. I'm going to move it all up one level. Now if I list again, I see that it moved everything, except the dot (.) files. I have to move those manually. So, .get, up one. Move .htaccess up one.

Now it's empty. I can go up one level and remove the directory, drupal. Now when I list again, Drupal has been downloaded and is ready to install. I know that was a lot of things to see all at once, but I just want to give you a sense of what a typical UNIX session is like. You'll find yourself moving around a lot. The cp command for copy, mv for move, ls for list, these are things that you use all the time. The last thing I want to show you is how to get help with the man command, which stands for manual.

Let's say I want to see how to copy; man cp gives me all of the details I need, and there are quite a few. You can go from one page to another by pressing the spacebar, and as you can see it has a lot of options. A few other useful commands are b, which brings you back up a page; h, which gives you help for using this reader; and then q, which gets you out of the Help command entirely. For complicated commands, for example, for the tar command, I recommend that you take a look for examples, because as you can see, there are far too many switches here to know just from learning the first time.

So down here at the bottom, you have all of these examples which explain things much more quickly than if you were to look through all of those options. Now I'll be honest, I'm personally not all that adapted to UNIX and I often find myself turning to experts for help. I'm very grateful for the lynda.com course, UNIX for Mac OS X Users and I recommend it to anyone who wants to dive in deeper. You might also be able to run your site just fine without ever having to use the command-line interface; for example, by using a graphical FTP program. But if you do need to, what you've seen here will help you get off to a good start.

Finally, if you find that these commands aren't working for you, contact your web host. They might have things set up differently from what you saw here.

There are currently no FAQs about Drupal 7 Advanced Training.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Drupal 7 Advanced Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.