Literal command names are in this font: pwd
Variable values are in this font: directory
Optional arguments are in square brackets, e.g. [-l]
| Command | Arguments | Description |
|---|---|---|
| pwd | Print the current directory to the terminal | |
| ls | [-l] [directory] | List the contents of directory. Default is the current directory. -l for "long" listing. |
| mkdir | name | Create a subdirectory of the current directory named name |
| cd | [directory] | Change the current directory to directory. If no directory specified, changes to your home directory. |
| chmod | +x file | Change the mode of file to make it executable |
| gedit | [filename] | Open an editor window (if one is not already open) on file. If an editor window is already open, open a new tab in that window for file |
| cat | file | Print the contents of file to the terminal |
| rm | file | Remove (delete) file |
| rmdir | directory | Remove (delete) directory if it is empty |
| cp | fromfile tofile | Copy fromfile to tofile. Creates tofile if it does not already exist. Replaces tofile if it already exists. |
| mv | from to | Moves a file or directory from from to to. If succesful, from no longer exists. (Acts like a rename and/or moves the file or sub-directory to a new directory) |
| tar | -xvzf tar-file | Unpacks the contents of tar-file compressed tar-file into the current directory. The tar-file name should end in .tar.gz. |
| unzip | zip-file | Unpacks the contents of zip-file into the current directory and prints the list of unpacked files. The zip-file name should end in .zip. |
| gcc | [-g] [-o outputfile] sourcefile | Compiles the C program in sourcefile and creates a Unix binary command. If the -g flag is specified, includes debug information in the command. If the -o flag is specified, writes the binary command to outputfile. If the -o flag is not specified, writes the binary to a file in the current directory called a.out. |
| gdb | executable-file | Creates a debuging environment to debug the command specified in executable-file. In this environment, gdb presents a prompt: (gdb), and opens the terminal to read gdb sub-commands. A short list of gdb sub-commands is presented below. |
| Symbol | Meaning |
|---|---|
| . | Current Directory |
| .. | Parent of the Current Directory |
| ~ | Home Directory (usually /home/userid) |
| - | Previous Current Directory but only for "cd" |
The default prompt string is of the form machine:current_directory> where:
The following table highlights some of the more important sub-commands that can be typed in response to the (gdb) prompt under the gdb debugger. Most commands can be abbreviated, and the list below shows the shortest valid abbreviation, but specifies the rest of the full command in square brackets. For instance, the help command can be specified by typing "h", "he", "hel", or "help".
| Subcommand | Arguments | Description |
|---|---|---|
| h[elp] | [topic] | If topic is not specified, provides a list of help topics. If topis is specified, provides GDB help for that topic. |
| q[uit] | Exit the GDB debugging environment. | |
| l[ist] | [line_number] | Prints about 10 lines of the source code for the command to the terminal. If a line number is specified as an argument, starts at that line number. If not, prints the next 10 lines after the last list command (starts at the beginning of the file the first time.) |
| b[reakpoint] | line_number | Sets a breakpoint at the specified line number. The next "continue" or "run" command will stop and present a GDB prompt just before execution gets to the specified line, if that line will get executed. |
| r[un] | command_argument_list | Runs the command specified as a GDB argument, using the argument list specified as an argument to the run subcommand. If no breakpoints are set, the command will run to completion, or until it is interrupted (e.g. when a bug causes a segmentation violation.) If a breakpoint is set, and gdb gets to that breakpoint, gdb will stop execution at that breakpoint and prompt for further action. |
| c[ontinue] | Continue execution from the current line until the next breakpoint is reached, or the program finishes, or an interupt such as a segmentation violation occurs. | |
| s[tep] | Run a single line of the source code, and prompt before the next debuggable instruction. If the line invokes a debuggable function, stop at the first executable line in that function. If the line invokes a function which is not debuggable, such as a library function like printf that was not compiled with the debug flag turned on, that function is executed, but gdb won't stop until that function returns. | |
| n[ext] | Run a single line of the source code, and prompt before the next debuggable instruction. If the line invokes a function, execute that function, and stop when that function returns. | |
| p[rint] | variable_or_expression | Prints the value of the specified variable or expression to the screen |
| whe[re] | Prints the stack of function calls, including the name of the function, the argument list to that function, and the line number where that function starts. | |
| In GDB, and empty line indicates to re-execute the last command. This is especially useful when the last command was next or step or continue. |