Editing
Software Onboarding/Working on the terminal
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=The directory tree= The command line and the directory tree and closely related. The directory tree is the collection of all of the files and folders on a system and the folders that contain them. A directory tree starts with the root directory, the directory that all other directories are a descendant of. In windows this is denoted by the '''C:\''' drive. In linux this root directory is denoted by the symbol '''/'''. A '''absolute path''' describes a way of traversing this tree to get from the root to a file of interest. A windows path may take the form '''C:\Users\username\Documents\file.txt''', indicating that the computer should start at the root, then move into the directory named Users, then into the directory named username, then into the directory named documents, and finally retrieve the file named file.txt. Each '\' indicates a step in the path. This symbol is called the ''separator''. A linux path might look like this: "/home/username/Documents/file.txt" the structure is largely the same, the path starts with the ''root'', and indicates several steps through the tree to get to a desired file. You'll notice in this case the separator is the '''/''' symbol. ==Relative paths and the working directory== It would be inconvenient if we had to refer to the absolute path every time we needed to reference a file. The terminal solves this by introducing the concept of a ''working directory''. The working directory is, unsurprisingly, the directory where you are currently working. Any time a path doesn't explicitly start at the root, it is known as a ''relative path''. Before a relative path is evaluated, the working directory is added to the beginning of it to construct an absolute path. For example, if I open a terminal in the directory "/home/username" I could refer to the previous text file as "Documents/file.txt". Notice the lack of a leading slash indicating this path is a relative path. The working directory and the relative path are added together to produce the same path as the previous absolute path, but with much less typing. ==Moving around the directory tree== We can change the current working directory with the command '''cd''' (change directory). We can view the current working directory with the command '''pwd''' (print working directory).
Summary:
Please note that all contributions to LairWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
LairWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information