11 ms·
Show HN: Memorize Terminal Commands
- DC-3 7y agoQuestion: Write the command that reads the file that has the name (text.txt) and shows only one page each time you hit space and it allows you to explore the file back and forward. Your answer: more text.txt Correct answer: less text.txt
- naniwaduni 7y agoIndeed, traditionally more doesn't go backward. It's the first line of prose in the less(1) manpage: "Less is a program similar to more (1), but which allows backward movement in the file as well as forward movement."
- NotMelNoGuitars 7y agoYeah, a handful of these tripped me up as well. I got: Question: Write the command that you use to move into your home directory '~' Your answer: cd Correct answer: cd ~ The man pages specify that cd moves into the current user's $HOME directory if called without arguments, but I'm sure there's some mystic difference between cd $HOME and cd ~ in certain cases.
- maherdeeb 7y agoThanks a lot for your comment. I think both answers are correct. I am not sure if cd works for all systems.
- codetrotter 7y agohttps://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/c... cd without an argument will change directory to $HOME if $HOME is set and the value is non-empty as defined in the standard linked above. That’s not to say that all Unix-like systems do or even try to implement everything of that standard, but it’s a good indicator pointing to that a lot or most of them probably do. As for cd ~, tilde expansion is done by the shell, not by cd. Same goes with any other command that you type ~ as the leading part of a path and provide as argument. (Also, in bash, among others, cd is a builtin command.) The shell will substitute the ~ for the path of your home dir when ~ is alone or followed by a slash and anything else. (And you probably know also that ~example would refer to the home dir of a user named “example”.) I think you will sooner run into a system with a shell that doesn’t do tilde expansion, than you will run into a Unix system where plain cd without an argument doesn’t bring you to your home dir.
- pushpop 7y agoTechnically the chances of tilde not working are the same as cd behaving differently because they’re both shell builtins. I’m guessing (though admittedly not checked) that both ~ and cd (without parameters) are defined in POSIX. In which case any edge case that doesn’t conform could reasonably be discounted with regards to the submission’s exercise.
- pushpop 7y agoI did some quick research on the POSIX thing and it looks like cd (without parameters) is defined in POSIX: https://www.unix.com/man-page/posix/1posix/cd/ https://www.unix.com/man-page/posix/1posix/cd/ Also I don’t know why many of my posts keep getting downvoted even when they’re factually accurate.
- montag 7y agoThings like this should probably be ‘Correct’ with a small warning.
- DaveInTucson 7y agoNot sure if the site is meant to be strictly Linux/Unix or not, but on Windows, cd without any path just prints the current directory and doesn't do anything else. (Although "cd ~" produces the response "The system cannot find the path specified.")
- darrenf 7y agoAnd yet my preferred pager is `most` https://linux.die.net/man/1/most https://linux.die.net/man/1/most
- Fnoord 7y agoColor support is nice, default colors seemed terrible (blue on grey wasn't readable). The keybinds didn't make sense. No vi keybinds is a no go. At least do not touch hjkl!
- noname120 7y agoDid one session and it kept asking me some commands that I had typed correctly from the first time.
- maherdeeb 7y agoI really thank you for giving it a try and for your comments. I should say that the user's answer could be correct in many cases. I am working on a more advanced answer normalizing feature using some regex expressions which will NOT be a default option. From my point of view, it is better to memorize one pattern of the command that does the work instead of focusing on searching how to use the command.
- jedberg 7y agoMaybe add a button that says “challenge this ruling I’m pretty sure im right” so at least you’ll know which ones people were sure on vs ones they got wrong because they guessed.
- ant6n 7y agoThis is very neat. I found it difficult to read/parse the descriptions, they almost feel like sentence riddles. Also, the column width may be too wide for fast reading. Maybe one could solve these more quickly if there was always the same format using newlines like "type the command\nwhich will display x\n such that y".
- pm7 7y agoThat might make sense if there is some canonical answer to your questions. But if you arbitrarily choose "right" answer you are annoying people who already have some experience. But then, I guess you target people with little to not experience, right?
- zestyping 7y agoI watched the GIF animation for a long time until it looped and I realized that it conveyed no information about the project. That was disappointing. It would be great if watching the main image/animation on your front page showed what it's like to actually play the game!
- eequah9L 7y agoAnki is superb for this sort of stuff. It implements a spaced repetition algorithm to keep the added content in your memory while minimizing the number of times that you need to refresh it. While used mostly for studying natural languages, there's nothing wrong with using it for IT stuff (I do). (Edit: Dropped a bit that was left after some previous culling.)
- jclulow 7y agoYour answer: ls -lha Correct answer: ls -lah Oh dear.
- ilikepi 7y agoI got bit by that as well. I think testing common arguments is useful, but I wonder if it would make more sense to limit to a single argument. That would eliminate the need to handle permutations, and it would also keep the questions simpler.
- jclulow 7y agoI think to do this properly you need to implement the argument parsing the command is doing; e.g., use getopt(3C). After all, "ls -la -h --" is valid too.
- TheDong 7y agoNot all unix utilities use getopt. Clearly the correct way to implement this is to run each command in a short-lived container and check the output matches what's expected. For things like the pager questions, it'll need to implement a full vte and vte comparison, so that should be fun. For bonus points, one of the options to emulate linux in the browser could be used to do that more securely and without the need for a service... though the load time might increase by several minutes or hours.
- darrenf 7y ago> Clearly the correct way to implement this is to run each command in a short-lived container and check the output matches what's expected. I'm not sure it is clearly correct. Some commands don't produce output, `mkdir` and `cd` for example (the first two in the animation). Furthermore they'd have to blacklist `echo` and other ways to produce the output against the spirit of the exercise... until an answer is, say, `echo $?` - at which point you'd require a preceding command exiting in a suitable way in order to keep the "just execute it" approach workable.
- RGS1811 7y agoI got a lot of questions about the names of root level linux directories, which while good knowledge doesn't seem to fit under the title description.
- gatherhunterer 7y agoThe responsive design is unusable on an iPhone SE. This would have the most appeal to me as something to use during downtime (e.g. on the train) rather than when I am at my desk so it’s too bad.
- stOneskull 7y agoDid you try Firefox?
- gatherhunterer 7y agoYep I only use FF. The DOM is the same either way, though.
- maherdeeb 7y agoThanks for your feedback. I agree that it is not user-friendly for mobile users. I will improve the UI in the future to fit small devices as well.
- stockkid 7y agoJust a heads up to the author: When I click the "Start memorizing" button, I get a 500 server error.
- maherdeeb 7y agothanks a lot for your comment. I got the error from Google App Engine as well. I am going to investigate this and solve the problem.
- jedberg 7y agoAnother suggestion: Instead of just the verbal description of what to type, how about some sample output to? That wouldn't give away any answers but would help understand what you are looking for. Like when you asked "type text to the terminal" I put 'cat' instead of 'echo'. Sample output would probably have helped me there.
- maherdeeb 7y agoThanks a lot for your suggestion. I agree 100% with you. I am thinking to provide hints to the users either by giving a link to the source or showing a picture of the results or both.
- trykondev 7y agoThis is a really cool idea! I love that there's an option to train on git commands. Git has always been the kind of thing where I only learn as much as I need in order to do the task immediately in front of me, so this kind of thing might be a useful way to level up my skills in that area. I also really love that in the "about" section, you include lots of details about the architecture of the project. I was only expecting a summary of how to use the project, but all these additional details were really nice to see.
- alw2 7y agoWhat is the frontend and the backend built on?
- andreygrehov 7y agoUX feedback. Get rid of "Repeat Password" field. It will make the form look more user-friendly, as well as hide the scroll bar (at least on my MacBook Pro), so the entire page fit the screen.
- jmkni 7y agoVery cool, thanks for sharing
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- nick0garvey 7y agoFirst question didn't go great, would be nice if there was a way to report missing answers. Question: Write the command which you use to move inside the directory which has the name 'my dir' (the name contains a space) Your answer: cd 'my dir' Correct answer: cd my\ dir
- stOneskull 7y agoI did that too and learned backslashing the space is another way. Next time I'll do it that way and win the sweet green.
- chrismorgan 7y agoAnd in practice: `cd my<tab>`. I strive to make the first three letters of a filename a unique prefix in each directory; and if I were to use a space like this, I’d be making sure “my” was a unique prefix. This system becomes a sufficiently ingrained habit that I can’t cope with Zola having a directory “content” beside a file “config.toml”.
- 693471 7y agoTab completion isn't default in every shell
- lubomir 7y agoThere are so many ways to escape the space. It did not accept cd my" "dir either.
- asicsp 7y agoSee also [1][2] (bookmarked them sometime back, don't remember the details) [1] https://www.shortcutfoo.com/app/dojos/command-line https://www.shortcutfoo.com/app/dojos/command-line [2] https://www.memrise.com/course/50252/shell-fu/ https://www.memrise.com/course/50252/shell-fu/
- envolt 7y agoCan you do something about duplicate questions?
- maherdeeb 7y agoSure! After I get all the questions in place, there will be no duplicate questions.
- stOneskull 7y agoI'm liking it so far. Doesn't bother me about being marked wrong when right. It's not like it's for anyone else. Getting some good lessons and refreshes, and works great on Firefox on my phone. Thank you very much for making it.
- deleted 7y ago[deleted]
- sagarpatil 7y agoThank you for creating this.
- posix_compliant 7y agoWRONG Answer: tail test.txt Your answer: tail test.txt I think it didn't like my answers if I hit the 'enter' button.
- msravi 7y agoI thought I got hit by this, and then realized that it's text.txt with an X and not test.txt with an S.
- epiphanitus 7y agoAnybody have a good Linux command line reference they might recommend? I've been using Ubuntu on my computer and it would be nice to have a resource for when I get stuck.
- asicsp 7y agoI have a curated list of resources[1] on topics like learning command line basics, bash scripting, style guide, etc. I have also have my own basics guide[2] and a comprehensive cli text processing repo[3] [1] https://github.com/learnbyexample/scripting_course/blob/master/Linux_curated_resources.md https://github.com/learnbyexample/scripting_course/blob/mast... [2] https://github.com/learnbyexample/Linux_command_line https://github.com/learnbyexample/Linux_command_line [3] https://github.com/learnbyexample/Command-line-text-processing https://github.com/learnbyexample/Command-line-text-processi...
- epiphanitus 7y agoVery cool. Thanks!
- justanegg 7y agoI misread that as Memoize.
- lol768 7y ago>Assuming that you execute the command man -ls I assume this is supposed to be `man ls`. >You move inside the help document of the ls command. Write the keyboard key that you can use to move forward to the next page inside the help document > Your answer: page down > Correct answer: f I mean, both work? Maybe my answer is less likely to work ona remote system with TERM set wrong.
- PebblesHD 7y agoThe University of Technology Sydney wrote a similar training program inside a VM to use in their systems introduction classes called LinuxGym [0]. Its a surprisingly useful learning tool if a little basic and dated, but covers everything from directories to grep to awk. [0] - http://linuxgym.it.uts.edu.au/linuxgym/lgwww/ http://linuxgym.it.uts.edu.au/linuxgym/lgwww/
- JosephRedfern 7y ago"You can use a fake Email". Curious! Why not just make it an optional field?
- spoiler 7y agoSome of these are kinda poorly phrased, and the answer in a few of them could've been "depends" more than once. Would be slightly better if the questions were more specific, or at least accept multiple answers.
- mtich-snipline 7y agoThis is a really cool idea. I think ideally, it could do with a Duolingo/Flash card style approach where your first taught the commands, and then asked to write them.
- uvictor 7y agoHey guys, i have an app that I have just put away where you can save commands in the command line in the system or upload them to a remote... anyone interested...it is just a npm package
- thrownaway954 7y agoWhat is this??? I see a gif with terminals commands and a sign up. You have no call to action. There is nothing on the page that tell me what this is about or how this will benefit me.
- digitalsushi 7y agothis is like a parrot learning how to say 100 sentences in french. the parrot has no idea what it is saying, only that the result might generate a cracker or a grape.
- drcongo 7y agoQuestion: Write the command that you use to move into the parent directory of the current directory. Your answer: .. Correct answer: cd .. Nope.
- NobodyNada 7y ago`..` is not a command, it's just the name of the parent directory (unless you've defined it as an alias for `cd ..`)
- drcongo 7y agoI use zsh and fish, `..` takes you to the parent directory without typing `cd`
- lawry 7y agoI love the idea, it's like push-ups for programmers. (Though actual push-ups wouldn't be a bad idea either ;) On that note, are there other things that come to mind like that? Maybe anki-decks or https://typing.io/ https://typing.io/
- m19n 7y agoI thought it would be a memory game like Simon [1] where the game prints one line and then your repeat it. If you are correct it starts from the first line but adds another line for you to remember. I could see the fun in that. Also you wouldn't have the issue of people complaining about right and wrong answers because you would have to write just as it was printed. [1] https://en.m.wikipedia.org/wiki/Simon_(game) https://en.m.wikipedia.org/wiki/Simon_(game)
- beltekylevi 7y agoCorrect answer adds the current working directory not all changes in the local repository. Write the command that asks git to add all changes that have been made inside the project that git tracks. Your answer: git add -A Correct answer: git add .
- maherdeeb 7y agoDear all, I appreciate your effort and your time testing the website. It was a great help to me. Your feedback is the light in the darkness. There are a lot of ideas in the pipeline. Your feedback helps me to prioritize them. Big thanks for everyone who wrote feedback here or sent it to me via email or LinkedIn. Thanks for all 9k+ tester. This is my Sunday project. Each Sunday, I am going to release a new version with a new fix or feature. Best regards Maher Deeb