SlideShare a Scribd company logo
Unix Fundamentals and command references



        Solaris

              Linux

                      HP-UX

                          AIX
Commands
uname - It shows system identification information
showrev - System information with Host ID
# pwd – It shows the present working directory
Unix file types
ls - List of directories and files
ls continues
ls continues …
cal - It shows calendar
date - it shows the current date




Date format :
       mm dd hh mm yy . s
mkdir – to create a new directory
cd - to change the directory
rmdir or rm –r - to remove the directory




mv – move or rename the directory or file
mv continues … ( if destination directory already exists
“ mv “ moves source directory to destination directory ).
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.
“ 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.
“ file “ is a command which tells you the property of file or
Directory.
“ more “ command displays the file contents page wise.
“ less “ command displays the file content like “ more “
command but, it has to be closed with “ q “.
“ touch “ is the command which creates zero length files or
it puts time stamp on the file or files which are already exist.
“ head “ command displays the file contents with “ – “option
“ tail “ command displays file contents like “ head “
with “ - , + “ option.
“ sort “ command displays file contents in ascending and
descending order.
“ wc - word count “ command displays words, lines, chars,
bytes, mem size and all.
“ which “ command shows the location of the commands,
 which are set in environment variable “ PATH “
“ df – Disk free “ command shows the disk space level
“ clear “ command clears the screen
“ tty “ the terminal command shows the pseudo terminals.
“ echo “ command show the given value or shows the value
of the environment varriables.
“ grep “ is the command which displays the line with the
matching pattern. It can be executed with more options.

Option                                 Definition
   -i      Searches for both uppercase and lowercase characters


   -l      Lists the names of files with matching lines


   -n      Precedes each line with the relative line number in the file


   -v      Inverts the search to display lines that do not match the
           pattern
   -c      Counts the lines that contain the pattern


   -w      Searches for the expression as a complete word, ignoring
           those matches that are substrings of larger words.
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:

Metacharacter      Purpose           Example            Result


     ^            Beginning of       ’^pattern’   Matches all lines
                  line anchor                     beginning
                                                  with “pattern”


     $             End of line       ’pattern$’   Matches all lines
                    anchor                        ending
                                                  with “pattern”
Additional regular expression meta characters:
Metacharacter   Purpose         Example            Result

                Matches one     ’p.....n’          Matches lines
      .
                character                          containing a
                                                   “p,” followed by
                                                   Five characters,
                                                   and followed
                                                   by an “n”

                Matches the     ’[a-z]*’           Matches
      *
                preceding                          Lowercase
                item zero or                       Alphanumeric
                more times                         characters or
                                                   nothing at all
“ grep “ continues …

Metacharacter      Purpose          Example        Result

                   Matches one                     Matches lines
                   character in     ’[Pp]attern’   Containing
       []                                          “Pattern” or
                   the pattern
                                                   “pattern”


                   Matches one                     Matches lines that
                   character not                   do not contain “a”
       [^]                          ’[^am]
                   in the pattern                  through “m” and
                                    attern’        followed by“attern”
“ grep “ continues …
“ grep “ continues ….
“ grep “ continues ..
“ grep “ continues ..
“ grep “ continues ….
“ grep “ continues….
“ grep “ continues …
Egrep



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
    Metacharacter         Purpose                 Sample             Result


+                   Matches one or        ’[a-z]+ark’        Matches one or more
                    more of the                              lowercase letters
                    preceding                                followed by “ark” (for
                    characters                               example, “airpark,”
                                                             “bark,” “dark,”
                                                             “landmark,” “shark,”
                                                             “sparkle,” “trademark”)

?                   Matches zero          ‘patte[r?]’        Matches lines
                    or one                                   Containing the literal
                    character                                character or
                                                             metacharacter it
                                                             follows

x|y                 Matches either x or   ’apple | orange’   Matches for either
                    y                                        expression
“ egrep Example :
“ egrep “ continues…
“ egrep continues …
Pgrep   The “ process grep “ command finds and displays the
        process ID along with It’s parent process ID.
FIND

