Unix commands
Upcoming SlideShare
Loading in...5

Unix commands






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Thank you that was very helpful.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Unix commands Unix commands Presentation Transcript

  • 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 dateDate 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 directorymv – 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 toanother 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 contentsof 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 orDirectory.
  • “ 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 orit 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 anddescending 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 valueof the environment varriables.
  • “ grep “ is the command which displays the line with thematching 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 expressionMeta characters to further define a search pattern. This tabledescribes 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 …
  • EgrepThe egrep command searches the contents of one or more filesfor a pattern using extended regular expression metacharacters.Extended regular expression metacharacters include the regularexpression metacharacters that the grep command uses, plussome 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 followsx|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 thesystem globally.
  • “ find “ continues …
  • “ find “ continues …
  • “ find “ continues …
  • “ find “ continues ..
  • “ w “ is a command which shows the particular user’sInformation in an elaborate manner.
  • “ SU “ command can be used to switch over from one user toan 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 withuser’s status
  • “ Link “ is a command which creates link between source anddestination file. The following example shows the symbolic link.
  • “ Hard Link “ creates link between source and destination.
  • Unix File permissions
  • Changing file permissions in symbolic mode
  • “ chmod “ continues …
  • “ chmod “ continues in octal mode …
  • “ chmod “ continues in octal mode…
  • “ umask “ continues …
  • Korn Shell
  • The Default korn shell variables
  • Customizing Korn Shell VariableTo change the shell environment from Bourn shell toKorn shell :
  • To change the prompt .. To change the prompt variable…
  • “ History command …
  • “ alias command …”
  • Using VI EditorIdentifying 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
  • Remote Login using TELNET and RLOGIN
  • Using RLOGIN …
  • File Archivestar -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
  • CompressTo 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 AdministrationEach user account consists of five main components:• User name• Password• User’s home directory• User’s login shell• User initialization files
  • Managing User AccountsBefore you can add user accounts to the system, you mustdetermine 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 informationThe Solaris Operating Environment stores user account and group accountinformation 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 separateshadow file named/etc/shadow.• /etc/group – The /etc/group file defines the default system group accounts.
  • The “ /etc/passwd “ file formatroot:x:0:1:Super-User:/:/sbin/shdaemon: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/uucicolisten: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 formatroot: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 formatroot::0:rootother::1:bin::2:root,bin,daemonsys::3:root,bin,sys,admadm::4:root,adm,daemonuucp::5:root,uucpmail::6:roottty::7:root,tty,admlp::8:root,lp,admnuucp::9:root,nuucpstaff::10:daemon::12:root,daemonsysadmin::14:lister,toreynobody::60001:noaccess::60002:nogroup::65534:
  • Command line User Account AdministrationThe following command-line tools add, modify, and deleteuser 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
  • Example :
  • Example :
  • Example :
  • Example :
  • Example :
  • Example :
  • Scheduled Process Control
  • Viewing current process status
  • Re-scheduling the process
  • Administering the active process