Chapter 3: Linux Basic Commands
3.2 Navigation
Come on, let's try it now. Log in to any Linux machine (or your EC2 instance) and type these commands with me.
चला, आता ट्राय करूया. कोणत्याही Linux मशीनवर (किंवा तुमच्या EC2 instance वर) लॉगिन करा आणि माझ्यासोबत या कमांड्स टाइप करा.
चलो, अब ट्राय करते हैं. किसी भी Linux मशीन पर (या अपने EC2 instance पर) लॉगिन करो और मेरे साथ ये कमांड्स टाइप करो.
| Command | Meaning | Example |
|---|---|---|
pwd |
Print working (current) directory | pwd → /home/ubuntu |
ls |
List files | ls, ls -l, ls -la, ls -lh /var/log |
cd |
Change directory | cd /etc, cd .., cd ~, cd - |
tree |
Show folder tree (install package tree) |
tree -L 2 /etc/nginx |
clear |
Clear the screen (or press Ctrl+L) | |
history |
Previous commands | history | tail -n 20. Read any recalled command before running it. |
pwd # where am I?
ls -la # long listing including hidden files (starting with .)
cd /var/log # absolute path (starts with /)
cd ../www # relative path (.. = parent, . = current)
cd ~ # go to home directory (same as just 'cd')
cd - # go back to the previous directory
Understanding ls -l output:
-rw-r--r-- 1 ec2-user ec2-user 1024 Mar 3 10:15 notes.txt
│└──┬───┘ │ └──┬───┘ └──┬───┘ └┬─┘ └─────┬────┘ └───┬───┘
│ permissions links owner group size modified time name
└─ type: - file, d directory, l symbolic link
Keyboard shortcuts that save hours
Tab auto-completes file and command names (press twice to see options). ↑ / ↓ scroll through history. Ctrl+C stops a running command. Ctrl+R searches history. Ctrl+A / Ctrl+E jump to start / end of line.
Ravindra Bagale's Tip
Many students type every path fully by hand and get the spelling wrong. Press Tab to ask the shell for a completion. If it shows nothing, verify the directory, spelling and completion settings. Use cd - to go back to the previous folder, and always check "where am I" with pwd.
Ravindra Bagale's Tip – मराठी
बरेच students प्रत्येक path पूर्ण हाताने type करतात आणि spelling चुकवतात. नाव पूर्ण करण्यासाठी shell मध्ये Tab दाबा. काही दिसलं नाही तर directory, spelling आणि completion settings तपासा. cd - ने मागच्या folder मध्ये परत जा, आणि pwd ने नेहमी "मी कुठे आहे" हे check करा.
Ravindra Bagale's Tip – हिंदी
बहुत से students हर path पूरा हाथ से type करते हैं और spelling गलत कर देते हैं. नाम पूरा करने के लिए shell में Tab दबाएँ। कुछ न दिखे तो directory, spelling और completion settings जाँचें। cd - से पिछले folder में वापस जाओ, और pwd से हमेशा "मैं कहाँ हूँ" check करो.
Lab
Chala, cd /var/log kara, ls -lh chalva aani sagalyat mothi file konti te shodha. Mag cd - ne parat ya, history | tail -n 5 bagha. Ek safe listing command parat chalvaycha asel tar आधी पूर्ण command आणि त्याचा path तपासा.
Find the product photo before you open it
Mauli Dairy has one folder with new product photos, one folder for the current page and one with old photos the designer still needs. The coordinator says “find the yoghurt photo” and gives you only a filename. In a desktop file manager you might walk through the folders, check the window title and open a preview. In the terminal you make the same choices in text. This lesson is about knowing where you are and where a path leads before you run a command on it.
There is a particular skill to learn before you memorise more commands. At the moment you type a path, you should be able to trace each part from a starting folder to the intended file. You should also know how to prove it. The three basic tools in this lesson separate those needs. pwd tells you the working directory. ls shows entries and their details. cd moves the shell to another directory. Read, decide and move in that order when an unfamiliar tree makes you unsure.
The exercises use a new workspace and plain text stand-ins for photos. No website receives them. You can use a disposable Linux machine running Bash, or keep the example tree in your notes and predict its outputs. When you use the terminal on your own account, identify the host and current directory before you create the folder. A capable learner can explain how they found the right path even when their home directory and sample names differ from someone else's.
Make a folder tree you can draw
A directory entry is a name inside a directory. The name can describe another directory, a regular file, a link or another kind of object. Draw a small tree with a top folder called catalogue, and two subdirectories called current and archive. Inside current draw a photos folder. Inside archive draw a folder named last season. Give the photos folder a sample called yoghurt label.txt. A name with an internal space is intentional: we will practise keeping that value together when we type it.
catalogue=$(mktemp -d "$HOME/catalogue-paths.XXXXXXXX") &&
cd -- "$catalogue" &&
mkdir -p -- current/photos 'archive/last season' &&
printf '%s\n' 'Yoghurt label, current design' > 'current/photos/yoghurt label.txt' &&
printf '%s\n' 'Yoghurt label, previous design' > 'archive/last season/yoghurt label.txt' &&
printf 'Workspace is %s\n' "$catalogue"
The folder name printed at the end is the starting point for the next examples. mktemp -d created a directory with an unpredictable suffix. We use that individual directory so a second attempt need not replace the first. The variable holds the exact created path. Since the setup uses the double ampersand between commands, it stops moving to later operations when the previous one fails. Check the printed result and compare it with the home path on your machine.
The mkdir -p command can create leading directories that are missing for the requested paths. In this example the current and archive directories appear as needed, together with their children. Notice that single quotes around archive/last season keep that whole path as one argument. The slash still describes a relationship in the path. The space stays in the second component. After the setup, draw the structure beside your prompt and put a pencil mark next to the current directory. Compare it with pwd instead of assuming the last printed word is your location.
pwd
ls -- .
ls -- current
ls -- current/photos
ls -- 'archive/last season'
Read the lines in order. The first should print the workspace, including its unique suffix. The first listing should show current and archive. The second should show photos. The third and fourth should each show a file called yoghurt label.txt. These are two directory entries with the same final component under different parent directories. The name of the file alone is not enough to tell you which version you found.
Tell a classmate what would happen if you only typed ls after setup. By default it lists the current directory. It does not change the current directory. Then ask which listing allows them to distinguish the files with the same basename. The answer uses the differing parent components. This is a key idea for deployment and backups: filenames are meaningful inside a folder. When you need to identify one particular file, retain the path that leads to it.
Trace an absolute or relative path on paper
An absolute path starts with a slash. The first slash selects the root directory visible to the process. Each named component then leads to a child entry. In the lab, the absolute path stored in catalogue might include a home directory, your login name and the newly generated folder name. Appending /current/photos to that path gives a location you can select even if your shell is currently somewhere else. You still need access to all the relevant directories.
A relative path starts from the current working directory. Suppose your mark on the drawing is at the catalogue root. The relative path current/photos moves down one directory at a time. After entering photos, the same path would ask for a child named current beneath photos, which our exercise did not create. The leading slash makes the difference when you read an operand. Before deciding if a relative path is right, say what its starting directory is.
The dot names the current directory, and the double dot names the parent in ordinary path resolution. From current/photos, .. reaches current, and ../.. reaches the catalogue root in this simple tree without links. To reach archive/last season from photos, go up twice and then down the archive branch. Follow the move on your tree before typing it. No character in a relative path can supply a missing starting point, so use pwd whenever you did not observe the last directory change.
cd -- "$catalogue" &&
cd -- ./current/photos &&
pwd &&
ls -- '../../archive/last season' &&
cat -- '../../archive/last season/yoghurt label.txt'
The working path should end in current/photos. The listing reads the other branch and does not move you. The last command should show “Yoghurt label, previous design.” Re-run pwd afterward and check that you stayed in photos. This is the difference between asking a command to use a path and asking the shell to change its working directory. You can gather a record from another branch while keeping the context for the next command.
Now try an absolute path to the current sample. Use the quoted expression "$catalogue/current/photos/yoghurt label.txt" as the operand to cat. Bash substitutes the value of the variable and keeps the entire result together. The text in the file should say current design even if the terminal is still in photos or moved to archive. This observation verifies that you selected that branch from the root independently of the shell’s working location.
Sometimes a path used by an application is relative to a directory selected by that application, which can differ from the folder in your terminal. For our own shell commands, we can observe the shell's directory directly. When you maintain a service, check its documented working directory and configuration. A path that works when you type it interactively can fail for the service if it has a different starting directory or access. Write down the full resolved place in your notes when you share the evidence.
Read a listing as evidence about one path
A short listing answers which directory entries are visible for a folder. A long listing adds the type, mode, link count, owner, group, size, time and displayed name. Begin with the final name so you know the row is about your file. Then look back to the first character of the mode to see its type. A regular file usually starts with a dash and a directory starts with d. A symbolic link starts with l and a long listing can show where it points. The letters after the type signal mode bits, which the permissions lesson explains.
The size of a regular file in a plain long listing is typically shown as bytes. -h asks GNU tools to display a more readable scaled size when their selected listing form shows size. The directory row's size describes the directory object and should not be read as the sum of everything below it. For that separate question use an appropriate disk-usage command. In this lab, compare the two text files with the same basename by reading their contents and path. Their sizes and modification times are helpful clues, and they might still be the same on another fixture.
There is a useful distinction between listing a directory itself and listing the entries inside it. Run ls -ld -- current from the catalogue root and note the one row for current. Then run ls -l -- current and look for the row naming photos. The first uses -d to ask about the directory entry named as the operand. The second opens the directory to list entries. If you are checking who owns a directory, use the form that reports the directory itself.
Names beginning with a dot are typically left out of a default directory listing. They can still be seen through an explicit path or an option such as -a. Dot names are a naming convention for keeping everyday listings tidy. They receive ordinary permission checks just like other entries. In the lab, add one private exercise note called .review-note to the workspace and compare listings before and after using -a. The expected result is that the note appears in the full listing while it did not appear in the ordinary one.
cd -- "$catalogue" &&
printf '%s\n' 'Training note: keep both label versions' > '.review-note' &&
ls &&
ls -la &&
ls -ld -- current current/photos
Both current and archive remain visible, and the full listing now includes the exercise note. It can also show entries for the current directory and its parent. Compare the two long rows for current and current/photos. On your own machine the names and permissions will depend on who created them and the file creation defaults. Use the dimensions of the observation we predict, such as the row's type and name, rather than expecting the same exact owner or date as in another student's screenshot.
A listing can be sorted or filtered by settings and options. ls -lt uses modification time in its sort order. A file's modification time measures a filesystem timestamp for the contents, not proof of who wrote it or where the server served it. Ask for a listing of a known directory when you want to know what is currently present. For histories, keep separate evidence such as backup copies or version-control records. The lesson focuses on using the listing to find and verify the next path.
Move between folders on purpose
cd is a shell builtin in Bash. It changes the current shell’s working directory so later relative names start from there. If you run a separate child program that changes directory internally, your parent shell’s location normally stays put. This explains why a fresh terminal window does not automatically follow moves in another window. Each has its own shell and can be at a different starting point. Try opening a second terminal and use pwd in both before sharing commands between them.
Running cd without an operand uses the shell’s home directory value. An unquoted ~ at the beginning of a normal argument can also expand to the home path. A quoted string containing a tilde can remain literal. If you want an explicitly quoted absolute form derived from a variable, use "$HOME". These examples all describe the current shell's user context. A service, another user and a different host can have different home paths. Use the actual path if someone else will reproduce your command.
cd - uses the previously recorded directory and normally prints the selected directory when the change succeeds. It is useful for swapping between two known places, such as current photos and last season’s archive. It is not a list of every path you ever visited. In a new shell there may be no previous directory recorded. Try moving between the two exercise folders, and track the previous and current values yourself. Before copying a file after a swap, run pwd again to see which branch you are in now.
cd -- "$catalogue/current/photos" &&
cd -- "$catalogue/archive/last season" &&
printf 'Today: %s\nPrevious: %s\n' "$PWD" "$OLDPWD" &&
cd - &&
pwd
Read the two named values first. The current one should end at last season, and the recorded previous location should end at photos. The directory-change command then returns you to that photos path. The final output should agree. The printed words “Today” and “Previous” label our observations for this exercise. If you are passing a navigation sequence to another student, keep those outputs so they can see whether the move happened. A directory-change command can also finish quietly, giving you a reason to verify the result.
You will sometimes see cd folder && ls. Read the join as “carry on only if the change succeeded.” This is useful because a failed cd normally leaves you where you were. Running a following command unconditionally could list the wrong directory, or cause a later write to happen at that wrong location. In the lab, try a missing directory followed by pwd only after a successful move. You should see the error and no new working-directory output from the second part. Run a separate pwd to confirm the shell stayed put.
Keep names intact and follow shortcuts carefully
There are several ways to type a filename with a space. Quoting a path with single quotes keeps the shell from treating the space as another argument. Double quotes also keep an expanded variable together, which is useful when it holds a directory. A backslash can quote one following space in an unquoted part of a word. Choose a method you can read and verify. In the lab, 'archive/last season' names one operand. Typing it without quotes can make the command look for archive/last and season separately.
Tabs and completion can be helpful after you type a few accurate characters. Bash and its line-editing settings determine how completions are shown. Sometimes a completion is unique and gets filled in. Sometimes it is ambiguous and you can request the list of candidates. Sometimes the mode, context, missing package completions or access prevents a match appearing. When completion is inconclusive, use a directory listing and check which characters you typed. Try a path with spaces and notice how your shell quotes or escapes it before you press Enter.
A symbolic link is a special entry holding a path to another object. A short name can be used to visit a longer path. In a site layout, a shortcut named latest could point to a release directory. You might see the short name in a report while the actual files are stored elsewhere. Use a lab link before making any assumptions. We will create one inside our scratch folder with a relative target. Because the target is relative, it is interpreted from the directory containing the link when the system follows it.
cd -- "$catalogue" &&
test ! -e latest && test ! -L latest &&
ln -s -- current/photos latest &&
ls -ld -- latest &&
cd -- latest &&
pwd -L &&
pwd -P &&
cat -- 'yoghurt label.txt'
The two tests check that the shortcut name is unused before creating it. If an entry named latest already exists in your scratch folder, inspect it before choosing a new name or returning to a fresh workspace. The link entry should show a target like current/photos. In a regular Bash session with logical directory handling, pwd -L can show the path through latest. pwd -P can show the physical directory ending in current/photos. Both are observations about the same directory reached through different presentations. The file read should still return the current-design sample. If your Bash uses physical behavior for directory changes, both readings can show the physical path. Read your actual output and explain how the shell is set up.
When a path contains a link, pay special attention to the meaning of going up. Logical navigation in Bash can follow the textual path used to reach the folder when handling ... Physical navigation follows the filesystem path. In our lab the parent of the link name is the catalogue root, and the parent of the physical photos directory is current. Compare these using separate disposable subshells, then return to the lab root using its absolute path. You do not need to model every implementation detail to keep the useful habit: check the logical and physical location before acting on a shortcut.
If a shortcut points to a renamed or missing target, the link entry can still be present while a command following it returns an error. ls -ld checks the link entry in the parent directory. A listing or file read through the link checks the target path. Those two observations are helpful together. In an application setting, identify whether you are fixing the link, its stored target, or the content itself. For this lab, keep both file versions and the link until you finish the checks.
Tell a missing path from an inaccessible one
When an ordinary Linux command opens a path, the system walks its components from the selected starting directory. If a required component does not exist, you can see “No such file or directory.” If a middle component is a regular file where the path requires a directory, you can see “Not a directory.” If the process cannot search a directory that it must pass through, you can see “Permission denied.” Read the actual message before deciding about the target. A problem earlier in the path can prevent the system from reaching the final name at all.
Use the drawing to ask which component failed. If you are in photos and the command names archive directly, the first component is already wrong for that starting point. Run pwd before changing the command. Next, list the nearest parent that should exist. If the path to a photo contains yoghurt label.txt/backup, the final slash and following name ask to walk through a file as though it were a directory. The listing of its type explains why this cannot work.
A permission problem needs a different clue. You may have permission to traverse a directory with a known name and still be unable to list the names inside it, because listing and traversal use different directory rights. In an access exercise, observe the directory's mode and the user who is doing the check. If a separate review account receives an error at a parent directory, adjusting the file's own mode may not let them reach it. Follow the actual path to find the permission responsible.
In the catalogue, practise a controlled negative case without changing a system file. From the lab root, ask Bash to enter an exercise subdirectory that does not exist. Read the exit result immediately and compare pwd before and after. It should remain the same. Try a second case: enter the existing sample file as if it were a directory. Read the message in each case. Both moves are refused and point to different reasons. Observing clues is part of the exercise, even when the terminal prints a failure.
cd -- "$catalogue"
pwd
if cd -- './archive/no-such-season'; then
printf '%s\n' 'Unexpected: that path exists'
else
printf '%s\n' 'The directory change did not happen'
fi
pwd
if cd -- './current/photos/yoghurt label.txt'; then
printf '%s\n' 'Unexpected: that path is a directory'
else
printf '%s\n' 'The file could not be used as a directory'
fi
The first test uses an if to choose a message based on whether the attempted directory change succeeded. The conditions themselves are the commands we want to test. The lines under else describe expected failure in our known fixture. A real script might print an error and stop. If the first directory is unexpectedly present, confirm that you are using a newly made workspace. If the file is unexpectedly a directory, read the entries in the setup and identify what actually exists at that path.
Some people try a different spelling every time they hit an error. Instead, separate where you started from what you asked to open. Use a full path built from the root of your workspace when reproducing a failure. Then check the type and spelling of each component in order. Record which component was the last one you could confirm. This produces a useful report even when you do not have permission to repair the problem yourself. A colleague with the right role can repeat the exact check.
Use the keyboard to inspect before executing
Shell history can help you find a command you ran earlier. When Bash is configured for history, the up arrow or a search shortcut can bring an earlier line into the editor. Read the full command before pressing Enter. It may include a relative path that was safe in another directory, a different host name, or a flag that wrote a file. Command history describes earlier input. The machine, current directory and files can all be different when you reach the line again.
Use an exercise with a harmless listing. Run a long listing from the catalogue root. Move to current/photos. Use an arrow key to find the earlier listing line, but do not run it yet. Ask which folder it would list now. It lists photos if the line uses the default current directory. Then edit the line to include the absolute lab root as an operand and run it. The listing should match the root entries even if the working directory stays photos. This gives you control over whether you are repeating the text or repeating the intended operation.
In a Bash session with event expansion, syntax such as an exclamation mark and a history number can expand to earlier input. A number by itself does not tell you what the old command did. Use the history display or interactive editing to inspect a known safe command before entering it again. For class, the most useful habit is to select and read the whole input line. Do not put credentials or sensitive values into commands merely so they can be retrieved from history later. History may persist across sessions depending on the setup.
Clearing the visible terminal display can make a busy exercise easier to read. It does not undo any commands or remove files. Likewise, pressing Ctrl+C often sends an interrupt to the foreground program. The program may handle that notification, and work already completed before the interruption can remain in place. For a harmless example, run a brief waiting command and interrupt it before it finishes. Confirm your shell accepts a new command afterward. Recheck any lab output you expected a real command to produce if you ever interrupt it midway.
Tab completion, command recall and simple movement keys are conveniences while you type. Treat a complete-looking line as a draft until you have read it. The safest way to use these tools is to pause at the end of the line and say which command, which options and which path you are giving the shell. Keep the distinction between the text shown on screen and the effect it will have after Enter. This helps both beginner assessments and real work on a server.
Build a short view instead of dumping every folder
On some Linux machines you can use the optional tree command to list a folder hierarchy. A shallow depth makes the result easier to read. The top line is your starting folder, and each branch shows one child path. Use the visual shape to predict where another relative path should lead. If the command is absent, first decide whether you need it. An ordinary listing of the lab's two branches can already answer which file names exist. Learn the map with the commands you have.
Recursive listings can be large. In a real support case, start from the branch relevant to the question and limit what you inspect. For the dairy example, there is no reason to list every system directory when the question is which label draft belongs in current photos. A short listing can give enough evidence and is easier to share without including unrelated information. If a directory is too large to inspect quickly, use a tool that narrows the selection by a known path or specific name.
GNU find can list paths that match conditions. For this beginner exercise, use it only to read the workspace and match a literal-looking basename. Give it the starting directory explicitly so it does not walk from an accidental location. Quote the desired basename as one argument. In the sample there should be two lines ending in the same filename, one under photos and one under the seasonal archive. A matching name is only the first clue. Read a small piece of each file to determine which version you found.
find "$catalogue/current" "$catalogue/archive" -type f -name 'yoghurt label.txt' -print
Read the starting point in each result. The two names identify paths under separate folders. The -type f part limits the result to regular files. The -name part matches the final name according to the pattern it receives. By quoting the name, you prevent the shell from breaking the space into separate words. This invocation only prints the found paths. The search result can help you form the next command, but you should still quote each selected path when you use it.
What if a file is named something you cannot identify from a quick listing? Use a smaller space and try constructing the result yourself, rather than jumping into an unfamiliar recursive command. In the lab, count what you know: there should be two versions, and both names are the same. Write a command that starts from those two branches and then check the predicted number of matches. Your understanding of the folder layout makes the result useful. If a third result shows up, investigate which path makes it different before you touch it.
Find, verify and hand over the current label
Take the position of a trainee who arrives after the setup. You have the lab path written on a note and are currently in a new terminal. Your task is to find the current label, compare it with the previous version and explain why two commands with the same final filename gave different results. Start by recording the working directory you were given. Use the absolute workspace path to enter the catalogue. Draw the two relevant branches, then use a long listing to identify which entries are directories and which are files.
Open the exact file under current/photos and write down the text. Without leaving that folder, read the archived file by building the relative path from photos. Then use a full path for the archived file and compare the two readings of it. Both readings of the archive should give the same previous-design description. The current copy should give the current-design description. This is evidence that you can reach the same object from different starting points while distinguishing two files with the same final name.
If the lab link exists, compare the path reports through that link. Check its listing and then read the sample that resolves through it. If the target is the expected photos folder, the content should agree with the direct current path. Write the logical and physical paths beside each other. Explain to the coordinator which name is the shortcut and which place actually holds the file. If you do not have a link, ask how you would distinguish a link entry and a directory in a long listing before following either.
For the troubleshooting half, make exactly one command with a wrong component. Try looking for last season directly from within photos. Find the evidence showing why it failed, then correct it by going up twice before entering archive. You can also try mistyping the case of one component and report the filesystem's actual behavior. Identify whether the error described a missing component, a component of the wrong type, or denied access. This exercise is successful when you can explain how the system decided where to start and why it could not finish.
Hand over a two-paragraph note. In the first, write the machine and workspace, then identify the two paths and contents. In the second, explain one failed attempt and how you verified the corrected path. Keep the shape of the path and chosen spelling visible, including any whitespace. A beginner can recreate the notes with their own sample files without needing any production paths. That ability to communicate the starting point and result is the practical skill you will use again when deployment requires a destination check.
For cleanup, leave the exercise folder and compare its saved path with your notes. If you want to remove it, handle the known link as a separate entry, the disposable files by their exact paths, and the empty directories after verifying their contents. Inspect each branch so an asset you intended to keep is not mistaken for the sample. A null or absent variable is a reason to stop and rediscover the directory rather than guess. You can keep the workspace for the next lesson if you label it clearly as course data.
Explain how you find the right path
How do you know which folder a relative path uses?
I check the working directory of the process or shell that uses the path. For an interactive Bash command I use pwd. Then I read each path component from that starting directory. If the relative path belongs to a service, I check the service's working directory and documented behavior. I do not assume that my terminal folder matches the application's context.
What is the difference between ls -ld and ls -l on a directory?
The first asks for details about the named directory entry, which helps me check its owner, type and mode. The second normally lists details about the entries inside that directory. I choose based on the evidence I need and verify the path. When inspecting a link, the exact options and a trailing slash can affect whether I look at the link or where it points.
Why could pwd -L and pwd -P report different paths?
The logical report can preserve the path the shell travelled through a symbolic link. The physical report resolves such links in the actual directory location. I read both when I need to explain a shortcut or before an operation that depends on its destination. I also verify the file contents or application path if the question is which version a reader uses.
What would you check when cd fails and a following write unexpectedly succeeds?
The shell normally stays in its previous directory after the failed move. A write that follows unconditionally can use that earlier starting point. I inspect the attempted destination and the actual working directory, then find the file that was written. For new commands I gate dependent actions on a successful directory change and verify the full intended path before writing.
How can two files have the same name and still contain different text?
A filename names a directory entry within a particular directory. The final component can be identical under another parent. I would specify the whole relevant path and check the content or metadata that matters. If one name is a link, I would check its target too. That keeps a valid file in one branch from being mistaken for an alternative file in another.
Check your understanding
You are in current/photos and want to reach archive, which is directly below the catalogue root. Choose between archive, ../archive and ../../archive.
Answer and reasoning
Use ../../archive. One move up gives current. The second gives the catalogue parent of current and archive. Then select the sibling branch.
You want the owner and mode of current itself. Choose between ls -ld current, ls current and pwd.
Answer and reasoning
Use ls -ld current. That asks for a detailed row about the named directory. The short listing looks inside it, and the working-directory command names where your shell is now.
A command using archive/last season reports that two names are missing. Would you add quotes around the path, ask to become the system administrator, or clear the screen first?
Answer and reasoning
Use quotes around the path. The unquoted space can separate the words into two operands. Verify you are at the right starting folder and then pass the complete name as one value.
The listing says latest is a link to current/photos. Which test checks what content you actually reach: only list the link’s entry, follow the path and read the small test file, or count commands in history?
Answer and reasoning
Follow the path and read the intended file. Inspecting the link helps you understand the route. The read of a known sample verifies the content served by that route.
Tab completion offers no result. Choose the best next move: verify the directory, typed prefix and completion settings, conclude the path can never exist, or run a mode change using a broad wildcard.
Answer and reasoning
Verify the directory, prefix and shell settings. Completion is an aid, and its absence can have several causes. An explicit listing and exact read give stronger evidence about the target.
Revision cards
Keep the starting directory in view
A relative path starts from the process’s working folder. Check it with pwd, then trace one named component at a time.
Directory or contents
Use a directory’s own listing to read its type and mode. Use an ordinary listing to see the names inside.
Two versions can share a basename
Keep the parent branches visible. Inspect the exact path and known content so a current file and archived file remain distinguishable.
Quotes preserve names with spaces
Keep a path with spaces as one argument. Use double quotes to expand a path variable without splitting the result.
Follow the target safely
List a symbolic link and consider both its stored target and where your shell resolves it. Verify the physical location before changes.
Diagnose the first failed component
Read the starting point and path. Decide whether a component is missing, has the wrong type or is inaccessible.