“ find “ is a command to find a file or directory in the
system globally.
“ find “ continues …
“ find “ continues …
“ find “ continues …
“ find “ continues ..
“ w “ is a command which shows the particular user’s
Information in an elaborate manner.
“ SU “ command can be used to switch over from one user to
an other user physically.
“ who “ command shows a respective user’s information
“ who “ continues …
“ id “ command shows user’s ID and primary group ID
“ finger “ command displays the user information along with
user’s status
“ Link “ is a command which creates link between source and
destination file. The following example shows the symbolic link.
“ Hard Link “ creates link between source and destination.
Unix File permissions
Unix commands
Unix commands
Unix commands
Unix commands
Unix commands
Unix commands
Changing file permissions in symbolic mode
“ chmod “ continues …
“ chmod “ continues in octal mode …
“ chmod “ continues in octal mode…
Unix commands
“ umask “ continues …
Korn Shell
The Default korn shell variables
Customizing Korn Shell Variable




To change the shell environment from Bourn shell to
Korn shell :
To change the prompt ..




 To change the prompt variable…
“ History command …
“ alias command …”
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
Unix commands
Unix commands
Unix commands
Unix commands
Unix commands
Unix commands
Unix commands
Unix commands
Unix commands
Remote Login using TELNET and RLOGIN
Using RLOGIN …
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
To create tar archive          Example




 To see the table of content
To extract from the tar archive
Compress
To compress the tar archive
Example for compress archive
Uncompressing tar archive
gzip

       To create gzip archive
To extract the tar archive by gunzip
Unix Administration




     Solaris
Solaris User Administration

Each user account consists of five main components:

• User name

• Password

• User’s home directory

• User’s login shell

• User initialization files
Managing User Accounts
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
Storing User and Group Account information

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.
The “ /etc/passwd “ file format

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/shadow “ file format


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/group “ file format
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:
Command line User Account Administration


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 user’s account

• userdel – Deletes a user’s account

• groupadd – Adds (creates) a new group account

• groupmod – Modifies a group account

• groupdel – Deletes a group account
Unix commands
Example :
Unix commands
Example :
Unix commands
Example :
Unix commands
Example :
Unix commands
Example :
Unix commands
Example :
Scheduled Process Control
Unix commands
Unix commands
Viewing current process status
Re-scheduling the process
Administering the active process
Unix commands
Unix commands

More Related Content

PPT
Regular Expressions in PHP, MySQL by programmerblog.net
PPT
Regular Expressions grep and egrep
PDF
Ruby quick ref
PPT
101 3.7 search text files using regular expressions
PPT
Php String And Regular Expressions
PPT
3.7 search text files using regular expressions
PDF
ruby1_6up
PDF
Playfulness at Work
Regular Expressions in PHP, MySQL by programmerblog.net
Regular Expressions grep and egrep
Ruby quick ref
101 3.7 search text files using regular expressions
Php String And Regular Expressions
3.7 search text files using regular expressions
ruby1_6up
Playfulness at Work

What's hot (20)

PPTX
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
PPT
Spsl II unit
PPTX
Regular Expressions in PHP
PPT
String & its application
DOCX
Awk programming
PDF
Write Your Own JVM Compiler
PDF
3 character strings and formatted input output
PDF
Thnad's Revenge
DOCX
15 practical grep command examples in linux
PDF
JRuby, Not Just For Hard-Headed Pragmatists Anymore
PPTX
Grep - A powerful search utility
PPTX
Python advanced 2. regular expression in python
PDF
Regular expressions
KEY
Your Own Metric System
PPTX
String variable in php
ODP
Python slide.1
DOC
php&mysql with Ethical Hacking
PPT
Perl 101 - The Basics of Perl Programming
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Spsl II unit
Regular Expressions in PHP
String & its application
Awk programming
Write Your Own JVM Compiler
3 character strings and formatted input output
Thnad's Revenge
15 practical grep command examples in linux
JRuby, Not Just For Hard-Headed Pragmatists Anymore
Grep - A powerful search utility
Python advanced 2. regular expression in python
Regular expressions
Your Own Metric System
String variable in php
Python slide.1
php&mysql with Ethical Hacking
Perl 101 - The Basics of Perl Programming
Ad

Viewers also liked (13)

