2018-11-05 20:03:04 +00:00
|
|
|
---
|
|
|
|
layout: page
|
2018-11-10 21:05:37 +00:00
|
|
|
category-title: Basic commands
|
2018-11-08 19:52:08 +00:00
|
|
|
category-page: basic
|
2018-11-08 08:21:27 +00:00
|
|
|
tags: directory change navigate
|
2018-11-11 11:00:42 +00:00
|
|
|
author: Alessandro Marinelli
|
|
|
|
title: cd
|
2018-11-12 10:47:50 +00:00
|
|
|
previous-page: pages/cmd/basic/open.html
|
2018-11-09 18:42:56 +00:00
|
|
|
next-page: pages/cmd/basic/ls.html
|
2018-11-05 20:03:04 +00:00
|
|
|
---
|
2018-11-12 10:47:50 +00:00
|
|
|
<p>
|
|
|
|
The <code>cd</code> command is used to change the working directory<br>
|
|
|
|
The name stands for <i>Change Directory</i>.<br>
|
2018-11-08 08:06:13 +00:00
|
|
|
|
2018-11-12 10:47:50 +00:00
|
|
|
The default cd command syntax is:
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
cd [flags] [path]
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
Where [flags] are the cd flags, read below for more info,and [path] is the
|
|
|
|
path (absolute or relative), of the directory which we want to make as working directory.<br><br>
|
|
|
|
|
|
|
|
<h3>Change the working directory</h3>
|
|
|
|
Let's see how to use the command <code>cd</code> in order to change the working directory
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
pwd
|
|
|
|
~
|
|
|
|
cd Desktop/multimedia
|
|
|
|
pwd
|
|
|
|
~/Desktop/multimedia
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
As you can see, we changed the working directory from ~ (which stands for HOME),
|
|
|
|
to "multimedia". Now our Shell will work on the directory "multimedia"
|
|
|
|
until a new <code>cd</code> will occour.<br>
|
|
|
|
|
|
|
|
<b> Notice:</b> If you want to move to a directory which is not contained in the
|
|
|
|
current working directory, you <u>MUST</u> use the absolute path.
|
|
|
|
</p>
|