|
|
Takes you to your home directory. Your home directory is the place where files like .cshrc and .login are located. This is the directory you start in when you login. |
|
|
Move up one directory to the parent directory. |
|
|
Go directly to the directory you are looking for. |
|
|
Go to <user>'s home directory |
|
|
List current directory contents |
|
|
Provide a long listing with information like permissions, owner, date last modified. Will also give information on links. |
|
|
Show hidden files. |
|
|
Recursively list all files, directories, and subdirectories. |
|
|
List (long) in order with most recent files first. |
|
|
List all files with a .dat extension. |
|
|
Show the group ownership, as well as the user ownership. |
|
|
Show only the directory, and none of the files. |
|
|
Find all files by the name of <string> from the current directory down through all subdirectories and print it out. If you wish to use wildcards (like *), put "" around the <string>. |
|
|
Find all files owned by <name> from the current directory down through all subdirectories and print it out. |
|
|
Print out a long listing of the file, instead of just the name. |
|
|
Search for <string> in <file>. |
| pwd | Print the current working directory. Many folks have the current working directory as their prompt. This is the "Where am I?" command. |
|
|
Show how much space is available in the current directory. The available amount is given in the fourth column. These numbers are in kilobytes. Another interesting tidbit of information that shows up in the Filesystem column is where the directory is nfs mounted from. In this case it is larix, and the directory on larix is /export/home/terralyn. The directory that you have accessed is actually /users/terralyn. |
|
|
Shows all of the filesystems currently mounted on your machine. |
|
|
(Solaris) |
|
|
(SunOS) Shows only the local filesystems, and not those that are nfs mounted. |
|
|
Shows, in kilobytes how much room the current directory is using. You can give specific directories, or a * will sum each file and directory separately. |
|
|
(Solaris) |
|
|
(SunOS) Prints the <file> to the default printer defined either at the system level, or with the $PRINTER environment variable. |
|
|
(Solar |
|
|
(SunOS)Prints the <file> to the printer specified in <printer> |
|
|
(solaris) |
|
|
(SunOS) Shows the files currently in the queue for specified printer. |
|
|
(Solaris) |
|
|
(SunOS) Remove the print job specified by <job> or <jobname> from the queue. In SunOS you have to specify the printer as well, if not the default printer. In Solaris, the name of the printer is included in the <jobname>. |
|
|
Copy the file <file> to new location <destination>. <destination> can be the name of a new file, or a directory. If it is a directory, the file will be copied with the same name. |
|
|
Copy the directory <directory> and all of its contentst to the new directory, <destination>. |
|
|
Rename the file <file> to <destination>. If <destination> is a directory, the file keeps the same name. <file> no longer exists after the mv. |
|
|
Remove a file. |
|
|
Remove a directory and all of its contents. |
|
|
Remove an empty directory. |
|
|
Ask before removing the file. |
Currently there is one 8mm tape drive connected to myrica.fsl.orst.edu located in FSL 345. The commands here will be specific to that drive. You will need to be logged into myrica with a tape in the drive. It is not necessary to be sitting at the console.
With tar you do not want to use absolute
paths (that is, paths that begin with a /). The reason is that if you attempt
to recover the data from somewhere other than the machine you tarred from,
you may not have permissions to create the upper level directories. This
is particularly important if you are sending the data off somewhere. For
that reason, you want to be in the parent directory of the directory you
are trying to archive. So, if you want to archive /data/pspace2/jdoe, first
"cd /data/pspace2" and archive "jdoe".
|
|
Rewinding tape device. The tape rewinds after any command given. |
|
|
Nonrewinding tape device. The tape remains where it is after each command |
|
|
Archive the contents of <directory> to device /dev/rst1. This will rewind the tape when the tar is done. This will also show on the screen what is being written. |
|
|
Archive the contents of <directory> to device /dev/nrst1, showing the contents on the screen. This one will NOT rewind the tape when completed. This is useful if you have multiple directories in separate places to archive. |
|
|
Show the contents of the tar file without extracting the files. |
|
|
Extract, showing the contents to screen, all of the files in the tar file on the tape device /dev/rst1. Rewind when complete. |
|
|
Extract, showing the contents to screen, all of the files in the tar file on the tape device /dev/nrst1. Do not rewind when complete. |
|
|
Rewind the tape to the beginning. |
|
|
Move the tape forward to the next beginning of file marker. Do not rewind the tape. |
|
|
Rewind the tape to the next beginning of file marker. Do not rewind the tape. |
|
|
Move to the end of the tape marker and don't rewind. |
|
|
Rewind the tape and eject from tape drive. |
Archive /data/pspace/jdoe
Archive /data/pspace/jdoe/dir1 and /data/pspace/jdoe/dir2
Archive /data/pspace/jdoe/dir1 and /data/pspace2/jdoe/dir1 on the same tape
Extract multiple tar files from a tape to /data/pspace/jdoe
Tar can also be used to archive directories to files so that they can be compressed. Simply replace the device, /dev/nrst1, with a file name. For instance:
To extract the information again, there are two methods:
It is sometimes useful to start a program
in the "background". One reason may be that you aren't running in a windows
environment, and you need the terminal back to do other work. Or, you may
have a process that is going to take a long time, but you need to log off
of the machine. To put a process in the background, use the "&" at
the end of the command. You can also use it to free up the window you are
working in if you don't want to open another one.
|
|
Will start netscape and give you your prompt back. If you start netscape without the "&" and still want to put it in the background, you can: Ctrl-z in the window netscape was started. |
|
|
puts
the stopped process in the background.
If you stop a process, but don't put it in the background (bg), you may not be able to exit the window. You will get a message "there are stopped jobs". Use "fg" to bring stopped jobs back to the foreground. If you have a big program you need to run you can also put the job in the background, log out and have it continue to run: nohup bigjob >& bigjob.out & You want to make sure that you redirect both standard error and standard out to a file. If the program attempts to write to either of these and you don't have a file redirection, the process will stall, and you will have to kill it. The nohup guarantees that it will continue to run after you log out. This is by default in the Cshell, but doesn't hurt either way. You can set the priority on jobs so that they don't consume all of the CPU. This is a courtesy if you have big jobs running for instance on a machine with lots of users. The program is "nice" and can be used to start a program at a given priority. "renice" will let you change the priority of a currently running program. |
|
|
Gives the bigjob the lowest priority. |
|
|
Gives the process <pid> lowest priority. |
|
|
Will show you jobs running in the background started in the current session. If you log out, "jobs" no longer works. |
|
|
Will show you your current process. This is the more common method and has many options: |
|
|
Shows only the "parent" processes. |
|
|
Shows ALL processes owned by you. |
|
|
Gives additional information on the processes, like CPU and memory usage. |
|
|
Show ALL processes on the system (ax), complete with information on CPU and memory usage (u), and the name of the program with arguments (w) |
| Sometimes if you are not logged out of a machine gracefully, you will leave processes running. Or, maybe the machine you are working on has locked up. If you can log into another machine, and then rlogin back to the original machine, you can kill the processes. | |
|
|
Shows you all of your processes. |
|
|
Kill the process with process id <pid> (<pid> is the second column) |
|
|
If the process didn't die, try kill -9. Multiple <pid>'s can be used with one kill command |
If you are using one of the windowing systems (OpenWindows or CDE) you may want to use the GUI text editors available. Otherwise, here is a short primer on "vi"
vi has two modes: command and insert. When you first start vi with "vi <file>" you are placed in command mode. Here are just a few useful commands to be used in command mode. One you are in insert mode, and <ESC> will get you back to command mode.
|
|
Starts insert mode in front of the cursor position. |
|
|
Starts insert mode after the cursor position. |
|
|
Starts insert mode at the end of the current line. |
|
|
Opens a new line below current line. |
|
|
Opens a new line above current line. |
|
|
Move the cursor left,down,up,right. (Sometimes the arrow keys will work) |
|
|
Move forward one word. |
|
|
Move back one word. |
|
|
Go to the beginning of the line. |
|
|
Got to the end of the line. |
|
|
Make a copy of the line and place in the cut buffer. (3yy will make a copy of the next 3 lines.) |
|
|
Delete the current line in the cut buffer. (3dd will delete the next 3 lines) |
|
|
Delete to the end of the line from the point of the cursor. |
|
|
Delete the current word. (Generally defined as characters to the next whitespace, or special character) |
|
|
Put back what is in the cut buffer after the cursor if it is a word, or on the next line if it is a whole line. |
|
|
Same as "p", only before the cursor. |
|
|
Undo last command. |
|
|
Repeat last command. |
|
|
Go to end of file. |
|
|
Got to line n. (1G will get you to the beginning of the file) |
|
|
Search for string, and place the cursor at the beginning of string |
|
|
Go to next occurrence of search string. |
|
|
Change word. A $ will appear at the end of the string vi thinks is a word. You are in overwrite mode and need to press <ESC> to get back to command mode. |
|
|
Replace a single character. |
|
|
Change to overwrite mode until <ESC> is pressed. |
|
|
Start at the beginning of the file, to the end and replace the First occurrence of string1 on each line with string2. |
|
|
Same as above, except ALL occurrences are changed. |
|
|
Same as above, but start at current location. |
|
|
Same as above, but start at beginning and end at current location. |
|
|
Only change occurrences of string1 on lines 5 through 9 with string2. |
|
|
Read in <file> at current cursor location. |
|
|
Write current contents to <file> |
|
|
Write current contents and quit. |
|
|
Quit without saving changes. |
In order to run a graphical program on another machine, you must use a couple of Xwindows commands.
BEFORE logging into the other machine:
Example: Display a clock (xclock) from ilex on trillium.
xhost <new machine>
Log in to the other machine rlogin:
rlogin <new machine>
On new machine, set your display back to your current machine:
setenv DISPLAY <your machine>:0
Run the application.trillium{1} xhost ilex
trillium{2} rlogin ilex
ilex{1} setenv DISPLAY trillium:0
ilex{2} xclock &
Sometimes you will have programs that
produce a lot of output to the screen that you want to capture. You can
"redirect" that output to a file in several ways:
You can use the "<" to redirect
standard input (input from the keyboard) to a command. One of the more
useful methods is mailing a file to someone from the command line:
mail jdoe < file1
Sometimes you want to take the output from one program and use it as input to another program. The | is called "pipe", and does just that. For instance:
ps -auxw | grep terralyn
takes the output from "ps -auxw" and gives it to the command "grep" to search for the string "terralyn". The output will only be those processes containing the string "terralyn".<command> > <file> Creates <file>
and puts the contents of standard out produced by <command> in <file>.
<command> >> <file> Appends to <file> the standard out produced by <command>. <file> must already exist.
<command> & <file> Creates
<file> and puts the contents of both standard out and standard error
produced by <command> in <file>.
There are three sets of permissions associated with a file: user, group, other (ugo). Each group is individually assigned read, write, and execute permissions (rwx). When you do an ls -l of a directory, the first string of letters shows the permissions.
The first letter indicates filetype. It can be "d" for directory, "-" for file, or "l" for symbolic link. Each of the next set of three characters are the permissions for user, group, and other respectively. In the above examples, terralyn, the user (or owner, but UNIX uses "o" for other) owns the directory, Mail, and has read, write, and execute permissions. The group "staff" also has read, write, and execute permissions. The rest of the world (other), only has read and execute permissions. For a directory, you must have execute permissions to be able to "cd" into the directory. In the case of "Terralyn's_Xterm", the group now only has read and execute permissions. If you can read a file, you may copy the file somewhere else. If you have right permissions, you may modify a file. With write permissions, you may also delete the file IF you also have write permissions in the current directory. A deletion of a file requires that the directory table be updated, which requires write permissions.
Useful commands for file permissions:
|
|
Change the protections of the file. You may do this in two forms (check "man chmod" for more details) |
|
|
Change the ownership of the file. This can only be done as root, or if you are the owner of the file. Being the owner in SunOS still does not allow you to change the ownership. |
|
|
Change the group ownership of the file. |
NOTE: In the above three commands you
can add a "-R" for recursive changes, so that all files and directories
below your current directory are changed.
|
|
Tells you what groups <user> is assigned. |
|
|
Start a new subshell with the default group as <group>. All files created during the session will have group ownership of <group>, instead of your default <group> |
Now all of the good stuff, that makes your life a little easier.
File Completion In the Cshell, use the <ESC> key to complete the name of a file that you are typing. It will be completed if what you have typed is unique. If it isn't, you will get a beep and nothing else. A <ctrl>-d will show you what the possibilities
are. If you are in a Cshell and <ESC> doesn't work, try "set filec"
History The Cshell keeps track of previous commands if "set history=n" has been set.
!n Repeat command n
history Show the command history
!string Repeat the last command that started with string
^string1^string2^ Repeat the last command, but replace the FIRST occurrence of string1 with string2.
!!string Repeat the last command, appending string
<command> !$ Use the last argument of the previous command as the argument for <command>
Aliases Setting up short cuts for stuff you do all the time, but don't like to type. These should be added to your .cshrc file located in your home directory
alias setd 'setenv DISPLAY \!:$\:0'
Now "setd ilex" will set my environment variable DISPLAY to ilex:0 so that I can run graphics programs on remote machines and display back to ilex. (Because ! means something to the shell
the \ makes it a literal ! The same applies for the : only because $: has special meaning)
Quotations ",',` all have different
meanings.
Repitious commands (foreach
statement)
Example:
Other commands of interest, but too
complicated for the last page: awk, sed
"man" is the command for accessing
the online manual pages. The first thing to do is "man man", which will
explain how to use man. Examples:
man ls Shows all of the
options for the command ls.
!! Repeat the last command given
alias <aliasname> 'command'
Links Create symbolic links in your home directory with so you don't have to type the full pathnames of data directories. ln -s /data/mydatadisk/mydata mydata
Creates a "link" in the current directory called "mydata" that points to /data/mydatadisk/mydata. Now you can "cd mydata" and get to /data/mydatadisk/mydata.
literal
string
string
with variable substitution
return
the value of the command
foreach <index> (list)
command1
command2
...
end
foreach machine (`/local/share/pubsuns`)
echo $machine
rsh $machine who
end
This logs into each public machine
and reports back who is logged in.
How to get additional help -
Try the man pages!
man -k font Shows
all of the commands that deal with the subject, font.
man is probably the signle best
source of information available for those seeking help within a UNIX enviroment,
USEIT!
FSRN Home Page / GIS/RS
Helpdesk Page / GIS/RS
Intro Page