You are on page 1of 180

25-Jan-09

Vinay Kumar Eadara


NOVISYS, LLC 1
Unix Fundamental s and command references
Solaris
Linux
HP-UX
AIX
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 2
Commands
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 3
uname - It shows system identification information
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 4
showrev - System information with Host ID
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 5
# pwd It shows the present working directory
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 6
Unix file types
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 7
ls - List of directories and files
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 8
ls continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 9
ls continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 10
cal - It shows calendar
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 11
date - it shows the current date
Date format :
mm dd hh mm yy . s
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 12
mkdir to create a new directory
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 13
cd - to change the directory
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 14
rmdir or rmr - to remove the directory
mv move or rename the directory or file
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 15
mv continues ( if destination directory already exists
mv moves source directory to destination directory ).
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 16
cp - It copies directories and files from one location to
another location.
cp command copies only files from one location to another
location. cp - r Can be used to copy directories.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 17
cat command is used to create or read the contents
of the files.
To append some more content with the existing file >>
can be used.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 18
file is a command which tells you the property of file or
Directory.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 19
more command displays the file contents page wise.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 20
less command displays the file content like more
command but, it has to be closed with q .
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 21
touch is the command which creates zero length files or
it puts time stamp on the file or files which are already exist.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 22
head command displays the file contents with option
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 23
tail command displays file contents like head
with - , + option.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 24
sort command displays file contents in ascending and
descending order.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 25
wc - word count command displays words, lines, chars,
bytes, memsize and all.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 26
which command shows the location of the commands,
which are set in environment variable PATH
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 27
df Disk free command shows the disk space level
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 28
clear command clears the screen
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 29
ttythe terminal command shows the pseudo terminals.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 30
echo command show the given value or shows the value
of the environment varriables.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 31
grep is the command which displays the line with the
matching pattern. It can be executed with more options.
Searches for the expression as a complete word, ignoring
those matches that are substrings of larger words.
- w
Counts the lines that contain the pattern - c
Inverts the search to display lines that do not match the
pattern
- v
Precedes each line with the relative line number in the file - n
Lists the names of files with matching lines - l
Searches for both uppercase and lowercase characters - i
Definition Option
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 32
The grep command supports several regular expression
Meta characters to further define a search pattern. This table
describes some of the regular expression meta characters.
Regular expression meta characters:
Matches all lines
ending
with pattern
pattern$ End of line
anchor
$
Matches all lines
beginning
with pattern
^pattern Beginning of
line anchor
^
Result Exampl e Purpose Metacharacter
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 33
Additional regular expression meta characters:
Matches
Lowercase
Alphanumeric
characters or
nothing at all
[a-z]* Matches the
preceding
item zero or
more times
*
Matches lines
containing a
p,followed by
Five characters,
and followed
by an n
p.....n Matches one
character
.
Result Example Purpose
Metacharacter
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 34
grep continues
Matches lines that
do not contain a
through mand
followed byattern
[^am]
attern
Matches one
character not
in the pattern
[^]
Matches lines
Containing
Patternor
pattern
[Pp]attern
Matches one
character in
the pattern
[ ]
Result Example Purpose Metacharacter
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 35
grep continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 36
grep continues .
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 37
grep continues ..
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 38
grep continues ..
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 39
grep continues .
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 40
grep continues.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 41
grep continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 42
The egrep command searches the contents of one or more files
for a pattern using extended regular expression metacharacters.
Extended regular expression metacharacters include the regular
expression metacharacters that the grep command uses, plus
some additional metacharacters.
Egrep
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 43
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 44
Matches lines
Containing the literal
character or
metacharacter it
follows
patte[r?] Matches zero
or one
character
?
Matches for either
expression
apple | orange Matches either x or
y
x | y
Matches one or more
lowercase letters
followed by ark(for
example, airpark,
bark,dark,
landmark,shark,
sparkle,trademark)
[a-z]+ark Matches one or
more of the
preceding
characters
+
Result Sample Purpose Metacharacter
Egrep
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 45
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 46
egrep Example :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 47
egrep continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 48
egrep continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 49
Pgrep The process grep command finds and displays the
process ID along with Its parent process ID.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 50
find is a command to find a file or directory in the
system globally.
FIND
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 51
find continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 52
find continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 53
find continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 54
find continues ..
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 55
w is a command which shows the particular users
Information in an elaborate manner.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 56
SU command can be used to switch over from one user to
an other user physically.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 57
who command shows a respective users information
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 58
who continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 59
id command shows users ID and primary group ID
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 60
finger command displays the user information along with
users status
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 61
Link is a command which creates link between source and
destination file. The following example shows the symbolic link.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 62
Hard Link creates link between source and destination.
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 63
Unix File permissions
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 64
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 65
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 66
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 67
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 68
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 69
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 70
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 71
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 72
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 73
Changing file permissions in symbolic mode
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 74
chmod continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 75
chmod continues in octal mode
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 76
chmod continues in octal mode
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 77
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 78
umask continues
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 79
Korn Shell
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 80
The Default korn shell variables
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 81
Customizing Korn Shell Variable
To change the shell environment from Bourn shell to
Korn shell :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 82
To change the prompt ..
To change the prompt variable
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 83
History command
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 84
alias command
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 85
Using VI Editor
Identifying the Fundamentals of vi Editor operation
Introducing the vi editor modes of operation
The command mode
The edit mode
The last line mode
Switching between the command and edit modes
Introducing the vi command
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 86
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 87
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 88
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 89
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 90
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 91
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 92
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 93
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 94
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 95
Remote Login using TELNET and RLOGIN
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 96
Using RLOGIN
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 97
File Archives
tar
- c - to create tar archive
- v - to get verbose
- f - the out put device or directory
- t - table of contents
- x - extract from the tar archive
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 98
Exampl e
To see the table of content
To create tar archive
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 99
To extract from the tar archive
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 100
Compress
To compress the tar archive
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 101
Example for compress archive
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 102
Uncompressing tar archive
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 103
gzip
To create gzip archive
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 104
To extract the tar archive by gunzip
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 105
Unix Administration
Solaris
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 106
Solaris User Administration
Each user account consists of five main components:
User name
Password
Users home directory
Users login shell
User initialization files
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 107
Before you can add user accounts to the system, you must
determine the following information for each new user:
Login name
User identification (UID) number
Group identification (GID) number
Comment
home directory
Login shell
Password aging
Managing User Accounts
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 108
The Solaris Operating Environment stores user account and group account
information in the following system files:
/etc/passwd Authorized system users have login account entries in the
/etc/passwd file.
/etc/shadow All passwords are encrypted and maintained in a separate
shadow file named
/etc/shadow.
/etc/group The /etc/group file defines the default system group accounts.
Storing User and Group Account information
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 109
root:x:0:1:Super-User:/:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
smtp:x:0:0:Mail Daemon User:/:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/
lib/uucp/uucico
listen:x:37:4:Network Admin:/usr/net/nls:
nobody:x:60001:60001:Nobody:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x Nobody:/:
The /etc/passwd file format
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 110
root:LXeoktCoMtwZN:6445::::::
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
lp:NP:6445::::::
smtp:NP:6445::::::
uucp:NP:6445::::::
nuucp:NP:6445::::::
listen:*LK*:::::::
nobody:NP:6445::::::
noaccess:NP:6445::::::
nobody4:NP:6445::::::
The /etc/shadow file format
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 111
root::0:root
other::1:
bin::2:root,bin,daemon
sys::3:root,bin,sys,adm
adm::4:root,adm,daemon
uucp::5:root,uucp
mail::6:root
tty::7:root,tty,adm
lp::8:root,lp,adm
nuucp::9:root,nuucp
staff::10:
daemon::12:root,daemon
sysadmin::14:lister,torey
nobody::60001:
noaccess::60002:
nogroup::65534:
The /etc/group file format
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 112
The following command-line tools add, modify, and delete
user accounts and group accounts on the local system:
useradd Adds a new user account
usermod Modifies a users account
userdel Deletes a users account
groupadd Adds (creates) a new group account
groupmod Modifies a group account
groupdel Deletes a group account
Command line User Account Administration
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 113
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 114
Exampl e :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 115
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 116
Exampl e :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 117
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 118
Example :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 119
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 120
Exampl e :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 121
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 122
Exampl e :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 123
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 124
Exampl e :
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 125
Solaris Package Administration
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 126
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 127
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 128
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 129
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 130
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 131
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 132
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 133
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 134
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 135
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 136
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 137
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 138
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 139
Scheduled Process Control
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 140
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 141
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 142
Viewing current process status
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 143
Re-scheduling the process
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 144
Administering the active process
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 145
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 146
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 147
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 148
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 149
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 150
Crontab for the root user
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 151
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 152
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 153
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 154
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 155
Solaris run level and Boot process
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 156
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 157
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 158
The Boot Process
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 159
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 160
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 161
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 162
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 163
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 164
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 165
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 166
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 167
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 168
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 169
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 170
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 171
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 172
Solaris syslog
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 173
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 174
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 175
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 176
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 177
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 178
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 179
25-Jan-09
Vinay Kumar Eadara
NOVISYS, LLC 180