Useful Commands
Total Page:16
File Type:pdf, Size:1020Kb
Useful Commands man or xman \man" and \xman" allowyou to see the manual pages for most system emacs The editor of choice. Basically,you must use emacs in class. The \other" editor is functions and commands. man ls, for instance, tells you almost everything you ever vi usually pronounced vee-eye and should b e approached with trepidation. You will wanted to know ab out the command \ls". You can also do keyword searches if you need a \.emacs" le which sets up your emacs environment. don't know the name of a command with \man -k"; for instance, man -k password g++ The GNU C++ compiler. g++ -o grade grade.cc will compile the C++ co de lists all commands that have to do with passwords. grade.cc and put the executable co de in grade. cd Allows you to change directories. The command cd with no arguments will cause you xxgdb The X-windows version of the GNU debugger for debugging C and C++ co de. Note to return to your home directory denoted by a tilde: ~. The command cd subdir that in order to use a debugger you must compile a program with the \-g" option, will place you into the sub directory, subdir. e.g., g++ -g -o foo foo.cc makes a debuggable executable named foo of the le CONCERNING PATH NAMES: There are absolute paths and there are relative foo.cc.You can also use gdb, a non-graphical version of the debugger paths. An absolute path starts at the ro ot of the system \/". For instance, the passwd Allows you to change your password. home directory for user ola has absolute path /afs/acpub.duke.edu/users8/ola. Shorthand for this home directory would b e ~ola. A relative path starts from the more Displays a le through a pager. The command more foo.cc will allow one to lo ok currentor working directory. If the working directory contains sub directory class, at the contents of \fo o.cc" one screen at a time. Another pager is less. you can \go" or change to that sub directory make it the working directory bytyping cd class whichismuch easier to typ e than the full absolute path. g nger Useful command for obtaining online information ab out other users. The command gfinger <username> will tell you the user's name, the last time and place the user mv Move a le from one lo cation to another. For example, the command mv foo.cc bar.cc logged in, and will print out that user's \.pro ject" and \.plan" les. Often p eople will will move the le foo.cc to the le bar.cc, e ectively renaming the le. If the last put their telephone numb er and other such stu in their \.plan". argumenttothemv command is a directory, les will b e moved into that directory, but keep the same name. For example, to move foo.cc into the sub directory class mail one of many mail programs. Don't use it. Find out ab out pine, elm, or one of the the command is mv foo.cc class.Tomove all les ending with .cc into the parent other common mail programs. directory the command is \mv *.cc .." since .. is the parent directory and * is the grep Useful command for searching for strings. If you typ e cat foo.cc | grep scores, wild carc character matching anything. the output will b e all the lines in foo.cc that have the string \scores" in them. You rm Removes a le. For example, rm foo.cc would delete the le foo.cc from the working can also achieve this e ect bytyping grep scores foo.cc. directory. ps Lists the pro cesses you have running. rmdir Removes an empty directory. kill Kills a pro cess. Using ps you can nd the pro cess number of a pro cess. Typing cp Copies a le, i.e., cp foo.cc bar.cc creates a new le bar.cc identical to foo.cc. kill -9 <process number> will kill it. Note that foo.cc still exists. wc Counts the numberofcharacters, words and lines in a le. mkdir Creates a new directory. The command mkdir sub makes the directory sub in the background, & Putting an amp ersand & after a command runs it in the background. currentworking directory. If you typ e emacs & then emacs will run, but the window in which you typ e the ls Lists the contents of the working directory. ls -a will list the contents of the working command will still receive and pro cess commands. Jobs that don't consume muchof directory including les which are pre xed with dot: . or p erio d. The command the CPU are often put in background editors fall into this category. ls -l is the long version of ls; it prints the lename, protections, creation date, and print prints a le on a \nearby" printer. The command print hello.cc will print the the size. Note that ls sub will list the contents of the sub directory sub if sub is a C++ le hello.cc sub directory. Using ls -F indicates which les are directories by app ending a / to them. These alternate ls forms take a long time to execute on the DEC stations. lpr prints a le. The format lpr -Pteerlp1 -Fl foo.cc to print on the printer named lp1 in the Teer cluster. The Fl ef-ell indicates a text le. fs setacl Changes the protections of a directory. For example, the command sequence fs setacl class system:anyuser none sets the protection on the directory named enscript alternate metho d for printing. The command enscript -2rG -Pteerlp1 foo.cc class so that no other user has access to it. The command fs setacl class ola rl prints the le foo.cc in Teer but uses a \rotated gaudy" format this save pap er and will allow user ola to rummage around lo ok at the directory class. lo oks go o d..