Navigate to the home directory, then enter the pwd command. This is the full name of your home directory. This tells you that you are in a directory called dcuser , which sits inside a directory called home which sits inside the very top directory in the hierarchy. More on root and home in the next section. This jumps forward multiple levels to the. Now go back to the home directory. You can also navigate to the. These two commands have the same effect, they both take us to the.
The first uses the absolute path, giving the full address from the home directory. The second uses a relative path, giving only the address from the working directory. A relative path does not. A relative path is like getting directions from someone on the street.
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. If you want to search specifically for, say binary, then you can use the -b command line option.
For example:. Similarly, the -m and -s options are used in case you want to find manuals and sources. By default whereis tries to find files from hard-coded paths, which are defined with glob patterns.
However, if you want, you can limit the search using specific command line options. Note : Since you can pass multiple paths this way, the -f command line option terminates the directory list and signals the start of file names.
Similarly, if you want to limit manual or source searches, you can use the -M and -S command line options. For whereis, a command becomes unusual if it does not have just one entry of each explicitly requested type.
For example, commands with no documentation available, or those with documentation in multiple places are considered unusual. The -u command line option, when used, makes whereis show the command names that have unusual entries. For example, the following command should display files in the current directory which have no documentation file, or more than one. Agreed, whereis is not the kind of command line tool that you'll require very frequently.
But when the situation arises, it definitely makes your life easy. We have just changed into a new directory. You can use these two commands to navigate around your computer. This is all good so far, but sometimes you might want to go deeper than one level in one command. We now know how to move forward. But how to go back up the directory tree? Type in your terminal:. Now do a pwd. You just went back one directory! Chaining works backwards too, so if you type cd..
If you want to go back to the home directory of your computer, simply type cd into the terminal. These are the basics of navigating around in the terminal. What else would we want to do in there? How about creating directories and files? Now use ls to see the contents of the home directory. You should see a new folder, temp there. You just created a new folder! As its name suggests, mkdir creates directories.
0コメント