|
|
|
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.

Commands 210A - unix you don't needThis section includes some commands that are useful, but only in limited situations. Many commands are for text formatting from the command line. Other commands are just not commonly used or too complicated to use on a regular basis. find [path] [options]Searches for files meeting some criteria. You'd think that this command would be one of the most useful and important ones. You'd be wrong. The command is so complicated and UNIX directory trees are so complex that 'find' is not used very much. Still, in some cases, it can be useful. The [path] indicates the starting directory. 'find' will search it and all of it's subdirectories. It is not recommended to start searches with the root directory (/) since many subdirectories are not publicly accessible and it's a very long and tortuous process to search all of the SACL system. Searching from the current directory (.) or your home directory (~/) is probably the most effective. Some options are used to specify the file to search for, but there are lots of options. I will include just the most basic ones here. See the man page for more details.
tar (-cfrtvxzZ) [file-list]Creates a tape archive file. This command is like 'zip', but without any compression. It creates a single file that contains all the files in [file-list]. By default, the 'tar' file is created on a tape device, unless the '-f' option is used. -c creates a new 'tar' file, overwriting any existing file by the same name If I wanted to tar all of the files in my account into one 'gzip'ped archive, I would enter "tar -cvzf jcjai ~/" and it would create a file named 'jcjai.tar.gz'. su [username]Temporarily logs you in as [username]. 'su' essentially opens a new shell as [username]. You will be prompted for the password of [username]. rsh [host] [command]Runs a single [command] on [host]. The [command] can be enclosed in single quotes (') if it is longer than one word. This can be used to run a command that only works on SunOS machines or Solaris machines when you are sitting at the wrong type of terminal. It can also be used to check the system resources of a remote machine, say ply, by entering "rsh ply top". action (-hp) (number) These are message boards that contain information that relates to system administration. Often they also include important items about updates and software bugs. They are a good place to check first if something isn't working. Check them first, then contact a system administrator. Specifying a (number) will start reading from that message. -h displays just the headers of the messages touch [file]Updates the access and modification times of [file] to the current time. If [file] doesn't exist, then an empty file is created with the name [file]. FOR THE REALLY LAZY: This command can be use for creating dummy files. These dummy files can then be filled with "echo [text] >> [file]" without opening a text editor. -This is the symbol for standard input. It is used more commonly with pipes (|). Some commands, like 'tar', need to have its input specified. So if the input is piped from another command, then '-' needs to be used to let 'tar' know that the input is from the pipe. I'm sure that you can think of some creative uses for this. [command1]`[command2]`This is NOT the apostrophe ('). It takes the output of [command2] and uses it as the arguments for [command1]. [command1] ; [command2]Strings two commands together, running [command2] after [command1] is completed. More than two commands can be strung together this way. [command1] && [command2]Runs [command2] after [command1], but only if [command1] is successful. More than two commands can be strung together this way. [command1] || [command2]Runs [command2] after [command1], but only if [command1] fails. More than two commands can be strung together this way. ( [commands] )Spawns a sub-shell, which doesn't hurt as much as it sounds like it should. Any commands between parentheses are run in their own shell. An example would be '(a ; b) & c' which would run 'a', then 'b' in a separate shell in the background, while running 'c' in the current shell in the foreground. Another application would be to use the output from all the commands in the sub-shell as input of another command. nl (-bfhnp) [file]Adds line numbers to a text file and sends the output to the screen unless it is redirected. Line numbers are added to each line and is reset to 1 at the beginning of each page. A page is defined by three parts, a header, a body, and a footer. The header starts with a line containing '\:\:\:'. The body starts with a line containing '\:\:' and the footer starts with a line containing '\:'. There are many more options than listed here, please see the man page for details.
wc (-cClw) [file-list]Counts the number of character, words, and lines in [file-list]. -c counts just the number bytes POWER TIP: 'wc' can be used with 'ls' to see how many files are in a directory. Just enter "ls | wc -l". join [file1] [file2]Extracts and joins common lines from two files. cut (-cdf) [file-list]Extracts columns or fields from the files in [file-list]. Columns are specified with either the '-c' or '-f' options.
paste (-ds) [file-list]Attaches the lines of the files in [file-list] as the columns of the output. Thus, the first lines of the files in [file-list] are output as columns, separated by TABs, followed by the second lines and so on. -d [character] specifies [character] as the delimiter for the columns uniq (-cdfsu) [infile] [outfile]Removes and reports adjacent duplicate lines in [infile] and saves the unique lines and one copy of each duplicated line in [outfile]. -c shows the number of times a line is repeated Note that this only checks adjacent lines, so it is often useful to 'sort' the [infile] first. cmp (-s) [file1] [file2] Compares two file, character by character. These are like 'diff' and 'zdiff', but compares byte by byte instead of line by line. 'zdiff' works on 'gzip'ped files by temporarily uncompressing them. -s runs the command in silent mode Normally, the output of 'cmp' and 'zcmp' lists where the differences are. In silent mode, these messages are suppressed. This is useful for connecting 'cmp' to another command. One good use for these commands is to clean up your directory. You can compare two files and if they are the same, delete one. This can be done by entering "cmp -s [file1] [file2] && del [file2]". The '&&' will only delete a file only if 'cmp' finds no differences between the two files. last (-hnt) (user)List the last logins for (user) on the current machine. If no (user) is specified, then all logins are shown. -h [host] specifies the host to show logins for ttyDisplays the device name of the terminal that 'tty' is run in. mesg [-ny]Controls whether other users are allowed to send you 'write' messages. Note that turning off 'write' permission also disables 'talk' notification messages. -n disables 'write' permission rusers (-ahilu)Reports who is on each computer in the network. This is a lot like 'sacl' when used with the '-l' option, but is a UNIX command not a SACL system script. -a reports on a machine even if no users are logged on xset (q)Sets X window parameters. Use 'xset q' to see the current status of the variables. Settings which are changed only last for the current login session. Permanent changes should be made to the '.xinitrc' file. tr (-d) [string1] (string2)Translates [string1] to [string2] in the standard input. Thus, if I pass something to 'tr "[A-Z]" "[a-z]"', it will convert all uppercase letters into lowercase letters. Note that the input comes from standard input, so usually you will need to pipe something to 'tr'. Also, the output goes to standard output and will have to be redirected if it is to be saved. -d deletes all characters in [string1] from the standard input, no (string2) needed expand (-) [file]Converts the TABs in [file] to SPACEs. Each TAB is replaced with 8 blank spaces unless otherwise specified. -[number] replaces each TAB with [number]blank spaces unexpand [file] {Solaris}Replaces leading blanks in [file] into TABs. gzexe (-d) [file]Compresses an executable [file] and keeps it executable. There is a performance loss associated with this operation, but it saves a little disk space. When a compressed executable is run, it is uncompressed first. -d expands the compressed executable [file] fold (-w) [file]Cuts long lines in [file] into shorter pieces. By default, lines are cut to be 80 characters long each. Note that a TAB is considered one character. Use 'expand' to convert TABs into SPACEs. -w [length] cuts the [file] into lines of [length] characters each comm (-) [file1] [file2]Compares two sorted files line by line and displays the results in three columns. The first shows lines unique to [file1], the second shows lines unique to [file2], and the third columns shows lines common to both files. -1 suppresses the first column (lines unique to [file1]) newform (-abceilops) [file-list]Manipulates text files by adding or removing spaces.
pr (-adfFhlmnoprstw) [file]Formats text files into a specified format. By default, [file] is formatted to 66-line pages with a five line header and a five line footer. The header contains the page number, the filename and the file's date and time. +[number] begins the formatting with page [number] umask [file-permission]Sets the default file permission for new files. Without any arguments, 'umask' displays the current file creation mask. The system subtracts this mask from the system default permission to determine the file permission for new files created by you. By default, the system sets 666 for new files and 777 for new directories. If 'umask' is set to 002, then your new files would have 664 file permission (read and write for user and group, read only for everyone else.) at (-mlr) [time] [commands]Runs [commands] at [time]. [time] is specified by a mandatory hour, an optional minutes, an optional date, and an optional increment. The hour is specified with a two-digit number. Minutes can be added to the hour with or without a colon (e.g. '1320' or '13:20'). The time can also be either 'noon', 'midnight', or 'now'. 'am' and 'pm' can also be added to the time. The date is specified by a three-letter month name, followed by a date, and optionally a year (e.g. 'nov 13 1996' or 'nov 13' or 'nov 13, 1996'). The date can also be 'today' or 'tomorrow'. An increment to the specified time can also be added. The increment is of the form '+[number][unit]' where [unit] can be 'minutes', 'hours', 'days', 'weeks', 'months', or 'years'. The [number] can also be 'next'. After entering "at [time]", hit ENTER, type in the commands to be executed, followed by "Ctrl-D". For example, I could enter "at 02:30 tomorrow +3minutes [ENTER] lpr foobar [Ctrl-D]" to print out 'foobar' at 2:33 am tomorrow. -m sends mail to you after the job is complete The 'at' command is very useful for scheduling big jobs to run at times when the system is in low demand. atq (-cn) [users]Shows the jobs in the 'at' queue for [users] in the order in which they are scheduled to run. If no [users] are specified, all jobs are shown. -c sorts the jobs in the order that they were submitted atrm (-i) [jobs]Removes your 'at' [jobs] from the queue. If [jobs] is not specified, all of your 'at' jobs are killed. The [job] number can be obtained from 'atq'. -i prompts you for verification before removing [jobs] sleep [time]Pauses the system for [time] seconds before executing a command. This is usually used with '( )' and ';' to run something with a little delay. For example, '( sleep 120 ; more foobar )' would display 'foobar' after two minutes. sed (-ef) [file-list]Takes each line of the files from [file-list], performs some operations on it and changes the file itself. The editing commands to be performed are placed in a script. Each line of the script has the form '[line1](,line2) [function] (arguments)'. This performs [function] on the lines from [line1] to [line2]. The function can be any of the valid functions for 'awk' (see a reference book or the man pages). This is actually a very powerful command. Refer to the man pages for details. -e applies to f awk (-f) ('script') (var=value) [file-list]Applies the text manipulation commands in a script to the files in [file-list]. The script can contain variables defined when 'awk' is called and can also do some very fancy things. The script can include functions such as mathematical formulae and text manipulation functions. This command is very similar to 'sed', but doesn't change the original file; instead, the output is sent to the screen and should be redirected (see '>') if it is to be saved. 'awk' is far too complex to describe briefly here. See the man pages or a reference book for a detailed explanation of 'awk'. -f [script] specifies the script to run if it isn't listed on the command line There are also several other key UNIX programs which are almost standard UNIX that either are not used very often at SACL or require more explanation than I have space for. Some of these will be explained in other documents. Compilers: 'cc', 'f77', 'gcc', and 'gdb' |