Вы находитесь на странице: 1из 30

Linux Operation

The History

First UNIX

Late 1960s, Bell Laboratories


First version UNIX-Assembly language
Later version UNIX-C language

Solaris

Developed by students from Stanford and Berkeley


Transformed BSD with Useful Innovations
Focus on HARDWARE-SPARC,UltraSPARC
Lower speed CPU, better performance than Intel

Destroyed the traditional C/S market


Graphics instead of dumb terminals

Components of Unix System

Applications
Shells
Kernel
Hierarchical File system

Processes

What is UNIX

Not Easily Defined

Core Kernel

User Interface to the Kernel

Hierarchical File System

Manage core system operations


I/O
Allocate resources

Shell

Instantiated by Different Vendors


Non-Standard

Relative and Absolute file path naming


Mounted locally or Remotely

Processes

Processes-based system

What is UNIX

Multi-user

More than one user can execute a shell and


application concurrently
Each user can execute application in a single shell

Multi-process

Each application can create and remove processes

Recent Solaris Innovations

StarOffice

PC Support

Solaris was co released for both SPARC and Intel


80x86

IPv6

A complete office productivity suite


Free of Charge now

Replacement IP protocol for IPv4

Clustering Technology

Mirror partitions

Shells

User accesses Solaris by either

Shell (CUI)

CUI (Character user interface) or


GUI (Graphic user interface)
1.Used to search for, modify, and replace configuration
files
2.Has many built-in commands that mirror those in C
3.Launch applications, especially for remote user
4.Execute commands for which no equivalent GUI
application exists
Necessary to be familiar with Shells and CUI

Shells Available

Bourne shell (sh) C shell (csh)


Korn shell (ksh) Cornell shell (tcsh)
Bourne Again shell (bash)

File system
File System
Main data persistence mechanism employed by Solaris.
Built on disk slices (or partitions) to store system and user data.
FileSystem

KBytes Used avail Capacity Mouted on

/dev/dsk/c0t0d0s0 1854999 296670 1502680 17% /


/dev/dsk/c0t0d0s4 1530359 884611 584534 61% /usr
/proc
0
0
0 0% /proc
fd
0
0
0 0% /dev/fd
mnttab
0
0
0 0% /etc/mnttab
/dev/dsk/c0t0d0s3 494235 187314 257498 43% /var
swap
1025984
8 1025976 1% /var/run
swap
1038800 12824 1025976 2% /tmp
/dev/dsk/c0t0d0s5 494235 2133 442679 1% /opt
/dev/dsk/c0t0d0s6 8678345 4581127 4010435 54% /oracleapp
/dev/dsk/c0t0d0s7 3224135 1935493 1224160 62% /export/home

File System

fsck

Reasons

1.Checking and repair program for inconsistencies


occur on Solaris
2.Executed by superuser: root
1.Switch off Solaris like MS-DOS
2.Halting system without synchronizing disk data
3.Defective hardware

Operation

run fsck during boot period


#init 1
#fsck -y

Users

Purposes for creating users:

Adding Users

1.Spawning a shell
2.Executing applications interactively
3.Scheduling applications to run on specific times
4.Accessing database applications and other services
login as root
#useradd [u uid] g gid d home_dir m [-s
path_shell]
[c comment] login_name

Example

#useradd g dba d /export/home/oracle m c Oracle


User oracle

Users

Modify password

Delete Users

#passwd username
#userdel [-r] oracle
-r Delete all relevant dir and record in system

Display all user information

#cat /etc/passwd

Groups

Create a new group

Delete group

#groupdel group_name

Display current user and group

#groupadd g gid group_name

bash$ id
bash$ uid=101(omc) gid=102(omc)

Managing users and groups with admintool


(console)

#admintool

Files, Directories
ls -al
list all elements with full details
Example:
-rwxr-xr-x 1 oracle dba 10 2 19 11:03 root.sh.old
Bit1:
d the entry is a directory;
l the entry is a symbolic link;
-the entry is an ordinary file;
Bit2-4 permission for current user
Bit5-7 permission for users of current group except for current
user
Bit8-10 permission for users of other groups

Files, Directories
Modify Permissions
#chmod u+x lmfcfg.ini
#chmod g+x lmfcfg.ini
#chmod o+x lmfcfg.ini
#chmod oug-w lmfcfg.ini
Modify Permission (Octal file permissions)
#chmod 755 lmfcfg.ini
#chmod 551 lmfcfg.ini

Useful commands
chown
#chown omc file_name
#chown oracle file_name
chgrp
#chgrp dba file_name
df
display file system
#df k

Useful Commands
cd
changes the current working directory to a new directory
location. Both absolute and relative terms are available.

cd bin
cd /bin
cd ..
cd ../..
cd

Useful Commands
date
Prints the current system date and time.
#date
Cal
Prints the current calendar
#cal 4 2004 //print Apr 2004
#cal 2004
//print 2004

Useful Commands
grep
Searches a file for a string and prints the line wherever
a match is found
#grep string filename
Example:
bash-2.03$ grep MNo syscfg.ini
# Machine Number(MNo), its value should be
between 128 and 139.
MNo
= 129

Useful Commands
mkdir

Makes new directory entries.


#mkdir directory
#mkdir dir1 dir2 dir3
#mkdir /directory
rm
Remove files or directory
#rm *.*
#rm r dir
rmdir
Remove dirctories without child-files
#rmdir directory_name

Useful Commands
pwd
Prints the current working directory in absolute terms
#pwd
/export/home/omc/conf

Useful commands- Editor


cat
The cat utility reads each file in sequence and writes it on the
standard output. Thus:
example% cat file
prints file on your terminal, and:
example% cat file1 file2 >file3
concatenates file1 and file2, and writes the results in
file3.

Useful commands- Editor


more
The more utility is a filter that displays the contents of
a text file on
the terminal, one screenful at a time. It normally pauses after each
screenful.
tail
The tail utility copies the named file to the standard output
beginning at a designated place. If no file is named.
#tail f ftp.log

Useful commands- Editor


vi
display-oriented text editor based on an underlying line editor
ex.
Give examples

Useful commands
compress/uncompress (.Z files)
compress/uncompress Z files
#uncompress file.Z
tar
add/extract files into/from archive files
#tar xvf archive.tar //extract
#tar cvf dir1 file1 file2 //add to archive file
su
change to another user
#su omc

Useful commands
Display the current user
#who am I
#id
#who

Useful commands
ps
The ps command prints information about active processes.
bash-2.03$ ps
PID TTY
TIME CMD
4676 pts/9 0:00 sh
4681 pts/9 0:00 bash
#ps ef|grep omc //Print all process with string omc
kill
kill processes
#kill -9 PID

Reboot and shutdown


Reboot system
#reboot
or
#/usr/sbin/shutdown -y -g 0 -i 6
Powering down
#poweroff
or
#/usr/sbin/shutdown i 5 g 60 System will be
powered off for maintenance .LOGOUT NOW!

Modify IP Address
Modify
/etc/hosts
/etc/defaultrouter
/etc/netmasks

Sources for Additional Infomation


Sun Documentation/Sun Sites
http://docs.sun.com
Websites
http://www.sunhelp.org
http://www.sunfreeware.com
Mailing List
ftp://ftp.cs.toronto.edu/pub/jdd/sun-managers/faq

Вам также может понравиться