<<

GG 710S - Remote Sensing in Submarine Environment: commands discussed in class

A continually evolving list of the commands that we use in the classroom. Commands are listed in alphabetical order with a very brief description, example (and potentially warnings). To learn , check for manual pages.

------* - wildcard character. The shell interprets * to mean “any string of characters”. Example: *.nav will list all files that end in “.nav”. ------| - pipe. A pipe is a way to connect the output of one program to the input of another program without creating a temporary . people consider the pipe concept to be one of the fundamental contributions of the UNIX system. Example: od –d unknown.file | more ------!! – Repeat the previous command line. ------!$ – Insert the final argument in the previous command line into this command line. Example: more file.nav psxy –R 0/10/30/40 –JX8 !$ > file. ------^string1^string2 – Replace string1 in the previous command line with string2. Example: gg710/Lecture1 ^1^01^ (new command line will be cd gg710/Lecture01) ------ – create a shorthand notation for a command or series of commands Example: alias gg710 “cd /home/pele4e/margo/gg710” alias lec01 “cd /home/pele4e/margo/gg710/lec01” alias lec02 “cd /home/pele4e/margo/gg710/lec02” Now if you lec02 you will yourself in directory /home/pele4e/margo/gg710/lec02.

Type: alias To see a list of the aliases you have set. If you have aliases that you want to use a lot, put them in a file called “.alias” in your home directory, and source that when you log in. ------ – pattern scanning and processing language. We will develop many examples of using awk of the course of the semester, some of will be listed on this page. Example: awk ‘{print NR, $9, $8}’ file.nav | more Used for printing the line number (counter), ninth and eighth fields of a navigation file. ------ – prints the contents of all of the files named by its arguments. Example: cat Lecture01.nav Warning: You will likely mess up your terminal window if you cat binary files. ------cd – change directory Examples: cd cd gg710/Lecture01 The first command will return you to your home directory, the second will move you into subdirectories called “gg710/Lecture” assuming they are in the present working directory. ------ a copy of a file. Example: cp Lecture01.nav Lecture01.nav.safe ------ – cut out selected fields from each line of a file. Example: cut –f1,3 Lecture01.nav will cut out columns 1 and 3 of Lecture01.nav ------file – manipulate a file’s name and attributes Example: file *.* This will provide a list of all files in a directory, including their file type. ------ – print out a list of recent commands Example: history 10 will print a list of the last ten commands that you typed. ------ – prints the contents of all of the files named by its arguments one screenfull (or line) a . more will allow you to scroll up and down through ASCII files using the arrow keys. Example: less *.nav ------ls – list the names of files in the present directory. Example: ls *.nav ------man – show the manual () page for the listed command. Example: man od ------ – make a new directory. Example: mkdir gg710 ------more – prints the contents of all of the files named by its arguments one screenfull (or line) at a time. more will allow you to scroll down (not up) through ASCII files using the space bar or return key. Example: more *.nav ------ – move a file to another file or to a directory Example: mv Lecture01.nav Lecture01.nav.safe The difference between cp and mv is that the former generates a duplicate file; the latter either renames the file or puts it into a different directory. Like , mv can overwrite files that you may wish to keep, so it’s generally a good idea to alias mv “mv –i”. ------od – octal . Copies the contents of each input file to standard output, transforming the input data format to an output format that is specified in the command line. Example: od -d unknown.file Will output every two bytes of data as unsigned decimals. ------ – paste together corresponding lines of the input files Example: paste Lecture01.nav Lecture02.nav will output the columns in Lecture01.nav and the columns of Lecture02.nav on a line by line basis. ------rm – remove a file. Example: rm unknown.file Warning: Be VERY careful using the wildcard with the rm command – you could lose a lot of your work. In general it is good to alias rm to “rm –i” which forces the rm program to ask you if you really want to remove the file. This can be a pain when you are deleting a lot of files, but it’s better than having to recreate your work. NEVER type “rm *” unless you really, really want to ruin your day. ------ – remove a directory. Example: rmdir gg710 Warning: If there are files in the directory you are trying to remove, rmdir will complain. ------unalias – remove a shorthand notation for a command or series of commands Example: unalias gg710 Now if you type “gg710” you’ll get the message: “gg710: Command not found.”