DOS WebClass | Learning Linux Code

career oriented technology skills

⇓ Hover your mouse over each vertical panel below to see the lessons ⇓

  • Lesson 1 | Basic Linux File Structure

    Basic Linux File Structure

    Although it might seem complicated at first, the Linux directory structure is actually pretty easy to understand.

    Here's your first assignment. Read this article, and then spend one or two classes navigating through the linux file system on the local server. If you haven't signed into the server before, ask your teacher how it works.

    When you feel like you understand the basic directory structure, navigate to this link and take the quiz. Check your answers as you go, and refer back to the first website mentioned in this lesson if you get mixed up. Don't move on to Lesson 2 until you can get nine out of eleven correct.

    Here are a couple of additional resources to get you started. This article covers the basic Linux file structure, and this article is a Google Code University lab covering the advantages of using Linux (and how to get around using the command line). As you'll see if you spend any time looking around the internet, the number of free resources available to learn Linux are endless.

  • Lesson 2 | Basic Linux Commands

    Basic Linux Commands

    Working on the command line with the Linux operating system offers a number of advantages. Graphic user interfaces (GUI's) are designed to make computing easier for novices and expert users alike. But GUI's are resource hogs, and there are times when you want access to information and processes without the necessity of a mouse or flashy graphics. (For more on the command line vs. the GUI, check out this website.)

    To start this lesson, spend a few minutes studying basic Linux commands by visiting this website. You might want to take notes because you'll be using all of these commands on a regular basis.

    At the end of the article the author mentions a command line text editor called "vi." Vi and Vim are the standards in the Linux world, but learning to use these editors will take time, study, and patience. I suggest starting with a simple text editor called "Nano" instead.

    To start this application just type "nano" at the command line and hit enter. If you want to create a new document, type "nano [name of document]"" and the new document will be created in the current directory (the one you're currently working in). You can create a new document in a specified directory outside the working directory as well. For instance, to create a "index.html" file in your "/var/www" directory, enter "nano /var/www/index.html." (Don't include the quotation marks when typing these commands.)

    To complete this lesson, use Vi, Vim, or Nano to create a new document and save it to your "home" directory. Then (you guesed it) -- take the quiz. Click on this link -- this quiz is easy, so you have to score 100% before moving to the next lesson.

  • Lesson 3 | Advanced Linux Commands

    Advanced Linux Commands

    Advanced Linux commands help you run and monitor processes on the server. You can read a great guide to learning the shell here, but we're going to concentrate on just a few chapters.

    To start this lesson, read this article about commands that help you control jobs being executed by the computer.

    After that, have a look this page about standard input, standard output, pipes and filters.

    Don't forget, if you want to try some of the commands out from the articles, you can cut and paste from the website into the terminal.

    That's it. Go back through all of the commands you've learned and try them out from the command line. If you want, print out the Ubuntu Reference Guide (see below), or copy it to your computer, and use the basic and advanced commands until you feel comfortable moving around the directory structure and performing simple actions.

    Here are a couple more resources:

  • Lesson 4 | Permissions


    Permissions are used to controll access to all Linux files and folders. If you have a terminal window open, type the command "ls -l" to list the files in your current directory and to see their permissions. The letter you see at the beginning of each line will tell you what kind of item you're looking at (files start with "-", and directories with "d", for instance), and the letters that follow are the code that represents each item's permissions. This system helps an a systems administrator control who has access to what, who can edit or change certain files, and who can run certain processes. Here's a quick explanation of the Linux permissions scheme:

    • r = permission to read the file or look in the folder = 4
    • w = permission to write or change the file or folder = 2
    • x = permission to execute (run) a file or program = 1

    If your user is given read, write, and execute permission, then you could represent that combination as the number "7."

    Permissions are assigned to files and directories using the chmod command, and apply to the user, group (your user name and group name are often the same), and other, or world, categories. These are the categories you see after the initial line of letters when you run the "ls -l" command.

    Let's say that you want to grant read and execute permissions on a file for the owner only. In other words, you want to create a file that only the owner or creator of the file (yourself) can access or run. You could use this command:

    # chmod 500 example.txt

    If you were working on a website and wanted to create a folder to house your project where you had read, write, and execute permissions, but users from groups outside of your own and the world could only read and execute, you would run:

    # chmod 755 /example/directory

    Now it's time to do a little research into file and directory permissions. Navigate to this article and read it carefully.

    Now its time for the quiz. Go here and give it a try. This one's a little harder -- you need to get at least 7 out of 10 correct. If you don't know the answers go back to the article in this lesson or use your browser to find the correct answers.

    Don't give up! Understanding permission is crucial for website developers.

  • Lesson 5 | Basic Scripting

    Basic Scripting

    Shell scripts are short programs that are written in a shell programming language (such as the Bash shell) and interpreted by a shell process. They are extremely useful for automating tasks on Linux and Unix systems.

    Shell programs, or scripts, read commands that are typed into the console (terminal window) and then execute (run) them.

    Here's a very simple example. When run, it will print out the term, "Good morning, world.":

    									echo "Good morning, world."

    If you wanted to, you could copy the above code and paste it into a plain text file (using a text editor like "nano" or "vim"). If you save the file you now have a script. You'll have to change the permissions on the file before it can be run, but this is the basic method used to create all shell scripts.

    To learn how to script, watch the next two videos and

    Linux Shell Scripting -- Part 1

    Linux Shell Scripting -- Part 2

    Here's another easy to follow tutorial that starts with basic Linux commands and then covers simple shell scripting. Have a look here.

    Finally, have a look at this website -- it's a great resource shell scripting: Wicked Cool Shell Scripts.

    Well, that's it. Except for the quiz! You need to get 5 out of 6 correct to pass.

    Click Here For the Quiz

DOS WebClass Code Class -- What We're About

Did you know that over sixty percent of the world's servers, the machines that keep major businesses running and act as the backbone of the internet, run on Linux? Have you ever wondered if you could administer a website, run a server, or create a simple code capable of running complex operations?

The Linux Code portion of the DOS WebClass is designed to fill a six week term. Each lesson highlights common Linux command line skills which are used daily by Linux system administrators. You'll learn to navigate through the Linux file structure, to use basic and advanced commands, to adjust file and folder permissions, and how to write simple programs called shell scripts. If all of this jargon looks like a foreign language--don't worry. Learning to code with Linux is easier than you think and well worth your time.

Special thanks to jamess for showing interest in Linux servers and giving me a good reason to build this website.