|

Introduction | Getting Started | Things to Remember | Unix chmod | Unix vi Reference
Unix
Getting Started
1. Logging on:
The login prompt
is usually "Login:". Type in your userid after the prompt and
pres <return>. Then type in your password after the "Password:"
prompt and pres <return>.
2. Parameters:
The echo command
can be used to display system parameters - it "echoes" the contents
of the variables to the screen:
echo $PATH the path
followed to find commands
echo $TERM the kind of terminal you are working on (important for editors)
echo $HOME your home directory name
echo $LOGNAME your login userid
3. Useful (simple) commands:
* passwd
Change your password. You'll be asked to type in your old password,
then the new one twice. (Userid and password are case sensitive)
* ls
Lists all files and sub-directories in the working directory
- names only
* ls -l
Lists all files and sub-directories in long format, showing
permissions, file sizes and time of last modification
* ls -al
Lists all the files in the current directory including hidden
"." files
* who
Lists all the users on the system
* who am i
Displays your userid
* pwd
Displays your working directory path
* mkdir dirname
Creates a directory. Names are 1-14 characters, avoid punctuation
* rmdir dirname
Deletes a directory
* cd directorypath
Change the current working directory
Examples cd /pknight/workshop/info <return>
Full path - takes you from the home directory to particular directory or file
cd projects <return> Relative pathname of file or directory varies in relation to working directory
Move up a level: cd .. <return>
Return to home directory: cd <return>
* cat > filename
Creates a new file from the console to a named file. When you
press <return>, you'll see a blank line with no prompt.
Enter your data, separating each line with a carriage return.
When you've finished, press <return>, then press ctrl-D
to return to the system prompt. NOTE: > is a redirection
symbol.
* cat filename
Displays a file to your screen Example cat my.data <return>
* more filename
Displays a file to your screen one page at a time Example more
my.data <return>
space bar displays next page
<return> displays next line
q quits out of "more"
* lpr -P printername filename
Prints a file to your printer Example lpr -Pkorbin my.data <return>
to print the file my.data to the korbin printer in the Cluster
* cp oldfile newfile
Copies one file to another file Example cp my.file /pknight/examples/new.file <return>
* mv oldfile newfile
Moves (renames) a file to another name NOTE: If newfile already
exists, it will be overwritten - no questions asked!! Example
mv bin/file.name /tmp/users/1/akadams/86513/new.name <return>
* rm filename
Deletes the named file
Creating and Editing Files
To create files in
Unix, you need to use an editor. Several editors are available
for Unix, but the simplest one is vi (pronounced vee-aye). To
edit a file, type:
vi filename <return>
Where filename is
the name of your file. Example vi my.file <return> If
filename is a new file, you will see a blank page ready for
you to begin work. If filename already exists, you will see
the contents displayed ready for editing. For a summary of how
to use the vi editor, see the tipsheet, "TS-0015 Unix Utilities:
vi Quick Reference"
4. Logging Off:
Log off a UNIX system by typing:
logout <return>
NOTE: Typing exit will also work, but logout is preferable.
Continue with Things to Remember or Return to Workshops
|