enoughUnix

Document Sample
enoughUnix Powered By Docstoc
					Just Enough Unix


               Just enough Unix.




                                   1
 Unix Operating System
• Generally operates from a command-line.
• After logging on, you are met with command a
  prompt:
   – miller:
   – weise:
• You are located in what is called your home
  directory.
 Unix commands
• All unix commands are actually programs.
• You “run” a program by typing its name at the
  command prompt.
• Generally, the output of a program goes to the
  screen and if the program requires any input, it
  gets it from the keyboard.
• These are called:
   – stdout & stdin
    File navigation and manipulation
•    Unix uses a hierarchical file structure.
•    Very similar to Windows and Macintosh.
•    Directories not folders.
•    Move about with typed commands rather than
     mouse-clicks.
 ls
• list
• Displays the names of the files in the current
  directory.
• Flags:
   – -a: shows all the files, including hidden ones
   – -l: displays a long listing of files
  Viewing files
 • Use the ls command.

miller: ls
afile         aprogram.cc     more
anotherfile   atextfile.txt   muchmore
   Viewing all files
  • Use the ls -a command.
  • The name of the current directory is .
  • The name of the parent directory is ..
miller: ls -a
.               afile          anotherfile   atextfile.txt   more
..              .ahiddenfile   aprogram.cc   .hiddenfile2    muchmore
 Types of UNIX files
• File [-] — a standard file.
• Directory [d] — a directory or (folder).
 Types of file access
• Read [r] — person can read the file.
• Write [w] — person can write or delete the file.
• Execute [x] — person can execute the file (applies
  only to directories and programs).
 Access privileges
• All UNIX files have privileges associated with
  them.
• These privileges determine who can access the
  file.
• These privileges determine how they can accessed.
 Types of users
• User/owner [O] — the person who created the file.
• Group [G] — Unix allows for the creation of
  groups.
• Others/world [W] — everyone else in the world
  that has access to that computer.
  Viewing File Details
 • Use the ls -l command.

miller: ls -l
  O   G   W         Owner     Group    Size     Date/time
-rw-r-----    1   sorenson   cs201ta      63   Sep   16   22:02   afile
-rw-------    1   sorenson   cs201ta      22   Sep   16   22:03   anotherfile
-rw-r--r--    1   sorenson   cs201ta     183   Sep   16   22:03   aprogram.cc
-rw-r-----    1   sorenson   cs201ta     219   Sep   16   22:04   atextfile.txt
drwxr-xr-x    2   sorenson   cs201ta     512   Sep   16   22:02   more
drwxr-x---    2   sorenson   cs201ta     512   Sep   16   22:02   muchmore
  Viewing All File Details
 • Use the ls -al command.

miller: ls -al
 O   G   W          Owner     Group    Size     Date/time
drwx------    4   sorenson   cs201ta     512   Sep   16   22:06   .
drwxrwxr-x   28   root       cs201ta     512   Sep   16   22:01   ..
-rw-r-----    1   sorenson   cs201ta      63   Sep   16   22:02   afile
-rw-r-----    1   sorenson   cs201ta     107   Sep   16   22:06   .ahiddenfile
-rw-------    1   sorenson   cs201ta      22   Sep   16   22:03   anotherfile
-rw-r--r--    1   sorenson   cs201ta     183   Sep   16   22:03   aprogram.cc
-rw-r-----    1   sorenson   cs201ta     219   Sep   16   22:04   atextfile.txt
-rw-r--r--    1   sorenson   cs201ta     152   Sep   16   22:06   .hiddenfile2
drwxr-xr-x    2   sorenson   cs201ta     512   Sep   16   22:02   more
drwxr-x---    2   sorenson   cs201ta     512   Sep   16   22:02   muchmore
 pwd
• print working directory
• Displays the full path of the current directory you
  are in.
 cd
• change directory
• Changes the directory to whatever you specify.
   – cd [name of directory]
• Without any directory (just cd) you will be taken
  back to your home directory.
 cp
• copy
• Copies the contents of one file to another.
   – cp [file to copy] [new file name]
 mv
• move
• Better name could be the rename command.
• Changes the name of one file to another.
   – mv [old file name] [new file name]
• Note that the [new file name] could be a directory,
  which will effectively move the file to the new
  directory keeping the original name.
    rm
•   remove
•   Deletes the specified file or files.
•   This is destructive!
•   They are gone!
•   They cannot be retrieved!!!
     – rm [file name]
• Note: this does not generally work with
  directories.
 mkdir
• make directory
• This creates a directory.
   – mkdir [new directory name]
 rmdir
• remove directory
• This deletes a directory (as opposed to the rm
  command above).
• The directory must be empty otherwise you will
  get an error.
  more
• view file
• This shows you the contents of a text file.
• If the file is an executable (program) file it will be
  unreadable.

miller: more anotherfile
This is just a file.

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:1
posted:11/4/2012
language:English
pages:21