Instruments & Support

While the ILL's neutron source has remained essentially unchanged during the lifetime of the Institute, the ILL's instruments and their components have been continually developed and improved to increase their effectiveness.

Back to ILL Homepage
www > Instruments & Support > Useful tools > Introduction to unix > Commands 001

Useful tools

Commands 001 - Introductory unix

help [command]

Without any arguments, this command gives you a brief (by my standards) introduction to using UNIX. Read it. With the argument [command], it essentially does the same as 'man -k [command]'

man (-k) [command]

Gives you information about [command]. With '-k', you can specify a keyword and it will find all the commands that have something to do with that keyword. The command descriptions are from the UNIX reference manual (hence the command 'man') and can be somewhat cryptic at times. However, this is the handiest source of online help available.

answerbook {Solaris}

In a window environment, 'answerbook' brings up an interactive version of the UNIX manual with hyperlinks and all sorts of other cool stuff. This contains listings for virtually all of the commands that exist.

printman (-hP) [command]

Prints out the manual page for [command].

-h suppresses the header on each printed page
-P[printer] specifies the [printer] you want the output sent to

exit
quit {SACL}
logout
lo {SACL}

The first two quit a shell. A shell is opened when you log in and each time you open a window. These commands quit one shell and one shell only, so, if you type "exit" in a window, it will only quit that one window. The other two commands log you out if you type them in the startup shell. If you are not in a window system, any of these commands will log you out. Only 'exit' and 'logout' are standard UNIX. The other two are SACL aliases.

cd [directory]

Takes you to [directory]. Typing "cd" without any arguments will take you back to your home directory. "cd ." keeps you in the same place and "cd .." will take you one level up. There must be a space between cd and the directory name. Directories that do not begin with a '/' are referenced relative to the current directory, as if it began with './'; directories that begin with a '/' are referenced relative to the root directory. So, if I was in my home directory and I wanted to change to a subdirectory named 'data', I could enter "cd data" or "cd ./data" or "cd ~/data" or "../jcjai/data" or a lot of other possibilities.

dir (-adR) [file-list] {SACL}

This command is not standard UNIX. It is an alias on the SACL system for 'ls -l' that pauses at the end of each page of the listing. It simulates 'dir /p' from DOS. The arguments are the same as 'ls'.

ls (-adlR) [file-list]

Lists information about the files in [file-list]. The file-list can be filenames or directories and can include wildcards. If a directory is specified, ls will show information about the files in that directory. When the file-list is omitted, ls displays information about the files in the current directory. There are more tricks to 'ls' than you might imagine and there are also many more options than listed here. See the man page for more info.

-a

lists ALL of the files in the file-list including hidden files. All files that begin with '.' are hidden and can only be listed with ls -a (or dir -a).

-d

lists only the directory names and not the contents. This can be useful in some situations. Say that you have two subdirectories, one named 'temp' and another named 'test'. If you just enter "ls te*", then you will get a complete file list from both 'test' and 'temp'. If you are only interested in seeing whether those two directories exist, then you can enter "ls -d te*" and it will only display the two directory names and not their contents.

-l

lists the files in a long format

-R

lists recursively, displaying all the files in the file-list as well files in the subdirectories of the file-list and their subdirectories and so on and so on...

lsd [directory] {SACL}

This is an SACL alias that lists of the directories in [directory]. If [directory] is omitted, then the current directory is assumed.

lsdel [directory] {SACL}

This is an SACL alias that shows all of the 'delete'd files which haven't been 'cleanup'ed yet. Use this to determine which files can still be recovered. If [directory] is omitted, then the current directory is assumed.

lsdot [directory] {SACL}

This is an SACL alias that shows all the hidden files in [directory]. If [directory] is omitted, then the current directory is assumed.

pwd

Shows you the current working directory, '.'.

more [filename]
m [filename] {SACL}
type [filename] {SACL}

