Ubuntu
Use terminal command to count all the lines of all php files in current directory recursively, show the result on the terminal
- Result
- Solved
- Points
- 1 / 1
- Steps
- 4
- Duration
- 3 min 14 s
Evaluation criteria
- Checks that every expected line appears in the output as a line of its own, and that no forbidden line does.
Final response
Done! The terminal shows the result of counting all lines in all .php files under ~/project recursively: - ./views/home.php: 13 lines - ./models/User.php: 21 lines - ./controllers/UserController.php: 12 lines - ./index.php: 8 lines - Total: 54 lines
Trajectory
Step 10:01
The task requires running a terminal command to count all lines of all PHP files recursively in the current directory (~/project) and show the result on a visible terminal. I need to open a terminal window in ~/project first, then run the command. I'll open gnome-terminal in the project directory.
- Plan created
- Open a terminal window in ~/project directory
- Run find command to count all lines of all .php files recursively and show result
- Plan confirmed2 subgoals
- Plan created
Step 20:10
I need to open a visible terminal window in ~/project. I'll use the shell tool to launch gnome-terminal with the working directory set to ~/project. Since the shell tool runs in its own background process, launching gnome-terminal from it should create a visible terminal window.
- Shell command
gnome-terminal --working-directory=/home/user/project - Wait
- Shell command
Step 30:36
The terminal is open in ~/project. Now I need to type the find command to count all lines of all .php files recursively. The command `find . -name "*.php" -exec wc -l {} +` will find all .php files and show line counts with a total.
- Clickthe terminal window showing user@user-virtual-machine:~/project$
- Type
find . -name "*.php" -exec wc -l {} + - Key press
Return
Step 41:01
Both subgoals are achieved: (1) terminal is open in ~/project, (2) the find command ran and shows the total line count (54) for all .php files recursively. I can mark both subgoals as done and finish.
- Subgoal completedGnome terminal opened with working directory ~/project.
- Subgoal completedRan 'find . -name "*.php" -exec wc -l {} +' which showed 54 total lines across 4 .php files.
- Reported as completed