PPT
Basic system administration tasks
PDF
Basic solaris 10 system administration commands
PPTX
Unix Linux Commands Presentation 2013
PPTX
Linux process management
PDF
Sun solaris administration
PDF
Solaris basics
PPTX
Solaris vs Linux
ODP
Linux commands
PPTX
Linux commands
PPTX
Process management in linux
PPT
Basic command ppt
ODP
Linux Introduction (Commands)
PPT
Linux command ppt
Basic system administration tasks
Basic solaris 10 system administration commands
Unix Linux Commands Presentation 2013
Linux process management
Sun solaris administration
Solaris basics
Solaris vs Linux
Linux commands
Linux commands
Process management in linux
Basic command ppt
Linux Introduction (Commands)
Linux command ppt
Ad

Similar to Unix commands (20)

PDF
Course 102: Lecture 13: Regular Expressions
PDF
Unix
PDF
Unix
PDF
Basic commands
PDF
Basic linux commands
PDF
15 practical grep command examples in linux : unix
PPSX
Awk essentials
PPT
101 3.7 search text files using regular expressions
PPT
L5_regular expression command for linux unix
PPTX
Chapter 3: Introduction to Regular Expression
PPT
grep and egrep linux presentation for lecture
PDF
Lecture 18 - Regular Expressions.pdf
PPT
Regex Intro
KEY
Andrei's Regex Clinic
PPT
Perl Intro 5 Regex Matches And Substitutions
PDF
Unix reference sheet
PDF
Find and Locate: Two Commands
PDF
Unix commands
PPTX
Using Regular Expressions in Grep
Course 102: Lecture 13: Regular Expressions
Unix
Unix
Basic commands
Basic linux commands
15 practical grep command examples in linux : unix
Awk essentials
101 3.7 search text files using regular expressions
L5_regular expression command for linux unix
Chapter 3: Introduction to Regular Expression
grep and egrep linux presentation for lecture
Lecture 18 - Regular Expressions.pdf
Regex Intro
Andrei's Regex Clinic
Perl Intro 5 Regex Matches And Substitutions
Unix reference sheet
Find and Locate: Two Commands
Unix commands
Using Regular Expressions in Grep

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
KodekX | Application Modernization Development
PPTX
Spectroscopy.pptx food analysis technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Electronic commerce courselecture one. Pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Diabetes mellitus diagnosis method based random forest with bat algorithm
The AUB Centre for AI in Media Proposal.docx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Reach Out and Touch Someone: Haptics and Empathic Computing
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
MIND Revenue Release Quarter 2 2025 Press Release
KodekX | Application Modernization Development
Spectroscopy.pptx food analysis technology
Spectral efficient network and resource selection model in 5G networks
Chapter 3 Spatial Domain Image Processing.pdf
cuic standard and advanced reporting.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
The Rise and Fall of 3GPP – Time for a Sabbatical?
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Electronic commerce courselecture one. Pdf

Unix commands

  • 1. Unix Fundamentals and command references Solaris Linux HP-UX AIX
  • 3. uname - It shows system identification information
  • 4. showrev - System information with Host ID
  • 5. # pwd – It shows the present working directory
  • 7. ls - List of directories and files
  • 10. cal - It shows calendar
  • 11. date - it shows the current date Date format : mm dd hh mm yy . s
  • 12. mkdir – to create a new directory
  • 13. cd - to change the directory
  • 14. rmdir or rm –r - to remove the directory mv – move or rename the directory or file
  • 15. mv continues … ( if destination directory already exists “ mv “ moves source directory to destination directory ).
  • 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.
  • 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.
  • 18. “ file “ is a command which tells you the property of file or Directory.
  • 19. “ more “ command displays the file contents page wise.
  • 20. “ less “ command displays the file content like “ more “ command but, it has to be closed with “ q “.
  • 21. “ touch “ is the command which creates zero length files or it puts time stamp on the file or files which are already exist.
  • 22. “ head “ command displays the file contents with “ – “option
  • 23. “ tail “ command displays file contents like “ head “ with “ - , + “ option.
  • 24. “ sort “ command displays file contents in ascending and descending order.
  • 25. “ wc - word count “ command displays words, lines, chars, bytes, mem size and all.
  • 26. “ which “ command shows the location of the commands, which are set in environment variable “ PATH “
  • 27. “ df – Disk free “ command shows the disk space level
  • 28. “ clear “ command clears the screen
  • 29. “ tty “ the terminal command shows the pseudo terminals.
  • 30. “ echo “ command show the given value or shows the value of the environment varriables.
  • 31. “ grep “ is the command which displays the line with the matching pattern. It can be executed with more options. Option Definition -i Searches for both uppercase and lowercase characters -l Lists the names of files with matching lines -n Precedes each line with the relative line number in the file -v Inverts the search to display lines that do not match the pattern -c Counts the lines that contain the pattern -w Searches for the expression as a complete word, ignoring those matches that are substrings of larger words.
  • 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: Metacharacter Purpose Example Result ^ Beginning of ’^pattern’ Matches all lines line anchor beginning with “pattern” $ End of line ’pattern$’ Matches all lines anchor ending with “pattern”
  • 33. Additional regular expression meta characters: Metacharacter Purpose Example Result Matches one ’p.....n’ Matches lines . character containing a “p,” followed by Five characters, and followed by an “n” Matches the ’[a-z]*’ Matches * preceding Lowercase item zero or Alphanumeric more times characters or nothing at all
  • 34. “ grep “ continues … Metacharacter Purpose Example Result Matches one Matches lines character in ’[Pp]attern’ Containing [] “Pattern” or the pattern “pattern” Matches one Matches lines that character not do not contain “a” [^] ’[^am] in the pattern through “m” and attern’ followed by“attern”
  • 35. “ grep “ continues …
  • 36. “ grep “ continues ….
  • 37. “ grep “ continues ..
  • 38. “ grep “ continues ..
  • 39. “ grep “ continues ….
  • 40. “ grep “ continues….
  • 41. “ grep “ continues …
  • 42. Egrep 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.
  • 43. Egrep Metacharacter Purpose Sample Result + Matches one or ’[a-z]+ark’ Matches one or more more of the lowercase letters preceding followed by “ark” (for characters example, “airpark,” “bark,” “dark,” “landmark,” “shark,” “sparkle,” “trademark”) ? Matches zero ‘patte[r?]’ Matches lines or one Containing the literal character character or metacharacter it follows x|y Matches either x or ’apple | orange’ Matches for either y expression
  • 45. “ egrep “ continues…
  • 47. Pgrep The “ process grep “ command finds and displays the process ID along with It’s parent process ID.
  • 48. FIND “ find “ is a command to find a file or directory in the system globally.
  • 49. “ find “ continues …
  • 50. “ find “ continues …
  • 51. “ find “ continues …
  • 52. “ find “ continues ..
  • 53. “ w “ is a command which shows the particular user’s Information in an elaborate manner.
  • 54. “ SU “ command can be used to switch over from one user to an other user physically.
  • 55. “ who “ command shows a respective user’s information
  • 56. “ who “ continues …
  • 57. “ id “ command shows user’s ID and primary group ID
  • 58. “ finger “ command displays the user information along with user’s status
  • 59. “ Link “ is a command which creates link between source and destination file. The following example shows the symbolic link.
  • 60. “ Hard Link “ creates link between source and destination.
  • 68. Changing file permissions in symbolic mode
  • 69. “ chmod “ continues …
  • 70. “ chmod “ continues in octal mode …
  • 71. “ chmod “ continues in octal mode…
  • 73. “ umask “ continues …
  • 75. The Default korn shell variables
  • 76. Customizing Korn Shell Variable To change the shell environment from Bourn shell to Korn shell :
  • 77. To change the prompt .. To change the prompt variable…
  • 80. 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
  • 90. Remote Login using TELNET and RLOGIN
  • 92. 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
  • 93. To create tar archive Example To see the table of content
  • 94. To extract from the tar archive
  • 98. gzip To create gzip archive
  • 99. To extract the tar archive by gunzip
  • 101. Solaris User Administration Each user account consists of five main components: • User name • Password • User’s home directory • User’s login shell • User initialization files
  • 102. Managing User Accounts 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
  • 103. Storing User and Group Account information 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.
  • 104. The “ /etc/passwd “ file format 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:/:
  • 105. The “ /etc/shadow “ file format 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::::::
  • 106. The “ /etc/group “ file format 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:
  • 107. Command line User Account Administration 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 user’s account • userdel – Deletes a user’s account • groupadd – Adds (creates) a new group account • groupmod – Modifies a group account • groupdel – Deletes a group account