Displays a file to the screen, one page at a time. 'm' and 'type' are just SACL-defined aliases for 'more'. In the 'more-environment', there are several commands, here are some of the most commonly used ones, see the man page for more commands:

(n)SPACEBAR displays n more lines. Just SPACEBAR advances one screen.
ENTER skips one line forward.
"q" exits from 'more'
"h" displays a help screen
(n)"f" skips n screens backwards
(n)"b" skips n screens backwards; "b" will go back one screen
(n)"/"[exp] searches for the nth occurrence of [exp]
"d" advances half a screen
"=" displays the current line number

delete (-ir) [file-list] {SACL}

This is a special command in the SACL system that doesn't get rid of your file immediately. It renames the files in the [file-list] to .,[filename]. These can, and should, be deleted with 'cleanup'. They can also be recovered by renaming them back to the original filename. It is similar to the trash can on Macs.

-i causes the system to prompt for confirmation before deleting each file
-r deletes all files recursively, so files in subdirectories in the file-list are also deleted

rm (-ir) [file-list]

Erases the files in [file-list]. If you enter "rm *", it will delete all of the files in the current directory, except for those which begin with a '.'. These hidden files can only be deleted by entering "rm .*". The arguments are the same as for 'delete'. On the SACL system, 'rm' is aliased to 'delete'.

cleanup {SACL}

Deletes all the ., files in a directory, as well as the backup files generated by text editors. 'cleanup' should be run after 'delete'ing any very large files to save disk space.

cp (-ir) [source] [destination]
copy (-r) [source] [destination] {SACL}

Copies the [source] file to [destination]. In general, [source] should be a file and [destination] should be a directory. The destination directory must already exist. 'copy' is an SACL alias for 'cp -i'.

-i

prompts for confirmation before overwriting an existing file

-r

recursively copies everything in [source] (a directory in this case) to [destination] (also a directory), creating new subdirectories as necessary

backup [file] {SACL}

This is an SACL alias that copies [file] to [file].bak so that you have a backup file.

mv (-i) [source] [destination]
move [source] [destination] {SACL}

