About Me

The best place to start learning Oracle, Linux/Unix scripting, and Oracle administration skills. Currently, as Oracle DBA with 11g/10g/9i OCP certified, I want to help you with my background and knowledge. Hopefully, this info would help you as a job aid.

Saturday, November 5, 2011

Quick Unix Tutorial

Quick Unix Tutorial

Examples of Basic Commands



 Action 


 Command 


 Examples 
appent to file cat >> cat >> file1
combine 2 files cat cat file1 file2 > file3
copy files cp cp myfile copymyfile
create a file cat cat > newfile
edit files vi vi file
list files ls ls bin/
move a file mv mv file1 doc/chapter1
remove a file rm rm unwantedfile
rename a file mv mv oldfilename newfilename
view files cat
pg
more
less
view
cat file
pg file2 file3
view file6 file7


 Directories 


 Command 


 Examples 
change to another directory cd cd example/first/
create a directory mkdir mkdir example1
find out where you are pwd pwd
go to your home directory cd cd
remove an emplty eirectory rmdir rmdir junk
Redirection of Output or Input
>
   redirects the output of a command to a file
>>  redircts the output of a command to the end of an existing file
<    takes the input of a command form a file, not the terminal

Summary of Basic Commands

  • apropos  locate commands by keyword lookup
  • arch  display the architecture of the current host
  • cal  display a calendar
    cal [month] year
    • month   number between 1 and 12
    • year      number between 1 and 9999
    Examples:
    cal 1996      print calendar for year 1996
    cal 1 1997   print calendar for January 1997
  • cancel  send/cancel requests to an LP print service
  • cat  concatenate and display files (To view files, create files, append to files and combine files)
    cat [options] [files]
    Examples:
    cat files                read file(s)
    cat > file              create file (reads form terminal; terminate input with ^D)
    cat >> file            append to file (reads form terminal; terminate input with ^D)
    cat file2 >> file1   appends contents of file2 to file1
  • cd  shell built-in functions to change the current working directory
  • chdir  shell built-in functions to change the current working directory
  • chgrp  change the group ownership of a file
  • chmod  change the permissions mode of a file
  • chown  change owner of file
  • clear  clear the terminal screen
  • cp  copy files
  • date  print and set the date
  • dc  arbitrary precision desktop calculator
  • dos2unix  convert text file from DOS format to ISO format
  • eject  eject media such as CD-ROM and floppy from drive
  • exit  shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps
  • file  determine the type of a file by examining its contents
  • head  display first few lines of files
  • lp  send/cancel requests to an LP print service
  • lpstat  print information about the status of the LP print service
  • ls  list the contents of a directory
    ls [options] [directories]
    the current working directory used if no directories specified
    A few options:
    • -a    list all entries includeing hidden files (starting with .)
    • -i    print inode numbers
    • -l    long list (mode, links, owner, group, size, timeof last modification, and name
    • -t    sort by modification time
    • -x    multi-column list, sorted across each row
  • Mail, mailx, mail rmail interactive message processing system to read mail or send mail to users
    mail [options] users
    Examples:
    mail                           with no options, to read your mail
    mail user                     to send mail to user
    mail user < filename     mail a file to another user
  • mkdir  make directories
  • more  browse or page through a text file
  • mv  move files
  • nispasswd  change NIS+ password information
  • page  browse or page through a text file
  • pg  files perusal filter for CRTs
  • pr  print files
  • ps  display the status of current processes
  • pwd  working directory name
  • rm  remove files or directories
  • rmdir  remove files or directories
  • spell  find spelling errors
  • tail  deliver the last part of a file
  • umask  shell built-in function to restrict read/write/execute permissions
  • unix2dos  convert text file from ISO format to DOS format
  • vi  screen-oriented (visual) display editor based on ex
  • view  screen-oriented (visual) display editor based on ex
  • w who is logged in, and what are they doing
  • wc  display a count of lines, words and characters in a file
  • which  locate a command; display its pathname or alias
  • who  who is on the system
  • whoami  display the effective current username
  • whois  Internet user name directory service
  • write write to another user

No comments:

Post a Comment