cd | none | cd means "change directory" and with no option, this command will take you from wherever you are to your home directory |
cd | ~ ${HOME} | these two options are other ways to move from the current location to your home directory |
cd | .. ../ ./.. ./../ | move to the area "above" the current area NOTE: .. and . can be considered examples of metacharacters: the ".." means "the area above this area" and the "./" (and often simply ".") means "here" the optional /'s at the end of these options only serve as a visual reminder that you are indicating a directory with the .. nomenclature |
cd | directory ./directory | move to the area called directory which is within the current area |
cd | ../directory ./../directory | move to an area called directory which is in the area immediately above the current location |
cd | anyValidPath | move to a location specified by anyValidPath; these paths can be relative to the current location (as shown in the previous two examples where the valid path starts "here") or absolute (meaning that the path must start with a fixed location such as /, ${HOME} or ~) |
cd | - ${OLDPWD} | both these options mean "return to the area you were in immediately before the current area"; if there is no previous area (i.e., if you have never moved from your home location), cd with either option produces an error indicating that OLDPWD is not set |
pwd | none | pwd comes from the phrase "print working directory," which tells the computer to "show the current location" |
ls | none | ls means "list" and with no options, this command will show all the regular files and directories in the current area |
ls | * | you might think that ls * would do the same thing as ls alone; however, ls * not only shows the regular files and directories in the current area, it also shows the contents of the directories it finds; fortunately, this command will not regress into the directories it finds, and so this is not a way to show absolutely everything |
ls | -l | use a "long" listing format that shows things like file size, owner, file permissions, etc. |
ls | -a --all | include "hidden" files and directories in the listing; examples of hidden files are things like the .modules file that controls which modules are loaded when you log onto the system, the .etomo file created in your home directory when you run IMOD programs via the etomo graphical user interface (GUI) and the .ssh directory where information related to the use of secure shell can be found |
ls | -s -sh or -s -h | show files and directories, including their size (-s, for "size") or including their size shown in an easy-to-read format (-sh, for "size" and "human readable") |
ls | -t -tr or -t -r | show files and directories in the order of their time of creation, starting with the most recent files first (-t, for "time") or with the most recent files last (-tr, for both "time" and "reverse") |
ls | -S -Sr or -S -r | show files and directories using an order that is based on size, starting with the largest first (-S, for "sort by size") or with the largest last (-Sr, for "sort by size" and "reverse") |
ls | file(s) | show specific file(s); most often used in conjunction with various wildcards; for example, the following will give the long listing for all files that start with "d" and end with ".txt" in the directory above the current location $ ls -l ./../d*.txt |
mkdir | dir | mkdir comes from "make directory" and this example creates a directory called dir; you can create multiple directories at the same time using a command such as $ mkdir Images Spectra Text which creates three directories within the current area |
mkdir | -p name | create a directory called name, where name includes the path to the directory you want to create; the -p option (from "path") tells mkdir to create any sub-directories that are part of name and that also need to be created; for example, if you want to create a sub-area called May_16_2013 within another sub-area called myResults, you can create both areas using $ mkdir -p myResults/May_16_2013 if the myResults area did not already exist, and you tried this command without including the -p option, the command would simply fail |
cat | file(s) | cat comes from "concatenate file(s) and print the result to stdout"; this is normally used to print the content of file(s) to the screen; the output from cat is an uninterrupted stream of information (i.e., output is not broken into units of text as occurs with a terminal paging program like more or less) |
more | file(s) | show contents of file(s) on the screen; the output is displayed in "screenfuls" (so the user can read a screen of text and then move to the next screen), and the name more is related to seeing "more and more" of file(s) as you move through the output (and to the fact that when more is displaying file(s), the word "more" appears in the lower left corner of the terminal) |
less | file(s) | less comes from the "opposite of more," which in this case means that it does similar things to more, but is considerably more powerful and often faster; more and less are generically known as terminal pagers |
cp | file1 file2 | cp comes from "copy" and is the command to make a copy of file1 called file2 |
cp | file(s) dir | cp used with a single file (or a series of files) and ending with a directory means "copy the file(s) into the directory called dir" (and in this simple example, both the files and the target directory must exist in the current location); if the last item in the series of files is not a directory, most systems will warn you that the last entry is not a directory and nothing will happen; in some cases, such a command will cause bad things to happen... |
cp | -r dir1 dir2 | cp -r (where the "r" comes from "recursively") is the command to copy an entire directory called dir1 to a new directory called dir2; it is also possible to copy one or more directories into an existing directory with a similar command $ cp -r dir1 dir2 dir3 targetDir this command copies the directories called dir1, dir2 and dir3 into another directory called targetDir (and remember that targetDir must already exist); the target directory could simply be "here" (./ or .), but keep in mind that this only makes sense if dir1, dir2 and dir3 are not already "here" (i.e., if they contain a path designation); also be aware that if you forget to add the target directory at the end, this command would cause dir1 and dir2 to be copied into dir3 |
mv | file1 file2 | mv comes from "move" and in this most simple form, mv is a way to rename file1 to the new name file2; if file2 already exists, it will be over-written (and lost) |
mv | file(s) dir | you can also use mv to transfer a file or files (and even directories) to a new location (a directory called dir); when used this way, the last item in the mv command must be a directory |
mv | -i file1 file2 | the -i option comes from "interactive" or "inquire" and indicates that before over-writing an existing file2, the user will be asked whether to do so or not |
mv | -n file1 file2 | the -n option comes from "no clobber" (and another way to invoke this is --no-clobber), which means do not ever over-write an existing file2; if you actually do want to over-write file2, you must not use the -n option |
ln | src dest | ln comes from "link" and is used to create a link (similar to a short-cut on a PC) between files; in this example, the existing file is called src (the "source file") and the link is called dest (the "destination file"); the original file and the linked "copy" can be anywhere on the computer which means that links are an easy way (for example) to share the same file in multiple places; this is different from making a copy of a file: copied files are distinct items to both the user and the computer, whereas linked files are the same item and with the exception a few commands such as deletion, anything done to one link simultaneously happens to all the links (i.e., if you modify the content of a linked file, all links are simultaneoulsy modified) |
ln | -s src dest | when ln -s is used, a "symbolic link" is created; this is the type of link that you should use most of the time if you are linking a file in a different location to the current area, you can use the following essentially equivalent commands $ ln -s $HOME/myFile myFile $ ln -s $HOME/myFile ./ $ ln -s $HOME/myFile . $ ln -s $HOME/myFile $ ln -s $HOME/myFile differentName (where the first four examples keep the original file name and the last one changes it) NOTE: since directories are just a special type of file, you create links to directories using exactly this same syntax if you are linking multiple files (or directories) from a different location to the current location, you must use syntax that says "link all these to here (. or ./)" $ ln -s $HOME/myImages_*.dm3 ./ $ ln -s $HOME/myFile $HOME/myData ./ one distinct advantage to using symbolic links is that an ls -l command will show both the name of the link and the file to which it is linked (whereas ls -l for a non-symbolic link shows the name of the link but does not show the file to which it is linked, making it hard to identify which files are actually links...); with the same ls -l command, the symbolic link will also show that little disk space is used by the link, while every non-symbolic link appears to use the same amount of space as the original file |
rm | file(s) | rm comes from "remove" and is the command to delete files; rm must have a target (and "rm *" is extremely dangerous!); fortunately, directories cannot be deleted using a simple rm command |
rmdir | dir(s) | rmdir comes from "remove directory" and rmdir dir(s) is equivalent to rm -r dir(s) (where the -r option means "recursively"); this command deletes every item within dir(s), including all sub-directories |
module | none | module is the command on Karst, Mason and Big Red II that manipulates the Modules system; when used without any options, the module command reports an error and then shows a listing of all possible options |
module | list | module list shows the currently loaded modules; the output is a numbered list of modules, where modules are identified using a moduleName/version syntax (e.g., python/2.7.3); in some cases, the module may be more complex and you might see something like openmpi/gnu/1.6.3; this shows the module's name (openmpi) and the version number (1.6.3) but also shows that this version of openmpi was compiled using the GNU compilers |
module | avail | module avail shows the modules that are currently available; some modules may be mutually exclusive (loading one will unload another), some may require loading additional modules in order to function and some may simply be different version numbers for the same module (for example, mathematica/8.0.4 and mathematica/9.0.1 are simply different versions of the same software package) the list of modules is broken into groups where the modules are thematically related; for example, Karst currently shows a group of modules that all have a statistical or mathematical function, another group intended for use by the life sciences community, a group related to software development, etc.; these groups make it a bit easier to search for modules that might be useful |
module | load mod unload mod | these two options load/unload a module called mod; you can either specify the entire name of the module (e.g., moduleName/version) or use the default version by specifying only the name; it is also possible to load (or unload) multiple modules at the same time $ module load freetype motif xpdf this example is from the .modules file useful with the cryoem package, where the xpdf module is dependent on both freetype and motif |
exit logout control-D | none | these three commands stop a terminal session (and will close a terminal window); they can also be used to terminate a shell session that was started within a terminal and various commands that "perform some action until a stop signal is sent"; the script command described below is such a command: the actions of script continue until one of these signals is sent |