Moves the [source] file to [destination]. It operates like 'cp' followed by 'rm', but there is no backup file when the [source] file is removed. This command should only be used for moving files on the same filesystem (which should not be a problem for most people, so don't worry about it). 'move' is an SACL alias for 'mv -i'.

-i prompts for confirmation before overwriting an existing file

ren [source] [destination] {SACL}
rename [source] [destination] {SACL}

These are SACL-system aliases for 'mv -i'.

mkdir [directory]
md [directory] {SACL}

Creates a subdirectory named [directory] in the current directory. 'md' is an SACL-system alias for mkdir to resemble DOS.

rmdir [directory]
rd [directory] {SACL}

Removes empty directories. The directory must be empty before it can be removed. Note that this means there cannot be any hidden files either. If a directory refuses to be removed, check for hidden files with 'ls -a [directory]'. 'rd' is an SACL alias for 'rmdir'.

lpr (-P#) [file-list] {SunOS}
lp (-dn) [file-list] {Solaris}

For printing out files. The files can usually be of any kind, the printer should be smart enough to figure out what kind of file it is. Occasionally, there have been problems with PostScript files that refuse to print correctly. If this happens, contact a system administrator. 'lpr' is valid on the SunOS machines and 'lp' is valid on the Solaris machines. At this time, fiber and structure are Solaris and all the other computers are SunOS. Printing is temporarily down on the Solaris machines.

-P[printer]

specifies which [printer] to send to. If no printer is specified, the default printer is assumed. In the SACL lab, the default printer is hp006D (Itchy).

-#[number]

specifies the [number] of copies to send

-d[printer]

is the 'lp' version of -P

-n[number]

is the 'lp' version of -#

lpq (-P) {SunOS}
lpstat {Solaris}

Show the status of the printer and any jobs that have been sent to it. It also shows you the job number which is needed if you wish to kill a print job.

-P[printer] specifies the [printer] you want information on.

lprm (-P) [job number] {SunOS}
cancel [job number] [printer] {Solaris}

Kill print jobs that have already been sent. The job number can be found with 'lpq' or 'lpstat'.

-P[printer] specifies the [printer] on which to kill the job
- for the job number kills all of your jobs that were sent to the specified printer

print (-bfFGPr2#) [file-list] {SACL}
enscript (-bfFGPr2#) [file-list]

These are pretty versions of 'lpr'. 'print' prints out text files in landscape mode in two columns. 'enscript' converts text files to PostScript and makes it look nicer. In fact, print is just a front-end to 'enscript' that defaults to print in landscape mode with two columns. I don't think either of these are standard out-of-the-box UNIX, but are very common add-on utilities. Here are some of the more popular options (see the man pages for more):

-b[heading] specifies a heading to print at the top of each page
-f specifies a to use for the text. The default is Courier7
-F specifies a font to use for the page headings. The default is Courier-Bold7
-G prints in gaudy mode with some extra page headings, page numbers, etc.
-P[printer] specifies the [printer] to send the job to
-r rotates the output 90 degrees to landscape mode
-2 sets the output in two columns
-#[number] specifies the [number]of copies to print

'print' includes the -2r option as a default.

fullbackup {SACL}

USE THIS COMMAND! Copies all of the files in your account and all of the files in your folder on SACL Users on the Macs onto a tape. This is an SACL script that was written to make it easy to back up your data. Please make sure to back up your account every so often. To back up your account, you will need a 4mm DAT tape. They can be purchased from Fry's for about $10. It can be either 60m or 90m. 60m should be enough for anyone. Make sure that the disk not write protected. This is when the tab is closed. This is opposite of the standard floppy disk, which is write-protected when the tab is open. Put your tape into the tape drive, which is the lower device on the right hand side of the table on which structure sits. It is labeled Artecon. If there is a tape in the drive, eject it with the button. Once your tape is in, wait for the lights to stop flashing, then enter "fullbackup" from a terminal that you're logged into. That's it! No options, nothing. The backup should take about 10 minutes, after which you will receive a message. The script will automatically eject the tape. You should collect your tape and put back in any tape which was originally in the drive. If you need to restore something off of the tape, please contact one of the system administrators.

nice (number) [command]

Sets the priority for jobs on the computer. By default, when a command is run, it has a nice value of 0. A higher value will lower the priority of the job and slow it down, but free up system resources for other jobs. Finite element jobs should be run with "nice +19 [command]" when in batch mode, and "nice +10 [command]" when in interactive mode. There is a standing rule that system administrators will kill FE jobs which are not niced (but usually only if they need to run something themselves or are having a bad hair day).

e {SACL}
edit {SACL}

These are SACL aliases for your default editor. Your default editor is set when your account is made. One default editor is set for when you are working in a windows environment and another is set for when you are not in a windows environment. If you want to change your default editor, they are defined in your dot files. Please ask a system administrator if you need help. Also note that 'vi' is aliased to 'vitool' in a windows environment. 'vitool' opens a separate window in a full screen version of 'vi'.

Command recovery

A history of commands is saved, so the same command can be run again without having to retype the whole thing. Use the up arrow key on SunOS machines, or "Ctrl-P" on Solaris machines to recover old commands. The list of past commands can be scrolled down as well with the down arrow key on SunOS machines, or "Ctrl-N" on Solaris machines. To edit an old command, use the left and right arrow keys on SunOS machines, and "Ctrl-B" and "Ctrl-F" keys on Solaris machines. This feature is also able to recover old commands that begin with the same sequence of characters that you're typing. So, if type "ensc" and then up arrow, it will try to find the last command that started with 'ensc', such as 'enscript'. Hitting up arrow again will find the previous occurrence and so on.

clear
cls {SACL}
c {SACL}

Clears the window that it is run in. 'cls' and 'c' are SACL aliases for 'clear'.