If you are familiar with administrating Windows, but are curious to know about Linux, this article may be of interest to you.
This article is not for the everyday user who wants to get started with Linux. If systems administration is not your thing, but would like to learn some of the differences between Windows and Linux, I would recommend reading
Is Linux Like Windows?. However, those who have a background in Windows system administration, please read on!
I'll warn you right now. Linux is
not like Windows. It's a different operating system that stands on its own merits, and does not strive to duplicate the functionality of the operating system you are familiar with. Linux is based on
Unix, which has been around since 1969. Its resilience is testimony to its success.
To help you migrate your skills to Linux, I've broken down the article in key topics that will help transition your Windows skills to the (rough) Linux equivalent. There is no 1-to-1 equivalent to the tools. There is a learning curve. Once again, it is a different operating system, and you may have to 'unlearn' some of the things you have learned.
Linux IS SupportedLet's tackle one of the biggest myth I hear from Windows system administrator. They assume that because Linux started (and continues) as a community project, it is not commercially supported. Let's get this out of the way: Linux
is supported by a number of large company. Here's a few companies that supports Linux in one way or another:
IBM,
Novell,
Red Hat,
Canonical,
Sun Microsystems and
HP.
Just like Microsoft, you can enter a service agreement with any of those vendors. The difference is, with Microsoft, you buy the product and the support. With Linux, you (typically) just buy the support.
Command Line vs GUII won't lie to you. If you really want to learn to administer a Linux machine, getting familiar with the command line is a plus. However, if you have any experience administering Windows, you probably find yourself inside the command prompt from time to times anyways.
One of the reason that you may need to use the shell (command line) is due to the fact that the GUI is
optional. As opposed to Windows, the graphical environment is just another program that can be started and stopped. Most administrative tasks in Linux can be done by the mouse. However, you may find that the command-line is necessary to rescue some system, or, as you get more familiar with it, you'll probably find yourself working faster and enjoy more control over your system. At least, I know I do!
There are many commands available to you. Each of those commands are separate programs that you are running. Most command will allow you to get help on the syntax by using either the
-h parameter, the
man or
info commands. For example, to get help on the
ls command, you can use either:
ls -hman lsinfo ls(Hit the letter 'q' on your keyboard to exit out of
man or
info)
The Root UserThe Linux equivalent to the administrator's account is called the root account. Logging-in as root gives you
complete control over the machine. Using the root account is considered dangerous, and is disabled by default in many distributions.
To perform administrative task, the
sudo command is used. Sudo (Super User Do) allows users to execute programs with elevated privileges. For example, the
mount command needs to be executed by root. Thus, being logged in as a regular user, I can use
sudo mount [...] to execute that command as the super user (root). Depending on your configuration, you may be prompted for a password before the command can be executed.
Another useful command is
su (Substitute User, Switch User or Super User depending on who you ask). By using
su, you can effectively 'become' another user, as if you had logged in as them. For example, executing
su root or even just
su would log me in as the root account. Of course, you may be prompted for a password.
File System StructureDon't look for your C: drive. It does not exists. Linux uses a virtual filesystem. Everything starts from the root directory (not to be confused with the root user), which is represented by the forward slash (/). You can try:
cd /
ls to see a list of all the files and directories in the root. The directory names are typically short. Here's a quick guide to orient you:
- /home &mdash The user's home directory. Similar to Documents and Settings
- /etc — The system's settings. Similar to the registry
- root &mdash The root user's home directory. Similar to My Documents for the Administrator's account.
- /dev &mdash The devices available to the machine. The closest equivalent I can think of is your Device Manager.
- /boot — The files needed to boot the kernel. Similar to ntldr
- /bin — User commands like
ls or cd - /sbin — System Binary. Includes system's administration commands like
ifconfig or mount - tmp &mdash Temporary files
- var — VARiable files, like your system log, mailboxes and printer queues.
This is not a complete list, however, it should get your started.
Mounting DevicesOne important directory that I left out is /mnt or /media. The Unix virtual filesystem allows you to 'mount' drives anywhere you want.
For example, in Windows, if a system has two drives, it is represented by two separated drive letter (ie: C: & D:). In Linux, those drives are 'mounted' into the file system. You 'C:' drive may be the root, and your 'D:' drive may be /var. So, the moment you enter the /var directory, you are now on another drive. This allows your to transparently (re)distribute your drives without having to reconfigure a single application. For example, if the /home directory is getting full, I can easily copy the content to another drive, and mount /home to that new drive. Everything will continue to work as-is. However, any files being read or written under /home will be done on the new drive.
To see where the devices are mounted, use the
mount command.
File SystemsForget about NTFS or FAT32. Though Linux supports them, the preferred file system is usually
ext3 (third EXTented filesystem). Similar to NTFS, this file system is journaled. There are other file systems available like
ZFS,
XFS and
ReiserFS.
Ext4 is currently in development.
Linux support more filessytems than Windows or MacOS X combined.
Everything is a FileUnix popularized the idea that 'everything is a file.' That is, to access your hardware and services, 'virtual' files are used.
The /dev folder contains virtual files that represent the devices on your system. For example, you may see a file called
mem which represent the ram of your machine. Other files may include /dev/cdrom0 — your first CD-ROM, /dev/sda — your first SATA or SCSI drive, /dev/sdb, your second SATA drive, and so on. IDE drives are represented by /dev/hda, /dev/hdb, and so on. Partition on the drives are numbered. For example, /dev/sda1 is your first partition on the first SATA drive. /dev/sda2 is the second partition and so on.
Accessing a block device like /dev/sda gives you direct access to the disk. That is, you can read and write at any position on the disk. This is
very dangerous of course, since you are by-passing the normal directory structure, and accessign the bits and bytes of the disk directly.
To view the content of a disk normally, it needs to be 'mounted' to a directory. For example, if I would like to mount the second partition of my first disk as the /home directory, I would execute the following command:
sudo mount /dev/sda2 /homeThe /home directory is now mapped to the second partition of the disk. I'm able to view and work with the files and folders located on that partition. To unmount it, use:
sudo umount /homeThe /home directory is no longer mapped to the second partition.
Another example would be accessing the content of CD-ROMs, USB flash disk or floppy disk:
sudo mount /dev/cdrom0 /media/cdromsudo mount /dev/sdb1 /media/usbsudo mount /dev/floppy /media/floppySettingsIn Windows, you have the registry, which you are not allowed to edit, but everyone does anyways ;)
Linux is very different. Most of the system's configuration is under the /etc directory. There are many files in this directory, and most of them are text file. A few important files include:
- fstab — File System TABle. This file documents how your drives and partitions are configured at boot.
- passwd — The user accounts of the system
- groups — The groups associated with the user accounts.
- hosts — Practically the same thing as the Windows hosts file.
Of course, there are more. Feel free to open them in your favourite text editor.
Another nifty trick is to use the & after a command. This allows you to launch a command in the background. For example, the
updatedb may take a while to execute. By using the &, I can continue working, while updatedb is running in the background.
sudo updatedb &You can also temporary interrupt an application by hitting CTRL+Z on the console. This does not terminate the application (like CTRL+C), but suspends it. To continue executing the application, use
fg (ForeGround) to return to the application, or
bg (BackGround) to allow the application to execute in the background. (If you've used
fg to return the application, you can continue to use CTRL+Z to suspend it at anytime!)
Package ManagerMost modern Linux distributions have a package manager that takes care of installing, uninstalling and upgrading any applications you have installed.
For example, on my Ubuntu box, to install a LAMP (Linux, Apache, MySQL & PHP), I can run:
sudo apt-get install apache mysql phpThe package manager will download the necessary files and install the programs for me. To configure the programs, I can download additional GUI tools, or edit the appropriate files under /etc. No more messing around with CDs and/or activation keys!
Starting and Stopping ServicesServices can be managed from the GUI, but should you desire to start and stop services from the command line, you'll find them in the /etc/init.d directory.
For example, to start the Apache web server, I could use:
sudo /etc/init.d/apache startTypically, those services support the start, stop, restart and status parameter. Furthermore, be aware that the /etc/init.d/apache command is just a shell script. You can see the code used to start and stop the service. It's just another program.
Log FileTo see your logs, take a look under the /var/log directory. They should be all there for you. Some of the important logs are:
- messages — Various messages from the system are recorded there
- auth.log — Authentication log
- security — Self explanatory
- cron — Scheduled tasks
- Xorg.log.0 — XServer (GUI) log.
There are others of course. Most of the log files are just text. Learn to use the search feature of your favourite text editor!
It's FreeLinux is a free operating system. By free, we mean free as in free speech. This is important, because it allows you to use and customize the operating system to your liking. This is the main reason why Linux is used anywhere from routes to super computers.
To learn more about free software, I would recommend reading
Free Software 101.
Linux has a lot to offer. It is succeeding not by marketing forces, but through its own merits. Many large players use and support Linux. Most of the top players on the Internet use Linux or another free operating system to host their sites. From my end, I use Linux everyday, both as a desktop operating system and in my servers. This has offered me tremendous savings as well as opening possibilities that proprietary (non-free) operating system cannot offer.
I hope you will give Linux a go, and get a feel for it. If you have any question, please drop me a comment.
Have a great day!
Labels: linux, windows