Post on 16-May-2023
Training provided by Donatus Doss
Unix EnvironmentKernel
Manages devices, memory, and processesControls the functions (transmission of information)between the system programs (utilities) and the system hardwareManages swap space, daemons, file systems and other functions
Training provided by Donatus Doss
Unix EnvironmentShell
A shell is an interface between the user and the kernel;it acts as an interpreter or translator.Three shells are available in the Solaris environment:
Bourne shell ($)Korn shell ($)C shell (%)
Training provided by Donatus Doss
Unix Environment
The File SystemA hierarchy of directories, subdirectories, and files grouped together for a specific purpose.
Directory- A location for other files directoriesThe directory structure enables you to create files and directories accessed through a hierarchy of directories.Subdirectory- Any directory below another directory. For example, some of the subdirectories under the root (/) directory are /usr, /etc, and / kernel
Training provided by Donatus Doss
Unix EnvironmentMain Capabilities of the Operating System
Multitasking – Enables the kernel to keep track of several processes simultaneously
Multiuser capability- Enables more than one user to access the same system resources
Distributed processing- Enables the use of resources across the network
Unix Environment
User AccountsYou must have a user account to log in; it contains the elements which identify each unique user to the system.The user account is defined in the /etc/passwd file:
Placeholder UID Comment
User2:x:102:10:PatThompson:/home/user2:/bin/ksh
Login ID GID Login directory Default shell
Training provided by Donatus Doss
Unix Environment
Password Requirements
Must be six to eight characters in lengthShould contain at least two alphabetic characters and one numeric or special character.Must differ from the login IDMust differ from the previous password by at least three charactersMay contain spaces
Training provided by Donatus Doss
Unix Environment
Changing your PasswordChanging your password frequently helps avoid
unauthorized access
1. Type the passwd command.2. Type your current password and press Return.3. Type your new password and press Return.4. Retype the new password and press Return.
Training provided by Donatus Doss
Unix Environment
Displaying Man Pages
The UNIX Programmer’s Manual (also called man pages) describes what you need to know about the system’s on line
commands, system calls, file formats, and system maintenance.
The man command is used to display on-line man pages for Solaris commands.Command format is:
man nameman –k keywordman – s section name
Training provided by Donatus Doss
Unix EnvironmentScrolling in Man Pages
Use the following keys to control the scrolling capabilities while using the man command:
Spacebar Scroll through a manual page one screen at a time.
Return Scroll through a manual page one line at a time.
b Move back one screenf Move forward one screenq Quit the man command
/ String Search forward for informationn Find the next occurrence of stringh Give a description of all scrolling capabilities
Training provided by Donatus Doss
Unix EnvironmentPathnames
A pathname uniquely identifies a particular file or directory byspecifying its location.
The slashes within pathnames separate object names.
A slash in the first position represents the / (root) directory.
/home/user2/dir1/coffees
Root directoryDelimiters
Training provided by Donatus Doss
Unix Environment
Absolute Pathname
An absolute pathname specifies a file or directory in relation to the entire Solaris file hierarchy.
Absolute pathnames always:
Start at the root(/) directory and list each directory along the path to the destination file (or directory)
Use a slash (/) between each directory name in the path to indicate different directories
Training provided by Donatus Doss
Unix Environment
Relative Pathname
A relative pathname specifies a file in relation to the current (also called working) directory.
Relative pathnames are useful because they are shorter than absolute pathnames.
Relative pathnames do not begin with a slash.
Unix Environment
Command – Line Syntax
At the shell prompt, you can type commands-instructions that tell the system to perform an action.Typical format is:$ command [option(s)] [argument [s] ]A space must be used as a delimeter between each part of the command line.Up to 256 characters can be entered on a single command line.Many commands do not require all three parts.
Training provided by Donatus Doss
Unix Environment
Changing Directories Using the CD Command
To change directory locations, the cd command is used.
This command accepts both absolute and relative pathnames.
Command format is:cd [directory_name]
Training provided by Donatus Doss
Unix Environment
Displaying the Current Directory Using the pwd Command
Use the pwd (print working directory) command to display the absolute pathname of your current directory.
Use the command format:pwd
Training provided by Donatus Doss
Unix Environment
Using the ls Command
Displaying a listing of all files and directories within specified directories: lsUsing the command format:ls [-option(s)] [pathname [s] ]Displaying hidden files: ls –aDisplaying file types: ls –FDisplaying a long list: ls –lListing individual directories: ls –ldDisplaying a recursive listing: ls -R
Training provided by Donatus Doss
Unix EnvironmentFor Unix File System (UFS) default block size is 8k (8192 Bytes) and directory files are always multiples of 512B. mkdir dir1ls dir1This will show that the new directory created is 512 bytes.
Training provided by Donatus Doss
Unix Environment
Metacharacters
Metacharacters are keyboard characters with special meaning to the shell.
Some examples are : ; $ % ! ~ * ? [ ] |
The dot (.) and underscore (_) are not metacharacters.
Do not use metacharacters in file and directory names.
Training provided by Donatus Doss
Unix Environment
AsteriskAsterik (*) represents zero or more characters.
$ lsdante dir1 dir3 file1 file3 fruit practicedante_1 dir2 dir4 file2 file4 fruit2
$ ls d*dante dante_1dir1:Coffees fruit treesdir2:Beansnotes recipesdir3:Planetsdir4:flowers
Training provided by Donatus Doss
Unix Environment
Question MarkQuestion mark (?) represents any single character
$ lsdante dir1 dir3 file1 file3 fruit practicedante_1dir2 dir4 file2 file4 fruit2
$ ls d?dir1:coffees fruit treesdir2:beans notes recipesdir3:planetsdir4:f.lowers$
Training provided by Donatus Doss
Unix EnvironmentSemicolon
Use a semicolon to enter commands on a command lineUses the command format: command;command
$ cd; lsdante dir1 dir3 file1 file3 fruit practicedante_1 dir2 dir4 file2 file4 fruit2
$ date;cal; pwdSun Jul 18 11 :05:39 MDT 1999Displays the calendar for July 1999.Displays the current directory.
Training provided by Donatus Doss
Unix EnvironmentUsing the cat Command
Displays the contents of a text file on screen
Is often used to join two or more files into one large file
Uses the command format:
Cat filename (s)
Training provided by Donatus Doss
Unix Environment By Donatus Doss
Using the more CommandDisplays the contents of a text file on screen at a timeUses+ the command format: more filename (s)
Find next occurrence of stringn
Search forward for string/string
Quit and return to the shell promptq
Display a help menu of more featuresh
Move forward one screenf
Move back one screenb
Scroll one line at a timeReturn
Scroll to the next screenSpace bar
PurposeScrolling Keys
Training provided by Donatus Doss
Unix EnvironmentUsing the head Command
Displays the the first n lines of one or more files.
Uses the command format:head [ -n ] filename (s)
Displays first 10 lines by default
Training provided by Donatus Doss
Unix EnvironmentUsing the tail Command
Displays the the last n lines of a file.
Has the command format:
tail [ -n ] filename (s)tail [ +n ] filename (s)
Unix EnvironmentUsing the wc Command
Displays a lines, word or character count of a file
Is useful for determining file characteristics of a file
Uses the command format:wc [options] filename (s)
-l Counts lines-w Counts words-c Counts bytes-m Counts characters
Unix EnvironmentTo use the cmp command to compare files:
1. Do a long listing and compare the file sizes.
-rw-r--r-- 1 user2 edu 3528 July 6 16:19 /home/user2/cshrc
-rw-r--r-- 1 user2 edu 3528 July 6 16:19 /home/user2/ .cshrc
2. If last-changed data signifies files are the same use the cmp command.
$ cmp -/cshrc -/.cshrccshrc /home/user2/cshrc differ: char 1638, line 42
Training provided by Donatus Doss
Unix EnvironmentUsing the diff Command
Finds difference between, text files
Uses the command format:
$ diff [option] file1 file2-i ignores the case of letters-c Produces a listing of difference with context
Training provided by Donatus Doss
Unix EnvironmentFile and Directory naming Conventions
There is a maximum of 255 alphanumeric characters
Some non-alphanumeric characters, such as underscores (_), hyphens (-), and periods (.) are allowed.
Metacharacters are not recommended.
File names often contain one or more extensions; one to three characters appended to the end of a file name.
Directory names generally do not contain extensions, but there are no rules against it.
Training provided by Donatus Doss
Unix EnvironmentCreating Files
The touch command is used to create new, empty files or to update access and modification times.
The command format is:Touch filename (s)
Creating Empty Files$ cd -/ practice$ touch mailbox project research$ lsmail box project research
Training provided by Donatus Doss
Unix Environment
Creating and Appending Using the tee CommandThe tee command can create a new file and add content.
You can create a file containing names and phone numbers.
$ tee phone_list.txtJohn F. – 808-555-4872John F. – 808-555-4872Fred W. – 808-555-6345Fred W. – 808-555-6345
The –a option for the tee command allows you to append to a file’s current contents without overwriting the current contents.
Unix EnvironmentCreating Directories
The mkdir command is used to create directories.
Directories can be created using either an absolute or a relative pathname.
You can specify more than one directory name on the same line to create more than one new directory.
You must have the appropriate permissions to create directory.
The command format is:
mkdir [-p] directory_name
Training provided by Donatus Doss
Unix Environment
Copying Files
Use the cp command to copy files.
Use the command format:
cp [-i] source_file destination_filecp [-i] source_file (s) destination_directory
Training provided by Donatus Doss
Unix Environment
Copying Directories
Use the cp -r (recursive) command to copy a directory its contents to another directory.
Use the command format:
cp -r[i] source_file destination (s) destination_directory
Remember files and subdirectories are not copied without the –r option.
Training provided by Donatus Doss
Unix Environment
Moving and Renaming FilesUse the mv command to move or rename files and directories.Use the command format:
mv [-i] source target_filemv [-i] source target_directory
Training provided by Donatus Doss
Unix Environment
Removing FilesUse the rm command to remove files.
Use the command format:
rm [-i] filename (s)
Training provided by Donatus Doss
Unix Environment
Redirection
All central processing unit (CPU) operations have input and /or output (I/O).
Input – Sending data to a commandOutput – Receiving data from a commandError – Errors generated by a command
• The Solaris computing environment enables command I/O to be controlled using redirection.
Training provided by Donatus Doss
Unix Environment
Piping
Takes the output of one command and passes it as input into a following command
Enables you to build a miniature program
Requires a command on each side of a pipe
Use tee to produce output to a file in the middle of a pipe line.
Training provided by Donatus Doss
Unix Environment
Security Overview
The primary function of a system’s security feature is to deny access to unauthorized users.
Standard Solaris environment security features include
User passwordsFile and directory protection with permissionsFiles that control remote logins and commands on individual workstations.Other features that enable system administrators to check for security breaches.
Training provided by Donatus Doss
Unix Environment
Permissions
The Solaris operating system has two default levels of security.
Users must supply a login ID and password in order to access a Sun workstation.
Files and directories are automatically protected by permissions when they are created.
Unix Environment
Permission Categories
File type- An ordinary file is represented by a dash (-) and a directory is represented by a d.
User (Owner)- indicated by the next three characters, which show the type of access the owner of the file or directory has. When you create a new file or directory, it is owned by you.
Group – The second set of three characters, which identify the permissions of the group that owns the file.
Other (public)- The last set of three characters, which identify the permissions everyone else has.
Training provided by Donatus Doss
Unix Environment
How File and Directory Access Is Determined
All files and directories have a user identifier (UID) and groupidentifier (GID), which identify ownership of files.
$ ls –andrwxr-xr-x 2 101 10 512 May 24 17:25 mickey-rw-r--r-- 1 101 10 0 May 24 17:25 . Profile
Every system process also has a UID and GID, which are compared to the file’s or directory’s UID, then GID.
Training provided by Donatus Doss
Unix Environment
Default PermissionsWhen a user accesses the system, files and directories are protected by default permissions.
$ mkdir secure; touch pluto$ ls –ldrwxr-xr-x 2 user2 staff 512 May 24 17:25 secure-rw-r--r-- 1 user2 staff 0 May 24 17:25 pluto
Training provided by Donatus Doss
Unix Environment
Types of PermissionsEvery file or directory has a set of permissions that determines who can do what with it.
Access to the directory is controlled
File can be executed (shell scripts or executables only)
xExecute
Files can be added or deleted
File contents can be modifiedwWrite
Contents can be listed with the ls command
File can be displayed or copiedrRead
DirectoryPlan FilePermission Symbol
Permission
Training provided by Donatus Doss
Unix Environment
Changing Permissions
The two modes of changing permissions with the chmodcommand are.
Symbolic mode uses combinations of letters and symbols.
Octal mode uses octal numbers.
Training provided by Donatus Doss
Unix Environment
Octal (Absolute) Mode
Octal mode is based on the base eight numbering system (0-7 are the available numerals).
Command format is:
chmod octal_mode filename