Moving around the file systemWe’ve learned how to use Use the commands we’ve learned so far to navigate to the
What if we want to move back up and out of this directory and to our top level directory? Can we type
Your computer looked for a directory or file called We have a special command to tell the computer to move us back or up one directory level. Now we can use
From this output, we can see that You can chain these together like so: prints the contents of
In most commands the flags can be combined together in no particular order to obtain the desired results/output. Examining the contents of other directoriesBy default, the Then enter the command:
This will list the contents of the The Try entering:
This will take you to the
Full vs. Relative PathsThe You will see: This is the full name of your home directory. This tells you that you are in a directory called Now enter the following command:
This jumps forward multiple levels to the You can also navigate to the These two commands have the same effect, they both take us to the A relative path is like getting directions from someone on the street. They tell you to “go right at the stop sign, and then turn left on Main Street”. That works great if you’re standing there together, but not so well if you’re trying to tell someone how to get there from another country. A full path is like GPS coordinates. It tells you exactly where something is no matter where you are right now. You can usually use either a full path or a relative path depending on what is most convenient. If we are in the home directory, it is more convenient to enter the full path. If we are in the working directory, it is more convenient to enter the relative path since it involves less typing. Over time, it will become easier for you to keep a mental note of the structure of the directories that you are using and how to quickly navigate amongst them.
Navigational ShortcutsThe root directory is the highest level
directory in your file system and contains files that are important for your computer to perform its daily work. While you will be using the root ( Then enter the command: This prints the contents of your home directory, without you needing to type the full path. The commands
Which command will change the working directory to temp if the current working directory is home student?The cd command, also known as chdir (change directory), is a command-line shell command used to change the current working directory in various operating systems.
How do I go back to current directory?File & Directory Commands. To navigate into the root directory, use "cd /". To navigate to your home directory, use "cd" or "cd ~". To navigate up one directory level, use "cd ..". To navigate to the previous directory (or back), use "cd -". Which commands list the contents of the current working directory?The ls command ( lowercase L and lowercase S ) lists the contents of your current working directory.
Which command should you use to display the current path of your current directory?Use the pwd command to write to standard output the full path name of your current directory (from the /(root) directory). All directories are separated by a slash (/).
|