![]() ![]() It might seem odd to have a special command representing a state of no change, but it’s a usefully explicit directive. Remember that a single dot means don’t move, and it does exactly that: $ pwd You can get your current location at any time with the pwd (print working directory) command: $ pwd To get from one room to the other, you must go back to the common area using the step back control sequence, and then step forward into the other. For instance, knowing that you have a home directory that contains both a Pictures and a Documents folder, you can visualize each subdirectory as a step forward from home: It may help to visualize each directory as a room in a house. These dots work best when you’re somewhat familiar with what’s on your drive, and provided that you can visualize the corresponding paths. Relative paths use two control sequences: the single (. Documents instead of cd /home/seth/Documents. If a web designer knows they keep web fonts in a local directory and they link to those fonts on their development laptop using the absolute path /home/webdev/Public/ then all of their links break when the code is pushed to /var/Besides that, sometimes it really is quicker and easier to type cd. For instance, you can never be sure of a web server’s absolute path. That said, relative paths can be convenient, and in some cases vital. ![]() With auto-completion, typing a full path can be as quick as using a relative path, especially with autocompletion. If you can navigate your drive from absolute paths, then use that as a wayfinder. There are many valid reasons to use absolute paths, not the least of which is their clarity. That fact doesn’t mean absolute paths are bad, though. It represents your hard drive’s base level, which contains the home directory, which in turn contains seth (my username).Īnything starting with a forward slash is an absolute path, which is the digital equivalent of you going 12 blocks back home just to reach a location that’s two blocks away from where you are now. For that reason, the path /home/seth (and its shorthand version ~, although that’s less clear, because it lacks the leftmost slash) is considered an absolute path. You know that you’ve reached the start by a lone forward slash ( /) with nothing to its left, because your drive’s root level is the biggest container, holding all your folders and files within it. 10 command-line tools for data analysis in LinuxĬonversely, absolute paths always begin from the start of your hard drive.
0 Comments
Leave a Reply. |