- publishing free software manuals
GNU Octave Manual Version 3
by John W. Eaton, David Bateman, Søren Hauberg
Paperback (6"x9"), 568 pages
ISBN 095461206X
RRP £24.95 ($39.95)

Get a printed copy>>>

32.8 Current Working Directory

Command: cd dir
Command: chdir dir
Change the current working directory to dir. If dir is omitted, the current directory is changed to the user's home directory. For example,

cd ~/octave

Changes the current working directory to ‘~/octave’. If the directory does not exist, an error message is printed and the working directory is not changed.

See also mkdir, rmdir, dir

Command: ls options
List directory contents. For example,

ls -l
-| total 12
-| -rw-r--r--   1 jwe  users  4488 Aug 19 04:02 foo.m
-| -rw-r--r--   1 jwe  users  1315 Aug 17 23:14 bar.m

The dir and ls commands are implemented by calling your system's directory listing command, so the available options may vary from system to system.

See also dir, stat, readdir, glob, filesep, ls_command

Function File: old_cmd = ls_command (cmd)
Set or return the shell command used by Octave's ls command. The value of cmd must be a character string. With no arguments, simply return the previous value.

See also ls

Function File: dir (directory)
Function File: [list] = dir (directory)
Display file listing for directory directory. If a return value is requested, return a structure array with the fields

name
bytes
date
isdir
statinfo

in which statinfo is the structure returned from stat.

If directory is not a directory, return information about the named filename. directory may be a list of directories specified either by name or with wildcard characters (like * and ?) which will be expanded with glob.

Note that for symbolic links, dir returns information about the file that a symbolic link points to instead of the link itself. However, if the link points to a nonexistent file, dir returns information about the link.

See also ls, stat, lstat, readdir, glob, filesep

Built-in Function: pwd ()
Return the current working directory.

See also dir, ls

ISBN 095461206XGNU Octave Manual Version 3See the print edition