chapter 4c introduction to linux

Upload: evbu

Post on 10-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Chapter 4c Introduction to Linux

    1/22

    Introduction to Linux

    Linux

    Basic Commands

  • 8/8/2019 Chapter 4c Introduction to Linux

    2/22

    2

    Linux is a computer operating system. free software (open-source)

    source code is available to the public

    freely use

    Modify

    redistribute it.

    Primarily developed and used by individual enthusiasts.

    Since then, Linux has gained the support of major corporations such as IBM, Hewlett-Packard, and Novell for use in servers and is gaining popularity in the desktop market.

    Originally developed for Intel 386 microprocessors. Now embedded systems

    personal computers

    supercomputers.

    Linux Introduction

  • 8/8/2019 Chapter 4c Introduction to Linux

    3/22

    3

    What is Linux?

    Free i.e. free of charge, freedom to use Linux, and free Software applications,programming languages, and development tools etc.

    Unix Like: i.e. Like Unix, Linux runs on different hardware platform; e.g. Intel x86processor (Celeron/PII/PIII/PIV/Old-Pentiums/80386/80486)

    Macintosh PC's, Cyrix processor, AMD processor, SunMicrosystems Sparc

    processor, Alpha Processor (Compaq)

    Like Unix its alsoMulti-user/Multitasking/32 or 64 bit Network OS.

    Open Source Linux is developed under the GNU Public License referred to ascopyleft (not a copyright)

    Different vendors and volunteer developers share source code and build on each

    others work. The source code is available, freely modifiable, developed, and so forth.

    There are only a few restrictions on the use of the code.

    If you make changes to the programs, you have to make those changes available

    to everyone.

    Network operating system it is Internetwork and Internet-aware

  • 8/8/2019 Chapter 4c Introduction to Linux

    4/22

    4

    How to get Linux?

    Linux available for download over the net, this

    is useful if your internet connection is fast.

    Another way is the installation from CD-ROMwhich is fast/automatic.

    Various Linux distributions available. Following

    are important Linux distributions.

  • 8/8/2019 Chapter 4c Introduction to Linux

    5/22

    5

    Various Linux distribution

    Linux distributions Website/Logo

    Red Hat Linux: http://www.redhat.com/

    SuSE Linux: http://www.suse.com/

    Mandrake Linux: http://www.mandrakesoft.com/

    Caldera Linux: http://www.calderasystems.com/

    Debian GNU/Linux: http://www.debian.org/

    Slackware Linux: http://www.slackware.com/

  • 8/8/2019 Chapter 4c Introduction to Linux

    6/22

    6

    How to use Linux?

    use Linux :

    as Server Os

    as stand alone Os on your PC.

  • 8/8/2019 Chapter 4c Introduction to Linux

    7/22

    7

    What is Kernel?

    Kernel is the core of Linux Os

    (Operating System).

    It acts as an intermediary

    between the computerhardware and various

    programs/application/shell.

  • 8/8/2019 Chapter 4c Introduction to Linux

    8/22

    8

    What is X-Windows? X-Windows is the most common graphical interface for Linux / Unix

  • 8/8/2019 Chapter 4c Introduction to Linux

    9/22

    9

    What is Linux Shell/Console ?

    Shell is a command-lineinterface to the kernel.

    It is a user program thatprovide user interaction

    i.e. traditional userinterface.

    Shell is a commandlanguage interpreter thatexecutes commands readfrom the standard inputdevice (keyboard) or froma file.

  • 8/8/2019 Chapter 4c Introduction to Linux

    10/22

    10

    How to use Shell ?

    From X Windows, click the right hand button

    of the mouse.

    Choose: Open Terminal

    Type the shell command at the prompt

  • 8/8/2019 Chapter 4c Introduction to Linux

    11/22

    11

    What is a directory?

    Directory is group of files. It is used to

    organize your data files and programs more

    efficiently.

    It is divided into two types:

    Root directory (shown by / and have only one in

    your system)

    Sub directory (other directory under root, can be

    created and renamed by the user).

  • 8/8/2019 Chapter 4c Introduction to Linux

    12/22

    12

    Linux File

    SystemStructure

  • 8/8/2019 Chapter 4c Introduction to Linux

    13/22

    13

    Away to do things in Linux / Unix

    Commands are typed at the command prompt / console

    In Linux / Unix, everything(including commands) is case-sensitive

    Linux Basic Commands

    [prompt]$

    [kpu01@localhost ~]$ls l -a unix-tutorial

    Command PromptCommand

    (Optional) flags

    (Optional) arguments

    Note: Youre expected to know what youre doing. Many

    commands will print a message only if something went wrong.

  • 8/8/2019 Chapter 4c Introduction to Linux

    14/22

    14

    The Shell prompts

    Usually the prompts defined as:

    Username

    Host name (machine name) Name of the directory

    Example:

    [kpu01@localhost ~]$

    The Command Prompt

  • 8/8/2019 Chapter 4c Introduction to Linux

    15/22

    File Handling commands

    mkdir make directories Usage: mkdir [OPTION]DIRECTORY...

    eg. mkdir csc1100

    ls Display a listing of all the files in the current directory (called folders

    in other OS) Usage: ls [OPTION]... [FILE]...

    eg. ls, or ls -al, or ls csc1100

    The l option means to give a listing in one column.

    The a option means to show all files.

    cd changes directories

    Usage: cd [DIRECTORY] eg. cd csc1100

    cp used to copy the files cp File1 dir-name/new-filename

  • 8/8/2019 Chapter 4c Introduction to Linux

    16/22

    16

    Most commands have manyoptions

    ls la List all files, longformat

    File names starting in dot arenormally hidden

    Permissions are; Read, Write,eXecute

    Columns are owner, group,and all

    Linux Introduction

  • 8/8/2019 Chapter 4c Introduction to Linux

    17/22

    File Handling commands

    pwd print name of current working directory

    Usage: pwd

    ps report a snapshot of the current processes

    Usage: ps [OPTION] eg. ps, ps el

    cat concatenate files and print on the standard output Usage: cat [OPTION] [FILE]...

    eg. cat file1.txt file2.txt

    locate find or locate a file Usage: locate [OPTION]... FILE...

    eg. locate file1.txt

  • 8/8/2019 Chapter 4c Introduction to Linux

    18/22

    File Handling(contd...)

    rm remove files or directoriesUsage: rm [OPTION]... FILE...

    eg. rm file1.txt , rm rf some_dir

    find search for files in a directory hierarchyUsage: find [OPTION] [path] [pattern]

    eg. find file1.txt, find name file1.txt

    history prints recently used commands

    Usage: history clear - clear the screen .Usage:clear

  • 8/8/2019 Chapter 4c Introduction to Linux

    19/22

    Editor commands

    kate KDE Advanced Text EditorUsage: kate [options][file(s)]

    eg. kate file1.txt file2.txt

    vim Vi Improved, a programmers text editorUsage: vim [OPTION] [file]...

    e.g. vi hello.c e.g. vim file1.txt

    gedit A text Editor. Used to create and edit files.Usage: gedit [OPTION] [FILE]...

    eg. gedit

  • 8/8/2019 Chapter 4c Introduction to Linux

    20/22

    Example

    To create a directory named test1

    [kpu01@localhost ~]$mkdir test1

    To move to that directory

    [kpu01@localhost ~]$

    cd test1 To move up one directory level (the parent

    directory).[kpu01@localhost ~]$cd ..

    To copy the file namedcontoh1.txt

    indirectory home into directory test1 and give anew name test2.cpp

    $cp contoh1.txt test1/test2.cpp

  • 8/8/2019 Chapter 4c Introduction to Linux

    21/22

    Sources to learn commands??

    Primary man(manual) pages.

    man shows all information about the

    command

    help - shows the available options for

    that command

    Secondary Books and Internet

  • 8/8/2019 Chapter 4c Introduction to Linux

    22/22

    Self test

    1. Write a shell command to display all the filesand directories in the current directory.

    2. Write a shell command to display a long list

    of all files and directories in the currentdirectory.