I will add addtional topics to this listing in response to questions you may have.
First, you must activate your ctilabs account(s) at:
https://accountactivate.cti.depaul.edu/ Help/instructions for activating your account available. Here is a link to the help document.
Activating your account will take at least 10-15 minutes during regular hours if you are already registered for a cti class. Otherwise, there may be a delay of up to one day after you have registered. You will need your campus connection password and id, but you must register at the beginning of every quarter to be able to access cti lab accounts.
Next, make sure you have a connection to the internet; e.g., dial in to your ISP if necessary.
Run the secure shell application. See the link below for PuTTY, a nice ssh application. There are other secure shell applications. In what follows, I'll just refer to it as 'ssh'.
You will need to know the CTI server address for you Linux account. There are 7 addresses, any of which will connect you to your account:
ctilinux1.cstcis.cti.depaul.edu ctilinux2.cstcis.cti.depaul.edu ... ctilinux7.cstcis.cti.depaul.edu
You will get a command window and after ssh connects to the appropriate Linux server, with the prompt:
login as: your_login your_login@ctilinux1.cstcis.cti.depaul.edu's password:
Enter your CTI (campus connection) login name and password.
To log out type "ctrl-d".
(Currently you must use a secure shell, so telnet will not work. There are free sources as well as trial versions of secure shell. In particular: PuTTY is free, small, and convenient to use:)
PuTTY - a Free Windows Telnet/SSH Client
If this doesn't fit your needs see also www.ssh.com (commercial and free) or www.openssh.com (free with links for unix, mac and windows). Note that the lab computers have a secure shell client that you can use.
Command: ls
Arguments: Optional list of files and or directory names
Options: -l -F
Description: Lists the specified files and or directories. For a directory, all its files and directories are listed. If no file or directory is specified, the current directory is assumed.
Example(s):
hawk:glancast> ls prog1 prog1_ver0.cpp prog2 sample.cpp tmp hawk:glancast> hawk:glancast> ls -lF total 28 drwxr-xr-x 2 glancast cscfclt 512 May 16 11:38 prog1/ -rw-r--r-- 1 glancast cscfclt 8177 Jun 20 15:39 prog1_ver0.cpp drwx------ 2 glancast cscfclt 512 Jul 20 2000 prog2/ -rw-r--r-- 1 glancast cscfclt 2224 Jun 20 15:39 sample.cpp drwx------ 2 glancast cscfclt 512 Sep 6 2000 tmp/ hawk:glancast>
Command: pwd
Arguments: none
Options: none
Description: Print Working Directory; i.e., display the name of the current directory.
Example(s):
hawk:glancast> pwd
/condor/cscfclt/glancast/343class
hawk:glancast>
Command: rm
Arguments: file list
Options: -i -f -r
Description: Removes (deletes) the specified files
-i Ask before removing each file -f Remove files even if write permission is not set without prompting. -r Recursive remove directories and subdirectories in the list. Files will be removed in these directories first and then the directory itself.
Example(s):
hawk% rm prog1.cpp hawk% rm -i *.cpp hawk% rm -fr prog2.cpp hw1_dir
Command: mv
Arguments: existing_file new_file
Options: -i
Description: Renames existing_file to have the name new_file -i Prompts if mv would overwrite an existing file.
Example(s):
hawk% mv prog1.cc prog1.cpp
Command: cp
Arguments: existing_file new_copy
Options: -i
Description: Copy existing_file to the file new_copy. If new_copy doesn't exist, create it. If it does exist, first delete its contents.
If new_copy is a directory, a copy of existing_file is created in directory new_copy with the same file name - existing_file.
-i Prompt if the new_copy file already exists, before overwriting it.
Example(s):
hawk% cp sample.cpp prog1.cpp hawk% cp ~glancast/343class/dot_emacs.zip .
Command: mkdir
Arguments: new_subdirectory_name
Options:
Description: Create a subdirectory of the current directory
Example(s):
hawk% mkdir hw1
Command: cd
Arguments: target_directory
Options:
Description: Change the current directory (working directory) to the specified target_directory. If no target_directory is specified, change to the login directory.
Example(s):
hawk% cd hw1 hawk% cd .. hawk% cd
There are no accessible printers for the Unix account.
So to print a file, you need to use ftp to transfer the file to a PC. You can then print the file as you would any other file on the PC.
To email a text file as a message, say blob.cpp, from your Unix account to mine non-interactively:
hawk% mailx -s "subject line here" <blob.cpp glancast
To mail the same file interactively as an attachment to a message with a subject, etc. use the email program pine.
hawk% pine
In pine, type C to Compose a message and then tab to the appropriate prompt to specify the recipient (lancaster@cs.depaul.edu), the subject, and the message.
To : Cc : Attchmnt: Subject : ----- Message Text -----
Move (by tabbing again) to the Attchmnt: entry.
Type ctrl-T to get to your directory to select the file to attach. Use the arrow keys to move to directories or files.
If the cursor is on a directory name, the Enter key will display the contents of the directory. If the cursor is on a file name, the Enter key will select that file as the attachment to your email message and return you to the message.
hawk% pine
To compile a single file C++ program in a file named prog.cpp use the g++ compiler.
hawk% g++ prog.cpp -o prog
This compiles the program in prog.cpp, links it with any standard c++ library routines called (e.g. i/o routines) and produces the executable file named prog.
Now run prog:
hawk% prog
Instead of typing the command to execute the g++ compiler as:
g++ prog.cpp -o prog
You can simply type:
make prog
The make program is a utility which can build executable files from source files, but it generally has to be told what to build, what the executable depends on, and how to build the executable from these dependencies. (The make program can make certain assumptions if you don't specify all of these.)
Here is a simple make file for the compilation above in which you specify the target, dependencies, and the rules for building the targets. The make utility will automatically look for a file named 'makefile' first (then for 'Makefile').
Here is a sample file (it would be named 'makefile'):
prog: prog.cpp g++ prog.cpp -o prog
Note: The line for the command must begin with a tab character! Otherwise, the make program will not correctly interpret the makefile.
If this file, 'makefile', has been created, to compile or recompile, you can simply type:
make
For simple cases like this where there is only one target that depends on only one file, the default rules that make uses are sufficient and no actual 'makefile' is necessary. However, in this case you still have to tell make the name of the target:
make progIn the case the make utility doesn't find either 'makefile' or 'Makefile', it will look for a source file named prog.cpp (or prog.xxx for other file extents make knows about). If make finds prog.cpp, it will use it as the file on which the target depends and make knows a default rule to compile 'prog.cpp' with executable output named 'prog'.
To view the unix online manual, you need to know the exact name of a manual topic; e.g., fork. In some cases you may not know the exact name. You can try the man command with the -k option (for keyword)
hawk% man -k fork
/usr/local/graphics/man/windex: No such file or directory
/usr/local/teTeX/man/windex: No such file or directory
/condor/cscfclt/glancast/local/man/windex: No such file or directory
fork fork (2) - create a new process
fork1 fork (2) - create a new process
pthread_atfork pthread_atfork (3t) - register fork handlers
vfork vfork (2) - spawn new process in a virtual memory efficient way
fork fork (2) - create a new process
fork1 fork (2) - create a new process
pthread_atfork pthread_atfork (3t) - register fork handlers
vfork vfork (2) - spawn new process in a virtual memory efficient way
The output shows all manual topic names in the first column related to
the keyword entered (fork).
Once you know the name of the manual page for a topic use the man command again with that specific topic:
hawk% man fork
System Calls fork(2)
NAME
fork, fork1 - create a new process
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
pid_t fork(void);
pid_t fork1(void);
DESCRIPTION
The fork() and fork1() functions create a new process. The
new process (child process) is an exact copy of the calling
process (parent process). The child process inherits the
following attributes from the parent process:
.... (continues)
To put the same manual page information in a (new) file in your directory named fork.txt:
hawk% man fork | col -b > fork.txt
Once you have this file, you can transfer it to a PC using ftp and print it just like any other file.
For the moment see this file vim_commands.html. I'll reorganize this by editing tasks soon.
Start emacs:
hawk% emacs
Suspend emacs. Once emacs is started, you can temporarily suspend emacs and go to the Unix prompt. Then return to the emacs session where you left off.
Suspend emacs: ctrl-x ctrl-z Resume emacs: hawk% fg Exit emacs: ctrl-x ctrl-c
Abort any command: ctrl-g
Before any editing you need to create a new file or find an existing file with the find-file command:
find-file: ctrl-x ctrl-f
After copying the dot_emacs.zip file and extracting the .emacs file it contains, the emacs compile command is bound to the keys:
compile: ctrl-c c
next-error: ctrl-x ` (That's the ctrl-x and then the
back-quote key, which is located
just to the left of the number 1 key.)
previous-line: ctrl-p or up-arrow next-line: ctrl-n or down-arrow backward-char: ctrl-b or left-arrow forward-char: ctrl-f or right-arrow scroll-up: ctrl-v (scroll the text up nearly a full screen) scroll-down: ctrl-z (scroll text down nearly a full screen) forward-word: Esc-f (Escape key + f) backward-word: Esc-b beginning-of-line: ctrl-a end-of-line: ctrl-e
The cut (kill-region) command works on the region between the point and the mark. The point is the location of the cursor. You set the location of a mark with the set-mark-command, which sets the mark to be the current location of the cursor (the current point).
So to cut a region of text
To paste a previously cut (killed) region:
Summary of Cut/Paste Related keys
set-mark-command: ctrl-m cut (kill-region): ctrl-w paste (yank): ctrl-y exchange-point-and-mark: ctrl-x ctrl-x
Since the region between the mark and the point is not highlighted, the exchange-point-and-mark command is useful to check where the mark (and point) are currently located since they determine the region that will be acted upon by a cut operation.
Commands to split/delete/navigate emacs windows
Command Name | Key(s) | Description |
split-window-vertically | ctrl-x 1 | Split the current window (containing the cursor) into two windows, each visiting the same file. |
delete-window | ctrl-x 0 | Delete the window (but not the buffer or the file it holds) containing the cursor. |
other-window | ctrl-x o | Move the cursor to the next window. Does nothing if there is only one window. |