|
As a programmer, you need to be quick from the command prompt. One of the most common tasks is make and delete directories. In Unix and Linux flavored operating systems, including OS X, you can create new directories with the mkdir command. To create nested directories you can use the -p option. You can also create more than one directory at a given time by using brackets. The above command will create three directories, lib, src, and doc. The kewl thing about mkdir is that you can mix both nested directories structure with with brackets to create a complete directory structure. To delete a directory you can use the rmdir command, but I hardly ever use that command because the directory needs to be empty and does not delete directories recursively. To remove directories recursively you can use the rm command with the -r option. Technorati Tags: unix, linux, command, prompt, mkdir, rm
The Importance of Learning How To LearnA quick aside before I get into the details of the O’Reilly School: after graduating university, I quickly found out that the single most important skill I learned while attending, was the ability to learn how to learn. In the computer and web industry specifically, if you are still using the same programming languages and software 3 or 4 years from now, you’re out of date, and obsolete. I studies Visual Basic 6 in university and graduated right before .net 1.0 was released, meaning all the employers in my area were moving to ASP.net rather than classic ASP, and I needed to learn it… immediately. That was when I first realized exactly how important it was to be able to teach myself new technologies quickly. I was trained entirely in Microsoft technologies like ASP, Visual Basic, Access, and SQL Server, but now, 5 years later, I’ve taught myself PHP, Perl, Apache/Linux Administration, MySQL, Java, as well as Flash/Actionscript, Photoshop, and Illustrator to be able to handle the entire range of services I provide to my clients. Because there is so much involved in Linux administration, I’ve always wanted to take some more formal training as opposed to just reading books. I’ve taken a week long course in Red Hat, but I’ve been working more with Debian, and Ubuntu lately, and I wanted more general training in administering Linux, rather than just Red Hat/Fedora as well as the networking administration. So, I enrolled in the O’Reilly School of Technology Linux/Unix Systems Administration Certificate and got started. Course 1: The Unix File SystemThe first course was actually really easy. I’ve been running my own dedicated server for about 2 years now, and I’m more than comfortable from the command line, and adding users and general administration. The first course I was finished in literally a couple days. It was mostly getting used to the common commands like ls, cd, rm, touch, and getting comfortable with some common Unix text-editors like Vi/m and Emacs (I personally prefer Vim). I picked up a couple new tips, but the course was relatively simple. Course 2: Networking and DNSThis course I was really excited about because I’ve always used my hosts DNS tool to setup the DNS for my web sites, and I really had no clue how it worked. Although I had taken a networking course in university and a hardware course that included a lot of binary math I had a pretty good idea of how subnet masks and IP addresses worked, however, this course was not only the hardest course in the series, but also the most informative and educational for me. It also covered some great material on how TCP/IP and networking in general works, which was really good. Course 3: Unix ServicesI learned a couple new things about Apache and Sendmail in this course, and the topic I learned the most on was Procmail. I had never used procmail in any of my web applications, but after going through this course - which covered Procmail significantly - I am pretty comfortable with it and am looking forward to building some new web applications that can use e-mail as a method of communicating with my web apps. It was great to get a better understanding of how the Linux operating system works to integrate into my web applications. The other topic that really helped me in this course was the compiling and installing of programs like sendmail, Apache, and PHP. I’ve always used RPM or APT-GET to install packages on my servers, but going through the entire installation process and learning how the make and gnu-make utilities worked was great. Rather than just letting the packages management tools do their job, I’ve always wanted to be able to install packages myself, and get a better understanding of exactly what each program and service installed on my server does. Course 4: Scripting for Administrators Sed, Awk, and PerlThis course wasn’t too difficult since I’ve done some shell scripting before, and have played around in Perl a bit, but getting a solid foundation in Sed and Awk has really improved my command line efficiency. For example, now rather than downloading client log files and running them through click tracks, I can run some simple piped grep and awk commands to see browse log files much faster and not have to worry about scrolling through hundreds of entries when I’m looking for errors, and system messages. I was also excited about learning more about Perl since I’m working on getting a library of scripts ready to really speed up my administration tasks. Overall, the series was really great. Each course taught me a couple new tips and covered a few new topics for me, and the Networking and Scripting courses were exceptionally well done. After earning a certificate like this, I’m even more comfortable administering my server, and shouldn’t have to open so many support tickets with my host. For anyone looking to become a Unix administrator, or like me, someone who already has a solid foundation but wants to further improve your skills, this course is a great way to get some quick training, and then it really comes down to getting experience. I wouldn’t expect to write any certification exams after earning a certificate like this, but it gives you more than enough to start out as a system admin, and after some experience you should be able to tackle any sort of administration issue.
Procmail Procmail is an extremely useful utility if you administer or receive mail on a *nix system. Procmail is a (some would argue the) Mail Delivery Agent, or MDA. The purpose of an MDA is to distribute messages to individual mailboxes on a mail server - this is the program that takes the message from the MTA (Mail Transfer Agent, like Sendmail, Postfix, qmail, and others) and places the message in the appropriate mailbox. The power of procmail comes in when you create custom filters to place messages in certain mailboxes based on the criteria you choose. In procmail terms, these filters are known as “recipes” and are kept in the file .procmailrc in your home directory. Procmail recipes are first-match - that is, as soon as one of the recipes matches the message being filtered, processing stops. (This can be avoided, as we shall see). Let’s examine my procmailrc: First we tell procmail some basic environment information: Next we set up our first recipe. As you have already seen, comments begin with an octothorpe, and now we see that the recipe itself begins :0: To decode the above, the recipe says “if the From, To, Cc, or Bcc fields begin with the pattern some character(s) omerset (some more characters) hardcorp then that email should be delivered to the somersethardcorp mailbox. But we can even get tricky - how about spam filtering via bogofilter? There are actually 3 recipes in that portion. The first pipes the message out to bogofilter, with the appropriate arguments. The second says that if an error is encountered, output some information. And the last recipe files the message into the spam folder if the (newly-created) X-Bogosity header contains ‘Spam’. The last recipe says that, if none of the other conditions have been met, we should deliver that message to the inbox folder. Notice that the way to match all messages is simply to provide no conditions - pretty simple. Procmail is very powerful, and can do much more than these simple examples. The procmailrc man page contains many more examples.
|
Categories
Site Directory
Favorites |
||||||||||||||||||||||||