UNIX Concepts

Article sections

    UNIX Concepts

    Using the Unix Shell

    While maintaining and uploading files can be done without any Unix knowledge knowing a few basic concepts and commands can be very useful. An introduction to unix commands is here.

    Basic Unix Concepts

    Your files and directories are protected by access permissions built into Unix. Three sets of permissions are defined: user, group and other (global). Each group has three permissions: read, write and execute. By default your home directory allows read/write permissions only by being logged into the account (e.g. user level permissions). The execute permission is for scripts (files containing shell commands) and CGI scripts.

    The commands you should know at a minimum are: change your password (passwd), list a directory (ls), copy a file (cp), move or rename a file (mv). At a more advanced level knowing the commands grep and awk to add pattern matching allows almost limitless possibilities of ways to make handling files easier.

    Differences with Windows

    There are two differences that case confusion for Windows users when using Unix:

    • In Unix file name are case sensitive
    • Using blanks in file names requires some care in Unix
    • ASCII file line endings

    File Names

    In Windows file.txt and FILE.TXT are the same file. In Unix these are different files. Spaces in file names can cause problems. Browsers have to replace a blank with the ASCII code %20”. Most modern browsers do this just fine, but if for some reason it fails, you’re going to end up getting a “page not found” error when you try to access the file. Accessing theses files in FTP clients or in the Unix shell requires more knowledge. Naming a file March_Meeting or MarchMeeting is a better choice for file names that are going to be used on Mac, Windows, and/or Unix.

    Line Endings

    The line is denoted using the linefeed (lf) and carriage return (cr) characters. Unfortunately the three main operating systems all use different characters to mark the line end in ASCII files. The line endings are:

    • Windows <cr><lf>
    • Mac/OSx <cr>
    • Unix <lf>

    Most browsers are programmed to handle any of the above file types. The best way to address this problem is to use a text editor that allows you to set line endings. Ways to do this in Unix are addressed here.

    The incorrect line endings will cause problems scripts such as Perl or PHP.

    in Unix Basics

    Related Articles