UNIX TUTORIAL FOR BEGINNERS

UNIX as an operating system
Logging in/out
Changing Password
Creating/Removing Directories
Creating/Removing Files
Setting Permissions
Basic Commands
Other Resources

Unix is an operating system.

What is an operating system?
Find this and other technology related definitions from whatis.com.

  • An operating system (sometimes abbreviated as "OS") is the program that, after being initially loaded into the computer by a boot program, manages all the other programs in a computer. The other programs are called applications. The applications make use of the operating system by making requests for services through a defined application program interface (application program interface). In addition, users can interact directly with the operating system through an interface such as a command language. An operating system performs these services for applications:

  • In multitasking operating systems where multiple programs can be running at the same time, the operating system determines which applications should run in what order and how much time should be allowed for each application before giving another application a turn.

  • It manages the sharing of internal memory among multiple applications.

  • It handles input and output to and from attached hardware devices, such as hard disks, printers, and dial-up ports.

  • It sends messages to the applications or interactive user (or to a system operator) about the status of operation and any errors that may have occurred.

  • It can offload the management of what are called batch jobs (for example, printing) so that the initiating application is freed from this work.

    On computers that can provide parallel processing, an operating system can manage how to divide the program so that it runs on more than one processor at a time.

    Logging In top

    To ensure security and organization on a system with many users, UNIX machines employ a system of user accounts. The user accounting features of UNIX provide a basis for analysis and control of system resources, preventing any user from taking up more than his or her share, and preventing unauthorized people from accessing the system. Every user of a UNIX system must get permission by some access control mechanism.

    Once you have accessed a Unix system you will need to log-in. For this you need your username and password which have been supplied by the system administrator. These are case sensitive so be sure you do not have caps lock on.

    login
    password

    Logging Out top

    Once you have completed your Unix session, simply type exit at the prompt and this will close your session.

    exit

    Changing Password top

    The first thing you should do when you log in the first time is change your password. You can do this by typing in:

    passwd

    You will then be prompted to enter your current password. This is a security measure built into Unix. Once you have correctly entered your existing password you will be prompted to enter a new password and to re-enter it to make sure there were no typing errors. Some useful guidelines when selecting a password for Unix:

  • Do not use any part of your name, your spouse's name, your child's name, your pet's name, or anybody's name. Do not use any backward spellings of any name, either.

  • Do not use any number that can be easily guessed, like your phone number, your social security number, your address, license plate number, etc.

  • Do not use any word that can be found in an English or foreign-language dictionary.

  • Do not use all the same letter, or a simple sequence of keys on the keyboard, like "zxcvbn".

  • Do use a mix of upper-case and lower-case letters, numbers, and control characters.

  • Do use at least six characters.

    Creating/Removing Directories top

    Creating Directories When creating files and directories on UNIX, it is safest to use only the characters A-Z, a-z, 0-9, and the period, dash, and underscore characters. /font>

    mkdir directoryname

    Creates a directory as a sub-directory to the one you are currently in. By specifying a full path you may create a directory in a different directory. You must have write permissions in the parent directory to create a directory.

    Removing Directories
    rmdir directoryname
    Deletes the named directory. If the directory is not empty, this will fail. To remove all files from the directory, first do
    rm -rf dirname


    Creating/Removing Files top

    Creating Files

    The touch command creates an empty file within the directory you are working. If you touch an existing file, it changes the last modification date to now.

    touch filename


    Removing Files

    rm filename
    Deletes the named file(s). Options:
    
    
    -f      force, delete files without prompting
    -i      interactive -prompts whether you want to delete the file
    -R      recursively delete all files in directories
    


    Setting Permissions top

    There are a number of configurations you can set up when setting the permissions for a file or directory.

    chmod 755* directoryname or filename
    This sets the permissions for your working directory read, write and execute forthe account holder and read and execute for the group and the rest of the world. The * changes the permissions for the entire directory. Without the *, the files within the directory are not included.
    Number          Perms
      0              ---          no permissions
      1              --x          executable only
      2              -w-          writable only
      3              -wx          writable and executable
      4              r---         readable only
      5              r-x          readable and executable
      6              rw-          readable and writable
      7              rwx          readable, writable, and executable
    
    Basic Commands top

    pwd(print working directory) displays what directory you are currently working in

    ls-list
    ls -a - shows you all the files in your directory, including hidden ones.
    ls -l - shows you the files in your directory in long format. Giving you the ability to see file permissions, owner of file, creation date, and filename.
    ls -al - combination of the two above.

    Following are a number of options to use with the ls command.

    -a: list all files, including those starting with a "."
    -d: list directories like other files, rather than displaying their contents
    -k: list file sizes in kilobytes
    -l: long (verbose) format- show permissions, ownership, size, and modification date
    -t: sort the listing according to modification time (most recently modified files first)
    -X: sort the files according to file extension
    -1: display the listing in 1 column

    cd: change directory. This always takes you to your home directory.
    cd directoryname: takes you to directory directoryname
    cd~: takes you to your home directory
    cd . : keeps you in the current directory
    cd ..: moves you up a directory in the hierarchy

    man: The on-line manual with a complete list of options available for each command.
    man command
    mv: Moves a file and can also be used to rename a file by using the same path.
    mv path/oldname path/newname
    ps: Shows all the processes you are running

    script: Records all interactions in a window and saves in a file. To stop recording, use Ctrl-D.
    script filename
    lp: Print a file on the printer. Make sure you know what printer you are printing to and where that printer is.
    lp filename

    Other Resourcestop


    For additional Unix support and documentation, I have provided the following links:

    A Basic Unix Tutorial from Idaho State University
    Basic Unix
    UNIXhelp for Users