81
 UNIX Training C3: Protected

198317747 Unix Training COE Academy

Embed Size (px)

DESCRIPTION

UNIX

Citation preview

  • UNIX Training

    C3: Protected

  • Welcome

    C3: Protected

  • 2008, Cognizant Technology Solutions Confidential

    Who am I?

    ABILASH KARUTHETHIL >> AB

    Electronics and Comm. Engineering

    Sun Certified System Administrator for Solaris OS Version 9

    4 years Experience in IT and Solaris

    Previously Worked for INFOSYS & EDS

    Joined CTS on Sept2010

    Associate Id : 253309

    Here for sharing the UNIX Knowledge what I learnt from my experience.

    3

  • 2008, Cognizant Technology Solutions Confidential

    May I Know you?

    Name

    Experience

    Project

    Knowledge about UNIX

    4

  • 2008, Cognizant Technology Solutions Confidential

    Course Map Day 1

    What is OS

    UNIX History and Overview

    Advantages of UNIX OS

    File System Concepts

    How to connect Unix Machine

    File Manipulation commands

    Directory Manipulation commands

    More commands related to File system

    Permission

    User Account

    5

  • 2008, Cognizant Technology Solutions Confidential

    Course Map Day 2

    Shell

    Controlling System Process

    Scheduling the Jobs

    Basic Networking

    Useful commands

    Important File Systems and Log Locations

    6

  • Day - 1

    C3: Protected

  • 2008, Cognizant Technology Solutions Confidential

    What is OS

    software that controls the execution of computer programs and may provide various services

    operating system (OS) is an interface between hardware and user, which is responsible for the management and coordination of activities and the sharing of the resources of a computer, that acts as a host for computing applications run on the machine.

    Software that controls the allocation and usage of hardware resources such as memory, CPU time, disk space, and input and output devices

    The operating system facilitates communication between the hardware (the PDA) and the software.

    8

  • 2008, Cognizant Technology Solutions Confidential

    UNIX History and Overview

    UNIX was developed by AT & T researchers namely Ken Thompson and Dennies Ritchie for internal use. Later many Unix flavor emerged named AIX from IBM, HP-UX from HP, Sun OS (Solaris) from Sun and so on.

    Finnish college student LINUS TORVALDS developed Linux in 1991. (Linus created Linux Kernal)

    9

  • 2008, Cognizant Technology Solutions Confidential

    Advantages of UNIX

    Full multitasking with protected memory. Multiple users can run multiple programs each at the same time without interfering with each other or crashing the system.

    Very efficient virtual memory, so many programs can run with a modest amount of physical memory.

    Access controls and security. All users must be authenticated by a valid account and password to use the system at all. All files are owned by particular accounts. The owner can decide whether others have read or write access to his files.

    A rich set of small commands and utilities that do specific tasks well -- not cluttered up with lots of special options.

    10

  • 2008, Cognizant Technology Solutions Confidential

    Advantages of UNIX

    Ability to string commands and utilities together in unlimited ways to

    accomplish more complicated tasks -- not limited to preconfigured combinations or menus, as in personal computer systems.

    A powerfully unified file system. Everything is a file: data, programs, and all physical devices. Entire file system appears as a single large tree of nested directories, regardless of how many different physical devices (disks) are included.

    Available on a wide variety of machines - the most truly portable operating system.

    11

  • File system Concept

    C3: Protected

  • 2008, Cognizant Technology Solutions Confidential

    File System, File & Directory

    Unix is managed by File system.

    File system - Hierarchical arrangement of files and directories

    File Collection of data items stored on the disk. It is may be raw data, Music file etc.

    Directory Contains the group of files.

    In Unix everything is a file,(including H/W, Configuration data)

    13

  • 2008, Cognizant Technology Solutions Confidential

    File System, File & Directory

    Files are grouped in the directory structure. The file-system is arranged like hierarchical tree (inverted)structure.

    The top of the tree is called root which usually contains several sub-directories. In UNIX /(forward slash) is used to present the root.

    /root

    lib bin

    Name are case-sensitive, Delimited by the / (forward slash)

    14

  • 2008, Cognizant Technology Solutions Confidential

    File Components

    File has three components

    File Name is a object must often used to access and manipulate the file

    Inode - is a object of the Unix OS used to record the information about the file

    Data block - Unit of the dsik space that are used to store the data

    Filename associated with inode and it give access to the data block

    Filename --> Inode --> Datablock

    15

  • 2008, Cognizant Technology Solutions Confidential

    File Types

    Regular File - All files are regular file. Ex : Text file, Binary file etc.

    Directory - Contains any kind of files

    Device file It is provide the access to the device. There are two types in

    device file. Block special file : communicate with h/w with block of data a time. Character file : Communicate with h/w one char a time.

    Symbolic Link It is point to another file. It contains the pathname of the

    file to which it point. The size of the file is always matches the number of the characters in the path name it contains. It can be point any file, directory or other symbolic link.

    16

  • 2008, Cognizant Technology Solutions Confidential

    Home Directory

    A Home directory is a file system directory on a multi-user operating

    system containing files for a given user of the system.

    Home directory will be created, when user created on the system

    Separating user data from system-wide data avoids redundancy

    A user will be automatically placed into their home directory upon login

    The ~ (tilde character) shorthand command refers to that particular users home directory

    Example : /export/home/shandy is the home directory of the user shandy.

    17

  • 2008, Cognizant Technology Solutions Confidential

    Pathnames

    Absolute Pathnames

    In the previous tree /users/usern/file1 is an absolute pathname.

    Relative pathnames

    If you are already in the users directory, the relative pathname for file1 is usern/file1.

    18

  • How to Connect the Unix Machine

    C3: Protected

  • 2008, Cognizant Technology Solutions Confidential

    Connect the Unix Machine

    We connect the Unix machine using putty exe, if machine is located in remote. It is open source software we can get it from internet.

    If you run the putty.exe, It will ask the details like below

    20

  • 2008, Cognizant Technology Solutions Confidential

    Connect Unix Machine

    Enter IP Address of the machine or name into the filed Host Name and select respective protocol to connect the server. Normally we choose SSH. Then click open, It will ask the login name Like below window

    21

  • 2008, Cognizant Technology Solutions Confidential

    Connect Unix Machine

    Once Login name entered, It will ask password for the user entered in the login prompt. Once you entered the password. It will logon the machine.

    22

  • File Manipulation Commands

    C3: Protected

  • 2008, Cognizant Technology Solutions Confidential

    File Manipulation Commands

    Create the file cat & vi

    Ex :

    $$ cat > hi

    Red

    Blue

    List the the file ls command

    Ex :

    $$ ls l hi

    -rw-r--r-- 1 191278 staff 9 Oct 13 02:21 hi

    $$

    24

  • 2008, Cognizant Technology Solutions Confidential

    File Manipulation Commands

    View the file cat, more, less, head, tail

    Ex :

    $$ cat hi

    Red

    Blue

    $$

    Copy the the file cp command

    Ex :

    $$ cp hi hello

    $$

    25

  • 2008, Cognizant Technology Solutions Confidential

    File Manipulation Commands

    Rename the file mv command

    Ex :

    $$ mv hi hello

    $$

    Delete the the file rm command

    Ex :

    $$ rm hi

    $$

    Modify the file vi command

    Ex :

    $$vi hi

    $$ 26

  • 2008, Cognizant Technology Solutions Confidential

    Vi Editor

    Vi : the Visual editor, Standard Linux and Unix editor

    To Create new file or opening the existing file

    $vi {option} file name

    If the file exists, the file is opened and content are displayed

    If the file doesnt exists, vi creates it when the edits are saved for the first time

    Options : -m file is not modifiable, -x encrypt file when saving and decrypt file when editing, and so on.

    Entering insert mode a append mode, i insert before cursor

    To exit insert mode, hit key

    27

  • 2008, Cognizant Technology Solutions Confidential

    Vi Editor

    Manipulation in vi editor

    +yy To copy the content of current cursor line

    +3yy To copy the content of 3 line below current cursor line

    +p To paste the single line

    +dd To delete the current cursor line

    +5dd To delete five lines

    +cc To cut current cursor line

    Saving and Exiting : ex mode

    : wq Save and quit the file

    : wq! Forcing to change and quit

    : w! Dont exit, forcible save the file

    :x Save and exit the file

    :q! Forcible exit witout save the file 28

  • Directory Manipulation Commands

    C3: Protected

  • 2008, Cognizant Technology Solutions Confidential

    Directory Manipulation Commands

    Create the Directory mkdir command

    Ex :

    $$ mkdir test

    $$

    Change the Directory cd command ( You can use both absolute and relative path name for changing the directory)

    Ex :

    $$ cd /export/home/shandy/test

    $$

    30

  • 2008, Cognizant Technology Solutions Confidential

    Directory Manipulation Commands

    Delete the Directory rmdir (if only directory is empy) & rm -f command

    Ex :

    $$ rmdir test

    $$

    $$ rm f test

    Rename the Directory mv command ( You can use both absolute and relative path name for changing the directory)

    Ex :

    $$ mv test test1

    $$

    Present work Directory pwd command

    31

  • More Commands

  • 2008, Cognizant Technology Solutions Confidential

    More Commands

    Command to check inode number for the file

    $ ls -i hi 6219 hi

    $

    6219 is a inode number

    Command to create a symbolic link

    $ ln -s hi hello

    $ ls ltr

    -rw-r--r-- 1 w142922 staff 9 Oct 13 02:21 hi

    lrwxrwxrwx 1 w142922 staff 2 Oct 14 04:06 hello -> hi

    $

    33

  • 2008, Cognizant Technology Solutions Confidential

    More Commands

    Command to check file system usage

    $ df -k / Filesystem kbytes used avail capacity Mounted on

    rtpool/ROOT/s10s_u6wos_07b

    30449664 10074647 11687398 47% /

    $ du -h /export/home/191278

    7K /export/home/191278

    $

    Command to find the file $find {condition} {action}

    $ find /export/home/191278 -name hi

    /export/home/191278/hi

    $ 34

  • 2008, Cognizant Technology Solutions Confidential

    More Commands

    Archiving the files : - Placing Many file into one target file

    Creating the tar tar cvf tar_file_name file

    Ex :

    $tar cvf shans.tar hi hello

    Inspecting the tar

    $ tar tvf shans.tar

    Above command display list of all files in the archive

    Extracting the archive

    The archive will be extracted in the current directory

    $tar xvf shans.tar

    35

  • Permission

  • 2008, Cognizant Technology Solutions Confidential

    Permissions

    There are three types of file access supported by UNIX. r read, view the contents of a file or a directory

    w write, edit file/directory contents

    x execute, run executable file

    Heres an example Suppose you type in ls -l and the result is

    - rwx r-x r-- 1 hans doc 858 Aug 22 22:28 hw1

    What do all these symbols mean? 37

  • 2008, Cognizant Technology Solutions Confidential

    Permissions

    -rwx r-x r-- 1 hans doc 858 Aug 22 22:28 hw1

    type owner

    group size Modification

    date/time

    File name

    User

    permissions

    Group

    permissions

    Other

    Permissions

    links

  • 2008, Cognizant Technology Solutions Confidential

    Permission

    User the person who created the file.

    Group the group owns the file.

    Other the rest of the world

    754 is a decimal number. But you can represent each digit with a binary number.

    4 => read permission, 2 => write permission,

    1=> execute permission

    39

  • 2008, Cognizant Technology Solutions Confidential

    Permissions

    read=4;write= 2;execute=1 rwx r-x r--

    4 + 2 + 1

    7 5 4

    4 + 0 + 1 4 + 0 + 0

  • 2008, Cognizant Technology Solutions Confidential

    Permission

    rwx r-x r-- is a symbolic way to specify file modes, while 754 is a numeric way (remember 7 111, 5 101, 4100 ? ). How would you represent this file mode numerically?

    --x --x wx

    How would you represent this bit string symbolically?

    6 1 4

    41

  • 2008, Cognizant Technology Solutions Confidential

    Permission Changing command

    chmod - command to change the access mode of a file

    Ex :

    Before :

    -rw-r--r-- 1 191278 staff 0 Oct 15 02:42 script.sh

    Run the command :

    $chmod 755 script.sh or $chmod u=rwx,g=rx,o=rx script.sh

    After :

    -rwxr-xr-x 1 191278 staff 0 Oct 15 02:42 script.sh

    42

  • 2008, Cognizant Technology Solutions Confidential

    Sticky bit Permission

    The Sticky Bit is a special permission that protects the files within a publicly writable directory.

    If the directory permissions have the Sticky Bit set, a file can be deleted only by the owner of the file, the owner of the directory, or by the root user. This prevents a user from deleting other users files from publicly writable directories.

    Use the ls command to determine if a directory has the Sticky Bit permission set.

    $ ls -ld /tmp

    drwxrwxrwt 6 root sys 719 May 31 03:30 /tmp

    The Sticky Bit displays as the letter t in the execute field for other.

    43

  • 2008, Cognizant Technology Solutions Confidential

    Umask

    The umask (UNIX shorthand for "user file-creation mode mask") is a four-digit octal number that UNIX uses to determine the file permission for newly created files

    Default umask is 022 and it is defined in /etc/profile file.

    If umask value is 022, File will be created with permission of 666-022 = 644

    If umask value is 022, Directory will be created with permission of 777 022 = 755

    44

  • User Account

  • 2008, Cognizant Technology Solutions Confidential

    User Account

    Whoever required Unix server access, they should have the user id or login id.

    Main Components of a User Account

    User name A unique name that a user enters to log in to a system.The user name is also called the login name.

    Password A combination of up to 256 letters, numbers, or special characters that a user enters with the login name to gain access to a system.

    UID number A user accounts unique numerical identification within the system.

    46

  • 2008, Cognizant Technology Solutions Confidential

    User Account

    Group identification (GID) number A unique numerical identification of the group to which the user belongs.

    Comment Information that identifies the user

    Users home directory A directory into which the user is placed after login. The directory is provided to the user to store and create

    Users login shell The users work environment is set up by the initialization files that are defined by the users login shell.

    47

  • 2008, Cognizant Technology Solutions Confidential

    System Files That Store User Account Information

    /etc/passwd - Authorized system users have login account entries

    /etc/shadow - contains the encrypted passwords.

    /etc/group - Defines the default system group entries

    Root User : has complete control over the system.

    48

  • Day-2

  • Unix Shell

  • 2008, Cognizant Technology Solutions Confidential

    Shell

    The shell is a command programming language that provides an interface to the UNIX operating system

    Unix has many shells, they are Bourne shell (sh) - This is the original Unix shell written by Steve Bourne of Bell Labs. It is

    available on all UNIX systems. This shell does not have the interactive facilites provided by modern shells such as the C shell and Korn shell.

    C shell (csh) - This shell was written at the University of California, Berkeley. It provides a C-like language with which to write shell scripts - hence its name

    TC shell (tcsh) - This shell is available in the public domain. It provides all the features of the C shell together with emacs style editing of the command line

    Korn shell (ksh) - This shell was written by David Korn of Bell labs. It is now provided as the standard shell on Unix systems. It provides all the features of the C and TC shells together with a shell programming language similar to that of the original Bourne shell. It is the most efficient shell. Consider using this as your standard interactive shell.

    Bourne Again SHell (bash) - bash provides all the interactive features of the C shell (csh) and the Korn shell (ksh). Its programming language is compatible with the Bourne shell (sh). If you use the Bourne shell (sh) for shell programming consider using bash as your complete shell environment.

    51

  • 2008, Cognizant Technology Solutions Confidential

    Unix Kernel

    A Unix kernel the core or key components of the operating system consists of many kernel subsystems like process management, memory management, file management, device management and network management.

    The kernel provides these and other basic services: separation between user and system space, system calls, scheduling, timer and clock handling,.

    As an illustration of the way that the shell and the kernel work together, suppose a user types rm myfile (which has the effect of removing the file myfile). The shell searches the file store for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the UNIX prompt % to the user, indicating that it is waiting for further commands.

    52

  • Controlling the System Process

  • 2008, Cognizant Technology Solutions Confidential

    What is the Process

    A process is any program that is running on the system.

    All processes are assigned a unique process identification (PID) number, which is used by the kernel to track and manage the process.

    The PID numbers are used by the root and regular users to identify and control their processes.

    54

  • 2008, Cognizant Technology Solutions Confidential

    Viewing System Processes

    The prstat or ps command examines and displays information about active processes on the system.

    Ex :

    # prstat

    PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP

    1641 root 4864K 4520K cpu0 59 0 0:00:00 0.5% prstat/1

    1635 root 1504K 1168K sleep 59 0 0:00:00 0.3% ksh/1

    9 root 6096K 4072K sleep 59 0 0:00:29 0.1% svc.configd/11

    566 root 82M 30M sleep 29 10 0:00:36 0.1% java/14

    1633 root 2232K 1520K sleep 59 0 0:00:00 0.1% in.rlogind/1

    531 root 8200K 2928K sleep 59 0 0:00:12 0.1% dtgreet/1

    55

  • 2008, Cognizant Technology Solutions Confidential

    The state of the process

    cpu The process is running on the CPU.

    sleep The process is waiting for an event to complete.

    run The process is in the run queue.

    zombie The process terminated, and the parent is not waiting.

    stop The process is stopped.

    56

  • 2008, Cognizant Technology Solutions Confidential

    Killing Frozen Processes

    You use the kill command or the pkill command to send a signal to one or more running processes. You would typically use these commands to kill an unwanted process.

    The format for the kill command is:

    #kill -signal PID

    The format for the pkill command is:

    #pkill -signal Process

    57

  • 2008, Cognizant Technology Solutions Confidential

    Killing Frozen Processes

    Before killing the process, we need to findout the PID for process, Using following command we can find the PID for process

    #pgrep -l mail

    241 sendmail

    240 sendmail or

    # ps -e | grep sendmail

    241 ? 0:00 sendmail

    240 ? 0:02 sendmail

    Then you can kill using processname or PID

    # pkill sendmail

    # kill 241 (Default signal 15 )

    58

  • 2008, Cognizant Technology Solutions Confidential

    Killing Frozen Processes

    To terminate more than one process at the same time, use the following

    syntax:

    # kill -signal PID PID PID PID

    # pkill signal process process

    Signal Number --- Signal Name --- Event --- efault Action

    1 --- SIGHUP --- Hangup --- Exit

    2 --- SIGINT --- Interrupt --- Exit

    9 ---SIGKILL --- Kill --- Exit

    15 --- SIGTERM --- Terminate --- Exit

    Some processes can be written to ignore Signal 15. Processes that do not respond to a Signal 15 can be terminated by force by using Signal 9 with the kill or pkill commands. You use the following syntax:

    # kill -9 PID or # pkill -9 process

    59

  • Scheduling the Jobs

  • 2008, Cognizant Technology Solutions Confidential

    Scheduling an Automatic One-Time Execution of a

    Command

    Use the at command to automatically execute a job only once at a specified time.

    The format for the at command is:

    #at -m -q queuename time date

    #at -r job

    #at l

    -m - Sends mail to the user after the job has finished

    -r job - Removes a scheduled at job from the queue

    -q queuename - Specifies a specific queue

    time - Specifies a time for the command to execute

    -l - Reports all jobs scheduled for the invoking user

    date - Specifies an optional date for the command to execute, which is either a month name followed by a day number or a day of the week

    61

  • 2008, Cognizant Technology Solutions Confidential

    Scheduling an Automatic One-Time Execution of a

    Command

    Ex :

    # at 9:00 pm

    at> find /export/home -name core -exec file {} \; >> /var/tmp/corelog

    at>

    commands will be executed using /sbin/sh

    job 1098648000.a at Mon Oct 25 21:00:00 2004

    To display information about the execution times of jobs, perform the command:

    # at -l 1098648000.a

    1098648000.a Mon Oct 25 21:00:00 2004

    For example, to remove job 1098648000.a from the at queue, perform the command:

    # at -r 1098648000.a

    62

  • 2008, Cognizant Technology Solutions Confidential

    Controlling Access to the at Command

    As the root user, you control who has access to the at command with the at.deny and at.allow files.

    The /etc/cron.d/at.deny File This file identifies users who are prohibited from using the at command

    The /etc/cron.d/at.allow File - The /etc/cron.d/at.allow file does not exist by default, so all users (except those listed in the /etc/cron.d/at.deny file) can create at jobs.

    63

  • 2008, Cognizant Technology Solutions Confidential

    Scheduling an Automatic Recurring Execution of a

    Command

    You can use the cron facility to schedule regularly recurring commands. Users can submit a command to the cron facility by modifying their crontab file.

    All crontab files are maintained in the /var/spool/cron/crontabs directory and are stored as the login name of the user that created the cron job.

    The cron daemon is responsible for scheduling and running these jobs.

    crontab File Format :

    A crontab file consists of lines of six fields each. The fields are separated by spaces or tabs. The first five fields provide the date and time the command is to be scheduled. The last field is the full path to the command.

    64

  • 2008, Cognizant Technology Solutions Confidential

    Scheduling an Automatic Recurring Execution of a

    Command

    Ex :

    10 3 * * 0 /usr/sbin/log/adm

    10 - The minute field can hold values between 0 and 59.

    3 - The hour field can hold values between 0 and 23.

    * - The day-of-month field can hold values between 1 and 31.

    * - The month field can hold values between 1 and 12, January to December.

    0 - The day-of-week field can hold values between 0 and 6. Sunday is 0.

    /usr/sbin/log/adm - The command field contains the full path name to the command to be run by the cron utility.

    65

  • 2008, Cognizant Technology Solutions Confidential

    Crontab Command

    The crontab command enables the user to view, edit, or remove a crontab file.

    Viewing a crontab File

    To view the contents of the root crontab file, run the crontab l command as the root user.

    Editing a crontab File

    To Edit the content of the crontab using crontab e command. Before executing this command you have to set the editor as vi.

    Removing a crontab File

    The correct way to remove a crontab file is to invoke the command:

    # crontab -r username

    Typical users can remove only their own crontab file. The root user candelete any users crontab file.

    66

  • 2008, Cognizant Technology Solutions Confidential

    Controlling Access to the crontab Command

    You can control access to the crontab command with two files in the /etc/cron.d directorythe cron.deny file and the cron.allow file.

    These files permit only specified users to perform crontab tasks, such as creating, editing, displaying, or removing their own crontab files.

    /etc/cron.d/cron.deny - The Solaris OS provides a default cron.deny file. The file consists of a list of user names of the users who are not allowed to use cron.

    /etc/cron.d/cron.allow - The /etc/cron.d/cron.allow file does not exist by default, so all users (except those listed in the cron.deny file) can access their crontab file. By creating a cron.allow file, you can list only those users who can access crontab commands.

    67

  • Basic Networking

  • 2008, Cognizant Technology Solutions Confidential

    ftp Commands

    The FTP (File Transfer Protocol) utility program is commonly used for copying files to and from other computers. These computers may be at the same site or at different sites thousands of miles apart. FTP is a general protocol that works on UNIX systems as well as a variety of other (non-UNIX) systems.

    To connect your local machine to the remote machine, type

    ftp machinename ( Ip address or machine name)

    It will ask user name and password for login. Once you gave those details., It will allow to access the to the system, should have access on the required machine for ftp access.

    69

  • 2008, Cognizant Technology Solutions Confidential

    ftp Commands

    ? - to request help or information about the FTP commands

    ascii - to set the mode of file transfer to ASCII

    binary - to set the mode of file transfer to binary

    bye - to exit the FTP environment (same as quit)

    cd - to change directory on the remote machine

    delete - to delete (remove) a file in the current remote directory

    get - to copy one file from the remote machine to the local machine

    lcd - to change directory on your local machine (same as UNIX cd)

    mget - to copy multiple files from the remote machine to the local

    machine; you are prompted for a y/n answer before transferring each file

    mput - to copy multiple files from the local machine to the remote machine; you are prompted for a y/n answer before transferring each file.

    put - to copy one file from the local machine to the remote machine

    70

  • Other Useful Commands

  • 2008, Cognizant Technology Solutions Confidential

    Other Commands

    grep - looks for the string in the files. Ex : grep string filname

    diff - Compare the files and shows where they differ. Ex : diff filename1 filename2

    wc - tells you how many lines, words, and characters there are in a file. Ex : wc filename

    pwd - tells you where you currently are.

    w- tells you who's logged in, and what they're doing. Especially useful: the 'idle' part. This allows you to see whether they're actually sitting there typing away at their keyboards right at the moment.

    72

  • 2008, Cognizant Technology Solutions Confidential

    Other Commands

    who --- tells you who's logged on, and where they're coming from.

    finger username - gives you lots of information about that user.

    last -1 username - tells you when the user last logged on and off and from where.

    talk username - lets you have a (typed) conversation with another user.

    write username - lets you exchange one-line messages with another user

    passwd - lets you change your password

    73

  • 2008, Cognizant Technology Solutions Confidential

    Other Commands

    Date - shows the current date and time.

    cal - shows a calendar of the current month.

    man commandname - shows you the manual page for the command.

    Hostname shows server information.

    sort used to sort content the file. Ex: sort filename. It only display output in the screen.

    tail filename display last part of the file.

    head filename display first part of the file. 74

  • 2008, Cognizant Technology Solutions Confidential

    Other Commands

    history - list previously issued commands.

    uptime - show system load, how long system has been up.

    bg - put suspended process into background.

    fg - bring process into foreground.

    jobs - list processes.

    ^z - suspend current process

    clear - clear terminal screen

    75

  • 2008, Cognizant Technology Solutions Confidential

    Other Commands

    exit - terminate a shell

    logout - sign off; end session

    man - find manual information about commands.

    psrinfo - displays information about processors.

    bc - a simple calculator

    su - username used to switch the user

    format Display the hard disk available on the system.

    76

  • 2008, Cognizant Technology Solutions Confidential

    Special commands and characters:

    Redirection

    < Routes input to command from file

    > Routes output from command to file

    >> Appends output to existing file

    | Routes output between commands

    Wildcards used in filenames

    * Matches any number of characters

    ? Matches one character

    77

  • Important File system and Log

    locations

  • 2008, Cognizant Technology Solutions Confidential

    Important File Systems

    / - Root file system contains the OS images

    /var File system contains variable data, like log etc

    /usr/bin & /usr/sbin contains the commands and executable

    /export/home Contains the user data

    /opt Contains the additional softwares

    /swap Virtual memory used for system process and programs

    /usr/lib Library files are stored

    79

  • 2008, Cognizant Technology Solutions Confidential

    Important Log Locations

    /var/adm/messages Contains all messages logged by OS.

    /var/adm/lastlog - captures or record the last user and host info that login to the server.

    /var/adm/sulog - record of all attempts by users on the system to execute the su command.

    /var/adm/loginlog - that logs unsuccessful attempts to access the system

    80

  • Thank You