Overview of Unix Commands

Before you use the Command Line Tools in Unix, you should be familiar with using the command line interface in a terminal session. Although you can use the Command Line Tools without using any additional Unix commands, there are some basic commands that might be helpful. The table below describes some of the basic Unix commands. For more information about any of the commands, or to see additional parameters, type: man command name

Table of Unix Commands

Command Description
ls List the files in the directory
cd directory name Change to the specified directory
mkdir directory name Create the specified directory
rmdir directory name Remove the specified directory
mv filename [filename]... directory name Move the specified files to the specified directory
mv file1 file2 Rename file1 as file2
mv directory1 directory2 Rename directory1 as directory2
cp file1 file2 Copy the contents of file1 to file2
rm filename Delete the specified file
diff file1 file2 Compare file1 with file2 and display the differences
more filename List the contents of the specified file one screen at a time
CTRL+c Stop the current process
CTRL+s Pause screen scrolling
lpr filename Print the specified file
exit End the terminal session

Syntax

The commands (shell scripts) in the Amazon Mechanical Turk Command Line Tools use the Bourne Shell syntax. If you want to write your own commands, be sure to follow this syntax. Some basic elements of the syntax are described in the following table.

Bourne Shell Syntax

Syntax Item Description Example
# Specifies a comment. This character can be placed anywhere in the line are is in effect until the end of the line. # This line is a comment.
#!/bin/sh Specifies the first line of a script #!/bin/sh
echo Prints the output to the screen. echo "This line will be printed on the screen."
$1 Specifies a positional parameter. echo $1 $2 $3