<html lang="en"> <head> <title>Current Working Directory - GNU Octave</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="GNU Octave"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="System-Utilities.html#System-Utilities" title="System Utilities"> <link rel="prev" href="Environment-Variables.html#Environment-Variables" title="Environment Variables"> <link rel="next" href="Password-Database-Functions.html#Password-Database-Functions" title="Password Database Functions"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Current-Working-Directory"></a> <p> Next: <a rel="next" accesskey="n" href="Password-Database-Functions.html#Password-Database-Functions">Password Database Functions</a>, Previous: <a rel="previous" accesskey="p" href="Environment-Variables.html#Environment-Variables">Environment Variables</a>, Up: <a rel="up" accesskey="u" href="System-Utilities.html#System-Utilities">System Utilities</a> <hr> </div> <h3 class="section">36.8 Current Working Directory</h3> <!-- cd src/dirfns.cc --> <p><a name="doc_002dcd"></a> <div class="defun"> — Command: <b>cd</b><var> dir<a name="index-cd-3305"></a></var><br> — Command: <b>chdir</b><var> dir<a name="index-chdir-3306"></a></var><br> <blockquote><p>Change the current working directory to <var>dir</var>. If <var>dir</var> is omitted, the current directory is changed to the user's home directory. For example, <pre class="example"> cd ~/octave </pre> <p class="noindent">changes the current working directory to <samp><span class="file">~/octave</span></samp>. If the directory does not exist, an error message is printed and the working directory is not changed. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dmkdir.html#doc_002dmkdir">mkdir</a>, <a href="doc_002drmdir.html#doc_002drmdir">rmdir</a>, <a href="doc_002ddir.html#doc_002ddir">dir</a>. </p></blockquote></div> <!-- ls scripts/miscellaneous/ls.m --> <p><a name="doc_002dls"></a> <div class="defun"> — Command: <b>ls</b><var> options<a name="index-ls-3307"></a></var><br> <blockquote><p>List directory contents. For example: <pre class="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 </pre> <p>The <code>dir</code> and <code>ls</code> commands are implemented by calling your system's directory listing command, so the available options may vary from system to system. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddir.html#doc_002ddir">dir</a>, <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dreaddir.html#doc_002dreaddir">readdir</a>, <a href="doc_002dglob.html#doc_002dglob">glob</a>, <a href="doc_002dfilesep.html#doc_002dfilesep">filesep</a>, <a href="doc_002dls_005fcommand.html#doc_002dls_005fcommand">ls_command</a>. </p></blockquote></div> <!-- ls_command scripts/miscellaneous/ls_command.m --> <p><a name="doc_002dls_005fcommand"></a> <div class="defun"> — Function File: <var>val</var> = <b>ls_command</b> ()<var><a name="index-ls_005fcommand-3308"></a></var><br> — Function File: <var>old_val</var> = <b>ls_command</b> (<var>new_val</var>)<var><a name="index-ls_005fcommand-3309"></a></var><br> <blockquote><p>Query or set the shell command used by Octave's <code>ls</code> command. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dls.html#doc_002dls">ls</a>. </p></blockquote></div> <!-- dir scripts/miscellaneous/dir.m --> <p><a name="doc_002ddir"></a> <div class="defun"> — Function File: <b>dir</b> (<var>directory</var>)<var><a name="index-dir-3310"></a></var><br> — Function File: [<var>list</var>] = <b>dir</b> (<var>directory</var>)<var><a name="index-dir-3311"></a></var><br> <blockquote><p>Display file listing for directory <var>directory</var>. If a return value is requested, return a structure array with the fields <pre class="example"> name bytes date isdir statinfo </pre> <p class="noindent">where <code>statinfo</code> is the structure returned from <code>stat</code>. <p>If <var>directory</var> is not a directory, return information about the named <var>filename</var>. <var>directory</var> may be a list of directories specified either by name or with wildcard characters (like * and ?) which will be expanded with glob. <p>Note that for symbolic links, <code>dir</code> returns information about the file that the symbolic link points to instead of the link itself. However, if the link points to a nonexistent file, <code>dir</code> returns information about the link. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dls.html#doc_002dls">ls</a>, <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>, <a href="doc_002dreaddir.html#doc_002dreaddir">readdir</a>, <a href="doc_002dglob.html#doc_002dglob">glob</a>, <a href="doc_002dfilesep.html#doc_002dfilesep">filesep</a>. </p></blockquote></div> <!-- pwd src/dirfns.cc --> <p><a name="doc_002dpwd"></a> <div class="defun"> — Built-in Function: <b>pwd</b> ()<var><a name="index-pwd-3312"></a></var><br> <blockquote><p>Return the current working directory. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddir.html#doc_002ddir">dir</a>, <a href="doc_002dls.html#doc_002dls">ls</a>. </p></blockquote></div> </body></html>