Want to go command line? The procedures below will help with navigating, searching, and manipulating the archive using a terminal window. The program SecureCRT works perfectly well for this. Use it to log in to jefferson. You'll begin at the home directory for the username you entered. Then ...
The basic command is cd for "change directory". This is followed by the name of the directory (i.e. folder) you want to go to. Note that UNIX is case sensitive, so watch your capitalization. Examples:
cd rads would take you to the folder called "rads".
cd ROSSETTI/SOURCE/raws would take you through three directories to the "raws" folder.
The command to back up a directory is cd ../. Examples:
cd ../ takes you back one directory level.
cd ../../../ takes you back three directory levels.
Both Directions and Roots
These commands can be used in combination. The following example goes back one directory, and then forward through several more. From your home directory to the rads folder, for example:
You can also specify a complete path from the "root". So regardless of what directory you're in, you can use this to go to a different, specific directory. E.g.
The Wildcard Character (*)
The asterisk can be used as a wildcard when navigating or listing files. You can use it as a shortcut when changing directories, if you like. Example:
cd /home10/rossetti_work/ROSS* will find the "ROSSETTI" directory in the "rossetti_work" folder.
The wildcard is especially helpful when listing files in big directories or when using the grep (search) command. See below for more.
Listing Files and Images
Not sure where you are? Use the command ls to "list" the files and folders at your current directory level.
Listing displays the contents of folders, but you can use the command to find more specific things. Say I want to know if images for the file 2-1881.sigb5.delms exist. Navigate to where images live (the directory /home/rossetti/img/) and then list files by using the beginning of the filename and a wildcard character (*). Goes like this:
jefferson: cd ../rossetti jefferson: cd img jefferson: ls 2-1881.sigb5* 2-1881.sigb5.delms.10-7.jpg 2-1881.sigb5.delms.14.jpg 2-1881.sigb5.delms.16.jpg 2-1881.sigb5.delms.6-11.jpg 2-1881.sigb5.delms.12-5.jpg 2-1881.sigb5.delms.15.jpg 2-1881.sigb5.delms.4-13.jpg 2-1881.sigb5.delms.8-9.jpg
Searching Files (grep)
"grep" is the search function in unix. It searches for character strings in whatever directory you're currently in, and outputs a results file. The basic syntax is:
grep '[search string]' [files to search] >[output filename]
Searching can be useful when you want to find certain character strings in the archive's XML files. The grep command searches not only the outputted text of the files but the source code. Let's say we want to find all the locations we coded for page images of 2-1881.sigf1.delms.rad:
- Navigate to the directory you want to search. In this case, the "rads" directory.
- The syntax for grepping is: grep '[search string]' [files to search] >[output filename]
- Search string: think about what could narrow down more accurate results. If we want to find every page image, then we should include as much representative text as we can: grep 'image="a.2-1881.sigf1'
- Files to search: If you want to search all the xml files in that directory, use the wildcard character * like this: grep 'image="a.2-1881.sigf1' *.xml This will search any file named [whatever].xml. The wildcard character can be used in other ways. For example, if you only wanted to search DGR's letters, you could do: grep 'image="a.2-1881.sigf1' dgr.ltr*
- Filename: the grep command outputs a text file with its search results. You specify what that file is called. For example: grep 'image="a.2-1881.sigf1' *.xml >pageimages.txt
- Note that this will create a file "pageimages.txt" within the directory you're searching. To keep our SOURCE directories clean, you should specify the path where the results file should be outputted. For example: grep 'image="a.2-1881.sigf1' *.xml >/home/pcf3u/pageimages.txt
- Use an FTP to transfer and/or view the resulting text file. The results include a) the filename in which the string was found, and b) the line of code in which the string was found.
Change a Filename
In UNIX, use the command "mv" (for "move") to change a filename. The general syntax is:
mv [existingfilename] [newfilename]
Be careful, because this is not easily undone. You can move files across directories if you specify the exact path.
To copy a file, use the copy command: cp
cp [filename] [copyname]
You can also copy a file to a different directory if you specify the path:
cp [filename] [copyname] [directory]
The command ls -l will list the file permissions (read/write status, owner, and group/s) for all the files and folders of whatever directory you're currently in:
jefferson: cd /home10/rossetti_work/ROSSETTI/HOLDING/0proof jefferson: ls -l -rw-r--r-- 1 ham4w rossetti 276603 May 18 17:54 2p-1863.virginia.xml -rw-rw-r-- 1 jjm2f rossetti 4930 Feb 16 09:51 30-1850.raw.xml -rw-rw-r-- 1 jjm2f rossetti 17308 Jun 25 2006 AUCHINLECKms.rad.xml
The first column lists the permissions. The first "rw" stands for the owner's permissions. For the file 2p-1863.virginia.rad, the owner (ham4w) has read-write permissions. The second "r" or "rw" indicates the group's permissions. The group is "rossetti" and, in this example, it has only "r" or read permissions.
You can also check permissions on specific filenames, or, using the wildcard, a set of related filenames. Examples:
jefferson: ls -l 2p-1863* -rw-r--r-- 1 ham4w rossetti 276603 May 18 17:54 2p-1863.virginia.xml
Regardless of the file's owner, we always want the group to be "rossetti" and group permissions to be "rw". This allows anyone with Rossetti Archive credentials to change the file.
If the group is not "rossetti", change the group using the syntax chgrp rossetti [filename]. You must be the owner of the file [filename] and you must be a member of the group "rossetti" to make the change.
To change file permissions, you must log in as the owner. Only the owner can change permissions on their files. As in the above example, "ham4w" would have to log in to fix the file permissions for "2p-1863.virginia.rad.xml". (If the owner is no longer around, contact IATH support or Shayne.) Then use the following command:
chmod 664 [filename]
The number "664" specifies the correct read/write permissions. If you wanted to set the permissions on all the files in that directory, you could use a wildcard to hit all the files with an XML extension:
chmod 664 *.xml
Simply follow the prompts after typing the command: passwd
Symbolic Links (i.e. Shortcuts)
Symbolic links allow you to make shortcuts to other directories. When you log in to jefferson, you start in your home directory. This is a good place to make symbolic links to other directories you frequently use. Here is the basic syntax:
ln -s [fullpath] [filename]
The [fullpath] is the destination directory, or the target for the shortcut. It must be a complete network path. The [filename] will become the name of the shortcut. You can call it whatever you want. So, for example, to make a symbolic link called "HOLDING" that goes to the HOLDING directory:
ln -s /home10/rossetti_work/ROSSETTI/HOLDING HOLDING