These are very elementary notes on LINUX, which is often described as an open-source version of the UNIX operating system. The department's CSCI 330 course is devoted to the subject. If you need more information than you find here, you can easily search on the WWW for "LINUX" or "UNIX" and find thousands of pages, most of which should agree with one another.
We are using a LINUX system known as "turing", using (by default) using the command shell known as "bash".
How to log on to the turing system
To log on to the system, you will need to provide your Logon ID (Z-number) and your password. If you have not used the system before, your default password is your birthdate in YYYYMMDD format, 8 digits.
After your first log-on, you should change your password. A password should usually be 6 to 8 characters long. Some choices may be rejected.
User Interface
LINUX uses a command-line interface, also known as a teletype interface. You start with a prompt, type a command and press Enter. The command is executed and the resulting output is printed. After that, the prompt again appears.
Our system's default prompt is of the form znumber@turing:~$.
You will find that LINUX does not necessarily use all the keys on the keyboard and it is not aware of the mouse.
Directory structure
LINUX uses a hierarchical file structure like that of DOS (or Windows, although Windows hides this somewhat). We have files and directories. (A directory is known in Windows as a "folder".) We can move around inside the directory structure, but we are always in some current directory.
A directory can contain files and other directories (called subdirectories), all with different names.
Names of files and directories may be up to 14 characters long, possibly longer. LINUX is case-sensitive.
When you log in, you will be in your home directory, several levels down from the root directory of the system. Your home directory is named after your Logon ID.
In some cases, we will need to provide a path to reach a given subdirectory. In general, a path is a list of directories, starting either from the root or from the current directory, each a subdirectory of the preceding one, separated by slashes.
Assorted commands
To change your password, type "passwd" and respond to the prompt messages.
If you type "mkdir name", you will create a subdirectory of current directory with the indicated name.
If you want to create a subdirectory in some other directory, you will need to provide the path to it.
If you type "rmdir name", you will delete the subdirectory of the current directory with the indicated name.
You can delete only an empty subdirectory.
Suppose the current directory contains a subdirectory called TEMP. If you type "cd TEMP", you will move to the subdirectory, which will then be your current directory.
If you type "cd ..", you will move up one level in the directory structure. This has no effect if you are at the root directory already.
If you want to move to a directory somewhere else, you will need to provide the path to that directory.
You can type "ls" or "ls name" to get the directory listing of the current directory or a subdirectory with the indicated name. To get a directory listing for some other directory, you will need to provide the path.
By itself, "ls" simply lists the names of the non-hidden files and subdirectories. Much other information is available. To get it, we add switches: "ls -a" will list the names of all files and subdirectories whether hidden or not, and "ls -l" lists information about file permissions, file creation dates, and file sizes, as well as names. These can be combined: "ls -al". There are many other switches available.
To make a copy of a file, type "mv source-name destination-name". This will create a new file with the indicated name, or if it exists, it will be overwritten.
If we wanted the source file or the destination file to be in some other directory, we would need to provide a path. This gives us two copies of the file.
To move a file from the current directory to a new directory, type "mv source-name directory-name". This will move the file from the current directory to the new directory. We still have just one copy of the file.
We may need to provide a path to the new directory, or we could provide a path to the directory containing the file.
An alternate use of "mv" is for renaming a file: if we type "mv old-name new-name", where "new-name" is not the name of a directory, the name of the filis changed, and it remains in the same directory.
To delete a file, type "rm file-name". This will delete the file. LINUX does not provide a way to undelete a file, so be careful.
You can get information about a given LINUX command by typing "man name". This produces the "manual pages" for that command, and you can read them, scrolling through by pressing the space bar. When you want to stop, type "q" or "quit".
Manual pages are essentially a technical manual, not necessarily easy to read.
You can print a file on the laser printer in the CSL by typing "lp -lpcsl filename".
There are many options available.
To use a file in LINUX, you need to have the right kind of permission: read, write or execute. These can be specified for the owner, for a group of users or for everyone. That makes 9 bits in all, and you can find them listed for a file when you use "ls -l". The chmod command is used to set or change the permissions on a file or directory.
To specify the 9 bits, we use a 3-digit number in base 8. In base 2, that is 9 bits, each of which is 1 for "allowed" or 0 of "not allowed". The first digit in base 8 indicates permissions for the owner, the second for a group of users and the third for everyone.
The format for using this is "chmod NNN filename".
For example, "chmod 777 myfile" sets all 9 bits to 1, so the whole world has all kinds of access. Likewise, "chmod 700 myfile" gives me full access to myfile but denies all kinds of access to everyone else.
To edit a file with nano, type "nano filename".
This is a full-screen text editor. For a LINUX editor, it is unusually easy to use. A number of special-purpose key combinations are listed at the bottom of the screen.
There are, of course, lots of other editors available.