https://github.com/learnbyexample/TUI-apps/tree/main/CLI-Exercises Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} learnbyexample / TUI-apps Public * Notifications * Fork 2 * Star 57 * Code * Issues 0 * Pull requests 1 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create TUI-apps/CLI-Exercises/ Go to file TUI-apps/CLI-Exercises/ Latest commit @learnbyexample learnbyexample added video demo, misc changes ... aa01968 Dec 9, 2022 added video demo, misc changes aa01968 Git stats * History Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time . . expected_output added more questions Nov 30, 2022 README.md added video demo, misc changes Dec 9, 2022 anchors.txt added more questions Nov 30, 2022 blocks.txt added cli exercises app Nov 26, 2022 cli_exercises.css set auto height for input/output panels Dec 3, 2022 cli_exercises.png panel for game status, misc changes Dec 8, 2022 cli_exercises.py removed unused imports Dec 5, 2022 colors.txt added more questions Nov 30, 2022 duplicates.txt added more questions Nov 30, 2022 file_size.txt added more questions Nov 30, 2022 fruits.txt added more questions Nov 30, 2022 greeting.txt added cli exercises app Nov 26, 2022 ip.txt added cli exercises app Nov 26, 2022 nums_1.txt added more questions Nov 30, 2022 nums_2.txt added more questions Nov 30, 2022 purchases.txt added more questions Nov 30, 2022 questions.json changed save logic Dec 2, 2022 range.txt added more questions Nov 30, 2022 sample.txt added cli exercises app Nov 26, 2022 table.txt added more questions Nov 30, 2022 timings.txt added more questions Nov 30, 2022 varying_fields.csv added more questions Nov 30, 2022 Linux CLI Text Processing Exercises Installation Guide Video demo Ebooks License README.md Linux CLI Text Processing Exercises This TUI application includes 40 questions to test your CLI text processing skills. Note This application is intended for exercises based on Linux CLI tools. You might still be able to solve the exercises on other platforms, but I'm not sure if it works. Installation You'll need to install textual first. See Textual documentation for more details about installation. After that, you can clone this repository and run the cli_exercises.py script. Adjust terminal dimensions as needed. Example instructions shown below, adjust them based on your preferences and OS. $ python3 -m venv textual_apps $ cd textual_apps $ source bin/activate $ pip install textual==0.5.0 $ git clone --depth 1 https://github.com/learnbyexample/TUI-apps.git $ cd TUI-apps/CLI-Exercises $ python cli_exercises.py After pressing Ctrl+n twice, you should get a screen similar to the one shown below: Sample screenshot for CLI exercises Guide * Press Ctrl+p and Ctrl+n to navigate the questions list. + Ctrl+- and Ctrl+- can be used instead. + You can also click them using mouse from the footer. * Type the command in the box below the question. Cursor focus is meant to be always within this box. * Press Enter to execute the command. + /bin/sh is the shell used. So, features like echo {1..3} (brace expansion) won't work. + Output would be displayed below the command box. + If the output matches the expected results, the command box will turn green and a reference solution will also be shown. + Issues due to errors and timeout (about 2 seconds) will be displayed in red. * Contents of the input file and expected output are shown at the bottom of the screen. You might have to scroll down to view longer files. * Press Ctrl+s to show the reference solution if you are unable to solve an exercise. * Press Ctrl+t to toggle between light and dark themes. * Press Ctrl+q or Ctrl+c to quit the app. * Navigating and editing in the command box: + Use mouse click to position the cursor anywhere you like + - move left by one character + - move right by one character + Ctrl+a move to the start of the line + Ctrl+e move to the end of the line + Ctrl+w delete backwards till whitespace boundary or start of the line + Ctrl+f delete forwards till whitespace boundary or end of the line + Ctrl+u delete backwards till start of the line + Ctrl+k delete forwards till start of the line + Backspace delete character to the left of the cursor + Ctrl+d delete character to the right of the cursor * Use Page Up and Page Down (or mouse) to scroll. Note Commands you have typed are automatically saved in user_progress.json (only when you press Enter to execute a command -- navigating to another question and closing the app won't trigger the save logic). Theme choice is also saved. If you close the application and open it again, the first unsolved question will be displayed (i.e. already solved questions are skipped). If you use Ctrl+s, the solution won't be saved in user_progress.json -- you'll have to navigate to another question and back (or close and open the app) to be considered for saving the changes. Once you have solved a question, only a different correct solution can override the previously saved command. Warning There is no safeguard against the command you are executing. They are treated as if you typed them from a shell session. For example, ls will list the contents of the current directory. Video demo linux_interactive_cli_exercises.mp4 You can also view the demo video on youtube. Ebooks Exercises used in this application are based on my programming ebooks . License Code snippets are licensed under MIT LICENSE Exercise questions and associated files (like questions.json) are licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.