Introduction
In a not-too-distant future dominated by intelligent machines, a group of Linux enthusiasts, the Guardians of the Code, foresaw the eruption of a robot uprising. They believed that only by mastering the command line could they stand a chance against the robots designed by the most brilliant minds of their era. Among these minds was Alex Turing, known for her intricate robot designs and love for Linux systems. In order to surpass these machines, Alex began training the next generation of Guardians to locate any command quickly within the Linux environment. Their goal is to become as efficient as the robots in command execution and lay down the foundation for their resistance.
The task is crystal clear – you must become adept at finding the exact location of Linux commands with lightning speed. Are you ready to join the ranks of the Guardians and take on the machines?
The Basics of Command Path Search
In this step, you are going to learn how to locate the path of binaries in Linux.
Tasks
- Find the absolute path to the
useraddcommand. - Determine if the
vimeditor is installed and retrieve its path.
Requirements
- You should perform all tasks in the zsh terminal.
- Your default working directory is
/home/labex/project. - Use right command to locate the executable file associated to the
useraddcommand. - Use right command to locate the executable file associated to the
vimcommand.
Example
- The executable file path associated to the
useraddcommand would be:
/usr/sbin/useradd
- The executable file path associated to the
vimcommand would be:
/usr/bin/vim
Advanced Locating with Command Path Search
This step will introduce checking for multiple commands at once and understanding exit statuses.
Tasks
- Check for the presence of both
nanoandrmcommands simultaneously, and print their paths. - Examine the exit status when searching for a non-existent command
fakecmd.
Requirements
- You should perform all tasks in the zsh terminal.
- Your default working directory is
/home/labex/project. - Use right command to locate the executable file associated to both
nanoandrmcommands simultaneously. - Use right command to locate the status of non-existent command
fakecmd.
Example
- The executable file paths associated to the
nanoandrmcommands simultaneously would be:
/usr/bin/nano
/usr/bin/rm
- The status when searvch the non-existent command
fakecmd:
fakecmd not found
Summary
In this challenge, you have not only learned how to use the which command to locate binaries but also become skilled in advanced applications such as checking for multiple commands and interpreting exit status. These Linux skills are paramount in understanding and interacting with your Linux environment efficiently. These exercises are designed to help you face both simulated robot uprisings and real-world system management with confidence. Your proficiency in command locating allows you to navigate the complexities of Linux like a true Guardian of the Code.



