Getting Started With Linux

Some quick Linux lessons geared for Window folks              <-- Back to CliffordTheEvilRedDog

 This tutorial is a very basic guide for beginners. It covers some of the most basic and frequent commands used from the console. Those of you who are accustomed to using dos, or cmd will have a fairly easy time with this tutorial.  So lets begin... Most if not all of the commands in this section will be interchangeable between Linux and Unix. You should use the man pages if you are uncertain of the correct syntax. For brevity I will refer with Linux and Unix as Linux. ( Linux and Unix are not the same )


Comparing Linux to Dos

Well, at first glance a Linux or Unix terminal looks an aweful lot like a dos terminal - and some of the commands are similar. In this section we will take a look at how dos and Linux are alike and not alike.

To copy of file in Dos, you might do something like this:

C:> copy file1.txt file2.txt

And in Linux and Unix, the cp command is used in the same way 

$ cp file1 file2

 however in Linux you can copy file1 and file2 to file3 like this

cp file1 file2 file3

To see what files are in the current directory you would use ls

$ ls

file1 file2 file3

or for a long listing ls -l

$ ls -l 

total 2

-rwxr-xr-x 1 billybob billybob      100 2008-01-21 14:30 file1

-rwxr-xr-- 1 billybob billybob      110 2008-01-22 14:31 file2

The first section describes the permissions on the file 

d=directory r=read, w-write, x=execute

first -rwx section pertains to the owner of the file - owener can read write and execute it

second r-x section pertains to members of the owner's group.  in this case they can read and execute

third r-- section pertains to all other users and indicates that other uses have read only access.


some other similar command are below

DOS       Linux

----------------------

dir          pwd

cd          cd

del          rm

rmdir       rm -rf

date        date

ping         ping

ren          mv          ( think about it - rename and move do the same thing ) 

netstat    netstat

tracert      traceroute

type          cat

echo         echo

pwd           pwd

Some command that are unique to Linux and Unix

chmod - changes the permissions on a file or directory. ( this can be done via artrib or cacls )

chown - changes the owner of the file ( see cacls on win2k+ )

chgrp - changes the group of the file  ( see cacls on win2k+ )

kill       - kills a process

su      - switch to ( impersonate/become ) another user.


Lets start looking at some differences.

1. DOS is a single user, single threaded operating system. When is it not actively running and application , it just sits at the command prompt and waits for the next instruction... literally, nothing is happening in the background at all. At most you can have tsr programs remain loaded in ram and run when triggered ... but thats it.


2. The Linux shell that you see when you log onto a linux or unix machine is not the operating system itself, rather its an interface to the operatring system. When you enter a command on a linux terminal, the command is executed, and some portions of it will execute in "userland" as you, while some portions of it ( system calls ) will execute in kernel space as the kernel. If you start a mail demon for example, the mail demon will run entirely in kernel space. 

3. While you are sitting at the console pondering what you will type next, the linux kernel is actively running - or may be sleeping at the moment. The kernel remain in memory the entire time, and does wake up and do stuff from time to time. Windows NT, XP, 2000, etc.. follow a similar paradign and also have a kernel that runs in the background. These operating systmes also schedule processes and manage memory and resource access.

So Then why do do want to use Linux when we can use Windows ? 

Now to answer the million dollar question... :)

1. Linux is free - you will never pay a dime for it - that is unless you want to.

2. Linux is open source - this means you can literally download the source code, change it to your liking and use it.

3. Linux is far easier to use when it comes to automation and administrative tasks.

- have you ever tried to pass an windows gui application ( like regedit ) an argument ? 

- some windows apps simply dont take arguments - they expect you to use the gui. This is terrible if you are trying to automate a task.

 - the cmd scripting language is horrible to work with. Its fine for simple scripts, but once you start making scripts that need to loop and parse variables, its gets very tricky. I have found myseld downloading countless programs to do  stupid things like writeing a raw image to a disk, killing a process, listing processes, etc... the list goes on and on.

4. It seems that Windows is always missing something or has some annoying limitation that prevents you from doing what you need to do - unless of course you fork over more money to MS. In my opinion I believe that this is because MS is trying to make windows as profitable as possible at the expense of the user. If you ask mee this is just plain greedy - and this is the number one reason why I stopped using windows.


( ok, MS rant is over... tune in next week for lesson# 2 )