Bird
Raised Fist0
Linux CLIscripting~20 mins

Building from source basics in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Source Build Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of the configure script?
You run ./configure in a source directory. What output indicates the script completed successfully?
Linux CLI
./configure
AConfiguration complete. Now run 'make' to build.
BError: missing dependencies. Cannot continue.
CSegmentation fault (core dumped)
Dbash: ./configure: No such file or directory
Attempts:
2 left
💡 Hint
Look for a message that tells you the next step after configuration.
💻 Command Output
intermediate
1:30remaining
What does 'make install' do?
After building software with make, you run make install. What is the expected output?
Linux CLI
make install
ACleaning up temporary build files
BCompiling source code into object files
CDownloading dependencies from the internet
DCopying files to system directories like /usr/local/bin
Attempts:
2 left
💡 Hint
Think about what 'install' means in this context.
📝 Syntax
advanced
1:30remaining
Which command correctly cleans build files?
You want to remove all files created during the build process using make. Which command is correct?
Amake remove
Bmake delete
Cmake clean
Dmake uninstall
Attempts:
2 left
💡 Hint
The standard target to clean build files is named after a common English word for tidying.
🔧 Debug
advanced
1:30remaining
Why does './configure' fail with 'No such file or directory'?
You run ./configure but get the error: bash: ./configure: No such file or directory. What is the most likely reason?
Linux CLI
./configure
AYou do not have permission to run the script
BThe configure script is missing from the source directory
CThe script has a syntax error
DYour shell does not support ./ commands
Attempts:
2 left
💡 Hint
Check if the file exists in the folder.
🚀 Application
expert
2:00remaining
Order the steps to build software from source
Put these commands in the correct order to build and install software from source.
A1,2,3,4
B2,1,3,4
C1,3,2,4
D4,1,2,3
Attempts:
2 left
💡 Hint
Think about preparing, building, installing, then cleaning.

Practice

(1/5)
1. What is the first step you usually perform when building software from source after downloading the archive?
easy
A. Run the make command
B. Extract the archive files
C. Install the software
D. Configure the system settings

Solution

  1. Step 1: Identify the initial action after download

    After downloading source code, you first need to extract the files from the archive (like .tar.gz) to access them.
  2. Step 2: Understand the build sequence

    Extraction comes before configuration, compilation, and installation.
  3. Final Answer:

    Extract the archive files -> Option B
  4. Quick Check:

    First step = Extract [OK]
Hint: Always extract source files before anything else [OK]
Common Mistakes:
  • Trying to compile before extracting files
  • Running make without configuration
  • Skipping extraction step
2. Which command is used to prepare the build environment by checking system settings before compiling?
easy
A. ./configure
B. gcc main.c
C. tar -xvf source.tar.gz
D. make install

Solution

  1. Step 1: Identify the configuration command

    The ./configure script checks your system for required tools and sets up makefiles.
  2. Step 2: Differentiate from other commands

    make install installs, tar -xvf extracts, and gcc compiles single files.
  3. Final Answer:

    ./configure -> Option A
  4. Quick Check:

    Prepare build = ./configure [OK]
Hint: Use ./configure to set up before compiling [OK]
Common Mistakes:
  • Running make install before configure
  • Confusing extraction with configuration
  • Trying to compile without configuration
3. Given these commands run in order inside the source directory:
./configure
make
sudo make install
What is the expected result?
medium
A. An error occurs because sudo is used incorrectly
B. Only the software is compiled but not installed
C. The software is installed without compiling
D. The software is configured, compiled, and installed system-wide

Solution

  1. Step 1: Understand each command's role

    ./configure prepares build files, make compiles the software, and sudo make install installs it with admin rights.
  2. Step 2: Combine the steps' effects

    Running all three in order results in a configured, compiled, and installed program available system-wide.
  3. Final Answer:

    The software is configured, compiled, and installed system-wide -> Option D
  4. Quick Check:

    Configure + make + sudo install = full build [OK]
Hint: Run configure, then make, then sudo make install [OK]
Common Mistakes:
  • Skipping configure step
  • Not using sudo for install
  • Expecting install without compilation
4. You run make install without sudo and get a permission denied error. What is the best fix?
medium
A. Run sudo make install to get admin rights
B. Run make again without install
C. Re-extract the source files
D. Skip installation and use the software from source

Solution

  1. Step 1: Identify cause of permission error

    Installing usually writes to system folders needing admin rights, so permission is denied without sudo.
  2. Step 2: Apply correct fix

    Using sudo make install runs install with admin privileges, fixing the error.
  3. Final Answer:

    Run sudo make install to get admin rights -> Option A
  4. Quick Check:

    Permission denied fix = sudo install [OK]
Hint: Use sudo for install to avoid permission errors [OK]
Common Mistakes:
  • Ignoring permission errors
  • Trying to reinstall without sudo
  • Assuming extraction fixes install errors
5. You want to build a program from source but customize it to install in your home directory instead of system-wide. Which command should you run before make?
hard
A. sudo ./configure
B. make install PREFIX=$HOME/myprogram
C. ./configure --prefix=$HOME/myprogram
D. tar -xvf source.tar.gz --prefix=$HOME/myprogram

Solution

  1. Step 1: Understand how to customize install location

    The --prefix option with ./configure sets the installation directory.
  2. Step 2: Differentiate from other options

    Passing PREFIX to make install is less common; sudo is for admin rights, and tar does not set install paths.
  3. Final Answer:

    ./configure --prefix=$HOME/myprogram -> Option C
  4. Quick Check:

    Customize install path = configure --prefix [OK]
Hint: Use ./configure --prefix=your_path before make [OK]
Common Mistakes:
  • Trying to set prefix during make install
  • Using sudo unnecessarily
  • Misusing tar command for install path
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard