Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
UNIX History
Typical vendor operating systems of the time were extremely large and all written in assembly language. UNIX had a relatively small amount of code written in assembly language (this is called the kernel) and the remaining code for the operating system was written in a high level language called C In UNIX because the C language was written to be used to implement an operating system rather than a traditional "input-processing-output" application, use of these sophisticated features is quite easily done from the C language without writing any assembly language
Introduction To Solaris
Solaris is the SunTM version of UNIX
The original version of UNIX, the SunOSTM (Sun Operating System) was based on BSD UNIX version 4.2 and the AT&T Bell Labs version
Basic Terms
User
Every UNIX user has a username and password
System Administrator
A super user who has authorization higher than a regular user such as defining new users in the system, deleting users directories etc.
Operating System
There are three main components of the operating system :
Kerenel
Shell File system
Kerenel
Kernel
The Kernel manages all the devices, memory and processes Controls transmission of information between the hardware and the system programs (shell)
What Is A shell
A shell is the first program UNIX runs after logging in
One of the Bourne shell versions is the Bourne Again shell (or BASH, whose program name is : bash.
The Bourne and BASH shells are similar. The advantage of BASH is that it has command editor , used to correct commands as typed with the arrow keys bash
Most of the new features added are in use by people who write shell scripts
The Korn shell also have command editor
The carets (^) Tells the C shell to repeat a command with some changes
The C shell program name is : csh Extended C shell is slightly extended, and has a command editing. The extended C shell program name is : tcsh
10
/.../tcsh
/.../ksh /.../bash
TC shell
Korn shell Bourne Again Shell
11
How To Log In
Every UNIX user has a login name and a password When entering the UNIX workstation the login prompt is automatically displayed :
SunOS 5.6
login:
talmor
Password: Last login: Mon Dec 11 08:19:34 from 10.202.0.29 Sun Microsystems Inc. > SunOS 5.6 Generic August 1997
13
Another command to log in and also to execute shell command is : rsh machine command
Use this if the machine you are on seems to be running slowly and the who command indicates that there are lots of others on the same machine
14
15
>
16
Dec 19 09:08
(10.202.0.29)
who am i
pts/1 Dec 19 09:08 (10.202.0.29)
talmor
17
logout
or exit or ctrl+d (end of input signal)
18
The command to display the UNIX version is : uname r The command to display the UNIX version and more information is : uname a
>
uname -a
19
date
To display the date and time at a different format : date date_&_ time
>
Date +%d/%m/%y
31/12/00
20
from the keyboard and you want to signal the end of the input
- the "Backspace" key, and the "Delete" key all delete the most
21
deleting those characters. The "right" arrow on your keyboard may also do the same thing
ctrl+p ctrl+n - retrieves the Previous command that you had typed in. The "up"
you to move back to the Next more recent command. The "down" arrow on your keyboard may also do the same thing
ctrl+u ctrl+z - Delete the entire line - Suspend the current command
22
Multiple Commands
; (semicolon) is used to invoke multiple commands on the same line
> who;time
talmor pts/1 Jan 0.27u 0.68s 2:33:48.24 0.0% 1 07:40 (10.202.0.29)
23
Synopsis Description
24
DESCRIPTION For each file that is a directory, ls lists the contents of the directory; for each file that is an ordinary file, ls repeats its name and any other information requested. The output is sorted alphabetically by default. When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file arguments appear before directories and their contents. There are three major listing formats. The default format for output directed to a terminal is multi-column with entries sorted down the columns. The -1 option allows sin25
Renaming a file
Listing the file content Printing a text file
26
27
Listing Files
One of the most common command is the list command : ls options
Option -a -d -F -g -i -l -R -t Action list hidden files list the name of the current directory show directories with a trailing '/' show group ownership of file in long listing print the inode number of each file long listing giving details about files and directories list all subdirectories encountered sort by time modified instead of name
28
ls
vol xfn
ls -l
4096 Nov 1 15:03 apps 4096 Nov 15 09:53 dyn 4096 Dec 4 10:32 store
29
The command to see all the information about all the files in the directory is : ls -al
> ls -al total 120 drwxrwxr-x drwxrwxrwx drwxrwxrwx drwxrwxr-x drwxrwxr-x drwxr-xr-x
6 46 21 8 10 8
Nov 5 13:01 . Nov 15 17:36 .. Dec 10 09:08 .snapshot Nov 1 15:03 apps Nov 15 09:53 dyn Dec 4 10:32 store
30
31
32
List all files in a directory with some unknown characters using wildcard : ls ??l
> ls ?a? fal sal
33
Copy Command
The command to copy files is : cp
The copy command is used to make another copy of a file : cp file1 file2 where file1 is the original file and file2 is the name of the target file. In this example both of files will be located in the same directory
34
35
36
bills -print
The dot (.) refers to the current directory The -print option is the default and if not entered the system will add it automatically
37
>
/n/gna2/vol/vol0/cad/dyn/USERS/talmor/bills /n/gna2/vol/vol0/cad/dyn/USERS/talmor/doc/mor/bills
38
3. The .rhosts file is a text file that you can create using any text editor
4. Each line of the file has the name of a remote host Followed by a space and your username on that host
39
.
linecalc.inf lineline.inf mom mor.txt billings passwd: tar.tar temp.tar tty
40
file
The command to list the contents of a file one page at a time is : more file_name
41
grep
43
cD .
44
To search a string expressed with more then one option with a line number for each line : grep -n [string] file_name1..file_nameN
> grep n [cC]d bills billings
bills:12:cd .. billings:3:Cd .
45
46
90
700 50 50
90
700 50
47
48
49
50
Deleting A File
The command to delete a file or a list of files is : rm file_name1 ..file_nameN
The command to delete a file with inquire before deleting is : rm -i file_name1 file_name2
> rm i bills billings
51
52
Renaming A File
The command to rename a file is : mv file1 file2
53
mv i file1 file2
54
Printing A File
The command to send file to printer for printing is : lpr file_name For sending other printers, the printer name should be as part of the command : lpr -Pprinter file_name
55
56
16 bills
Counter of lines
Counter of words
Counter of characters
57
Comparing Files
The simplest command comparison between two files, which tells whether two files are the same or different is : cmp file1 file2
If the content of the two files are the same, cmp command doesnt say anything If there are different, cmp command tells how far into the files it got before it found a something different
58
The command diff indicates which lines need be added (a), deleted (d) or changed (c) Lines in file1 are identified with a (<) symbol: lines in file2 with a (>) symbol
The command to compare two files ignoring differences in the case of the letters and blank spaces is : diff -iw file1 file2
59
60
61
62