Next  Previous   Index

Beside GMT commands, several Unix / MS-DOS commands are necessary for file operation.

Unix / OSX Terminal

Folder in hierarchical order.  e.g. /Users/yourhome/Desktoop/filename
cd /directory/
cd \directory\
Change directory.  Move to a folder
mv filename1 filename2
ren filename1 filename2
Change filename: filename1 is erased and filename2 is created.
cp  filename1 filename2
copy  filename1 filename2
Copy file.  The same file in another filename.  filename1 remains
rm filename
del filename Erase a file.  Use wild card [*] to erase multiple files.
cat filename
print filename
Output the contents of a file.  Default: to display,  > newfile, >> add to an existing file
ls /directory/
dir \directory\
Output a filelist in a directory.  ls -s [file size], ls -l [all details]
mkdir /directory/
md \directory\
Make new directory
rmdir /directory/
rd \directory\
Remove an empty directory
Output key input to display, or redirect to a file.
script1 | script2
"|" is called "pipe".  Send output of script 1 to process by script 2
command/script > file command/script > file
">" redirects output to a device.  Default is display.  Most commonly to a file.
command/script >> file
command/script >> file
">>" (double ">") appends output to an existing file.
ctrl + c
ctrl + c
Abort running command.
Show full path of present working directory
Request for temporal superuser privilege .  exit: return to your user privilege

Important remarks

1. A file without path (full description of directories and file name) is regarded as a file in current directory.
    OSX   [localhost:-]yourhome%cat myfile.txt  = %cat /Users/yourhome/myfile.txt
    DOS  c:\gmt341\share\dbase> print  = c:> print \gmt341\share\dbase\

2.  Upper and lower case
    Unix [OSX], MacOS: case-sensitive, displays correct case.
    Windows: Not case-sensitive but lower and upper cases are shown as you input for file/folder names.
    DOS: Not case-sensitive.

3.  Characters for file/directory names
    Unix [OSX]: a-z, A-Z, 0-9, and underscore "_".  Do not use space and other symbols [!@#$%^&*()_+-={}[]:;""<>?,./\|].
    Windows / Mac:  Loose restriction does apply, but following Unix rule is SAFE.
    Use lower case as far as possible to save time for finding a shift-key.

4.  File name extention
    Unix [OSX]:  Long name and long (more than 3 chars) extension, multiple dots "." are  OK.  
        Extension is the only way to distinguish file type.
    MacOS:  Use extension as far as possible for easy catetorization of files.  Change your habit.
    Windows:  Show extension and understand it.  There is no creator/filetpe information but extension (free to change).

5.  Privilege
    Unix [OSX] can control access privilege.  Write/Reade/eXecute privilege is set for Owner, Group, Guest.
    MacOS has privilege control only for AppleShare.  Subdirectories under /Users/youhome/GMT341/ are not Writable.
    Logging in as root, or su, Writing becomes possible.

6.  Line Break
    Unix [OSX Unix]: lf (line feed: \n), MacOS/OSX: cr (carriage return: \r), DOS: cr + lf
    DOS cannot read Unix and MacOS properly. All cr+lf.  Unix lf is not necessary.
    Unix cannot read OSX text.  Only lf is needed.
    DOS file edited in OSX should be saved in DOS line break.
    Change line break using Jedit (Mac) or Maruo (Win), or tr in Unix.

    Unix [OSX]

Next  Previous   Index