Providing options as an argument vs editing a config file

Maybe with 25 lines the 3 lines are annoying, but I usually have more lines than that and the 3 lines with quick reference are much better than having to google the command I forgot, because I use it rarely.

As for the search, what do you mean?

^G Get Help              ^O WriteOut              ^R Read File             ^Y Prev Page             ^K Cut Text              ^C Cur Pos
^X Exit                  ^J Justify               ^W Where Is              ^V Next Page             ^U UnCut Text            ^T To Spell

Ctrl+W is search (I admit the choice of the combination is not that great, because doing it inside a browser (say, using IPMI or VM console) closes the browser tab).

Anyway, pressing that you get:

Search:                                                                                                                                                
^G Get Help              ^Y First Line            ^T Go To Line            ^W Beg of Par            M-J FullJstify           M-B Backwards
^C Cancel                ^V Last Line             ^R Replace               ^O End of Par            M-C Case Sens            M-R Regexp

nano: Ctrl+W, Ctrl+V
On GUI editors, I move the scroll bar with my mouse.

nano:
Ctrl+W, Ctrl+T, “42”, enter

nano:
Ctrl+W, “Wolf”, enter

nano: entire file: Ctrl+W, Ctrl+R, “sheep”, enter,“wolf”,enter,a
For partial replacements, do this:
Ctrl+W, Ctrl+R, “sheep”, enter,“wolf”,enter
a match is selected, if I want to replace it, I press y and if I want to skip it I press n

Ctrl+W, “storage.path:” OR “/mnt/storagenode” (whichever I remember, whichever is easiest), enter. This puts me on the relevant line. I can then edit it the way I want.
If I want to delete everything from the cursor to the end of the line (and the line is very long) I usually do this:
move cursor to the first unwanted character, enter, Ctrl+K.
Ctrl+K cuts the entire line, so this moves the unwanted portion to a new line, then cuts that line.

To each his own, for me, using the mouse to select a portion of the text is much easier and faster than trying to count the number of words I need to select etc.

Let’s say I have to think for a minute to come up with what I want to change in the file. Then, using nano, it takes me 5 seconds to change it, but if I used vim, I could do that in 2 seconds. The total time is 65 vs 62 seconds, which is not a significant difference. This is what I meant.

I know, the problem is that I do not need to use it often, which means I forget. Even if I googled all the functions and was able to write the correct single invocation, then next time I would need it, I would have to google it again, because that next time would be in a month or later.
Actually, this is similar with PHP (and in some cases bash). I have written some php scripts that access a mysql database, but pretty much every time I need to write a new one, I either have to google how to access a database from php or I copy paste from one of my old scripts. This is because I need it once in a few months and the few months are enough for me to forget the specifics. Similar with, say, bash. I use the date command quite frequently, and yet, pretty much every time I need it, I read the help to remember the format (other than “%s”, I remember that one).

This is probably the main reason why I like the simpler things (ones that require less memory) - even if I did learn the useful vim commands, by the next time I would need them, I would have to google them again. The 2 “wasted” lines of nano are extremely useful in this case for me.

The worst part of that is not just the requirement for “neat” code (I still somewhat dislike php and C because the variable and function names are case sensitive, Pascal/Delphi do not have that particular annoyance), but that the code may look OK, but not work (or run). The reason? One line is “space space space space” and another line is “tab space”. The indentations look exactly the same, but the code does not work.

1 Like

Lol. I looked like three times, and did not see it. But I was looking for “search”… who calls search “Where is” :smiley:

This closes window on most OSes :slight_smile:

Mouse :slight_smile: Nope.

But you can also press Control+End, but I, for example, don’t have Ins/Del/Home/End/PgUp/PgDn block on my keyboard.

See, you still have to read manual and learn it; might as well learn vim. Also, control is a very bad modifier – it is not portable, and some combinations close windows and do other nasty stuff on the host. It’s mind boggling why it was chosen as default. Even Alt/Option would be better. Shift is OK, but it’s already used for changing case… This is where vim comes in (again)

Then nano is perfect! I for some reason assumed you do that often. Not sure why specifically.

I agree. But to my defense – I don’t count numbers. I either eyeball it – like when checking time on the clock — you don’t actually read 4:34, you kind of look and know what time is it, or just switch to visual mode – with V and highlight the block I want to replace. Again, without removing hands from keyboard. Very important. Especially with age, when dexterity diminishes, aiming with a mouse is a … what is the right word… annoying task. It’s also bad for ergonomics, if you have full size keyboard – the hand stretches too far to the right. This is why every (decent) UI can be fully operated by the keyboard. Some users lack ability to use mouse in the first place. But either way – pressing buttons is inherently faster than moving the analog controller.

Ok. I’m not saying nano is unusable garbage and vim is the absolute truth. I’m saying that in vim you can accomplish things faster and easier, after initial leaning curve. But if you do this seldom – then it may not be worth the time investment. No argument here: Spending 2 hours to save 3 seconds 5 times is silly. But if you do it daily, those five seconds easily exceed 2 hours multiple times.

I would suggest using stuff like black, pylint, mypy, and flake8 before every commit (e.g. as a git hook or part of CI). This will re-format your code correctly and find these kind of pesky elusive bugs (including wrong amount of indentations that looks but works incorrectly; akin wrong nesting of {}in other languages. This is however a consequence of too long functions – this better be addressed first)

In fact, even some compiled languages made automatic code formatting as part of compilation – for example: go. This completely eliminates those silly mistakes and code looks consistent across developers and that means – easier to read. Also, all editors should be configured to replace tabs with spaces… Except for Makefiles – where the difference is significant. (What?! yeah… I don’t enjoy editing makefiles…)

It’s right there on the bottom two lines. ^W Where Is ^T Go To Line
If I forget, I can just look there.

The combinations themselves are a bit weird, I’d much prefer Ctrl+S for save, Ctrl+F for find etc (because now using notepad after using nano for an hour is a bit annoying fora while).
Alt is worse though (for me), since Windows programs usually highlight the menu bar when Alt is pressed.

I use nano and edit text files frequently, but I need the special functions (go to line number etc) not as frequently. For example, there’s Alt+A to select text and Alt+6 to copy it (instead of Ctrl+K to cut) and I always forget them, so I usually do the same thing in a different way.

I don’t really have a problem aiming with the mouse. I sometimes miss, but I also sometimes miss with the keyboard (I don’t know how many times I have typed grpe instead of grep, I probably should create an alias).

If I knew how to use git other than “git clone” :slight_smile:
I also do not write or edit Makefiles (maybe once did a search and replace for something).

1 Like

Yes, what I meant was that I could not find it until you told me what to look for. Then, of course, it’s right there. Not a big deal. Nobody said that nano does not have a learning curve.

This is a great observation: it reinforces that the purpose of nano is to be simple to use for most casual users. And the largest group of those are of course (still) represented by windows GUI users. The Ctrl choice now makes perfect sense.

I mean, of course, mouse works for most people. It’s just inherently slower for most people other than pro e-sports crowd. They can probably type with a mouse faster than on a keyboard :slight_smile:

I highly suggest trying the_silver_searcher (ag) as a drop-in replacement for grep. It’s like grep written for people who actually use it. And it’s faster. Also, you won’t need an alias, since it’s already short.

On the aliases – if I lose my ~/.zshrc file my productivity will seriously tank… I religiously back it up.

I use git for everything. Even for config files. Including storj. If I change something, I create a revision, so I can go back if I want, or review differences. Why not? It’s free, and fast. And yes, my .zhsrc, .zprofile, etc, are all under git.

It was more of a rant than anything, but yes, Makefiles can be quite scary. I worked on a project once that the makefile was doing so much acrobatics with renaming and substituting that I could not figure out what’s going on just by looking for it, I had to reverse engineer results and understand what it did, in spite of having “source” in front of me.

On learning different layouts – I constantly switch between Xcode, bbedit, vim, and pycharm, and every single one has it’s own shortcuts that takes getting used to. I don’t want to remap them, because then I wont’ be able to work on any other by my machine. Eventually all sets of shortcuts got associated with the editor view in muscle memory and I’ve ended up switching between then painlessly. But it took months!

Once, as an experiment, I tried to start a finish a hobby electronics microcontroller project on raspberry pi, including editing, debugging, and tracing the code in a multiple tmux window in vim. It was painful first 10 minutes, but after googling shortcuts – I forgot that I was debugging a complex multithreaded project via ssh in a terminal. It was perfect. Of course, nano can also be used – but vim provides some interesting features like running the external executables, and interfacing with other apps, this made is quite fun. best thing - never touched the mouse :slight_smile:

It’s a skill like the others I guess. If I needed the fastest speed, I guess I could either learn to move the mouse very fast or type very fast (and remember all the shortcuts). Normally, I do not need the super speed and my memory does not hold the shortcuts if I don’t use them for a while, so I would have to constantly look them up.

Thanks for the suggestion. ag letters are close enough that I may have better luck not mixing them up, compared to ep of grep.

Cool. It looks complicated to me, much more so than “file.php”, “file.php.bak”, “file.old.php” “file.new.php” and similar.

Yeah, looks complicated to me. Thankfully my stuff is usually one file = one executable and maybe a bash script for compiling them, because the command may ave something like -lpthreads or specify some old C version (older version of gcc compiled my code ok, new version shows an error, so I find a way for new version to act like the old version).

I just use multiple tabs with ssh or multiple windows. By default there is a limit of 10 open sessions and I sometimes hit it.
Speaking on different layouts - different Windows ssh clients use different shortcuts for the simple stuff, it is super annoying. For example, by default, putty pastes on right click (and I usually start cursing). It can be easily changed, but forget to do that and I’m in for a surprise. Also, by default, with putty the numpad does not work on nano.

By the way, I quite often use te mouse to select, copy and paste text in an ssh window. For example, history | grep some_command, I find it, then select, copy, paste to run it again. Another example is when I use a script to generate commands, then copy+paste some of them to test if the commands work before running the whole generated file.

Most frequently people mix up ls and sl. and get “command not found”. So, kind folks wrote an app “sl” that you can install for an occasional much needed comic relief :). (hint: sl stands for Steam Locomotive). Try it :). I install it as part of my bare necessities on every host I use.

project.final, project.very-final, project.final_for_sure, project.smal_correction …

It’s 10 connections vs 10 shells in one connection. With the added benefit that if ssh connection breaks whatever was running in the session keeps running. You can later ssh again and attach to the same session. Because otherwise it’ impossible to do anything long-running.

This is because cmd.com and earlier versions in windows did that, and putty just provides continuity, so it’s actually somewhat justified. It was possible to turn off in cmd (enable Edit mode); so maybe it’s also possible to configure putty. Also, GUI app for shell access is ridiculous :slight_smile: Isn’t there a command line version?

If I have to use shell on windows – I can’t stand cmd and/or powershell, I just start WSL and then use familiar and compliant tools.

This is very difficult way to accomplish command recall. Instead, press Control+r, and start typing whatever you would put in grep. Most shells support search in history this way.

It becomes second nature. Change something, and run git commit -am "short description of what changed" instead of renaming. Then you have a history, that you can cherrypick changes from, if needed. It’s yet another thing that is worth trying. because zoo of files gets unmanageable very quickly.

Yeah, I have it on one PC for fun. However, for me, the most common way I mistype ls is ls- la, sometimes multiple times in a row.

It’s usually two or 3 versions. The “production” one, the “test” one I am currently messing with and then “prod” becomes “backup” and “test” becomes “prod”.
I usually deal with small files or small changes in big files, so commenting out stuff is simpler for me.

I use screen for that. Sometimes I (ab)use it to get a script running as a background service.
Still, switching between sessions using different windows or tabs is easier for me. There is another reason too. Scrollback. Normally I can scroll back to the previous outputs, but if there is screen (tmux would be the same) and I started switching between sessions inside it, the scrollback would be messed up. Maybe I can use screen function to scroll back, but screen does not have a scrollbar or support for mouse wheel.

And wouldn’t the command line version still run inside a GUI (the terminal)? I mean I can use ‘ssh’ from my Linux PC, but it still runs inside “Konsole” GUI app :). But while Konsole has tabs, I cannot just clone the ssh connection into them and have multiple sessions.

I tried it, at least initially it looks less convenient, because it shows one line at a time, unlike history | grep. It also seems to be able to only search for a contiguous block, unlike, say, history | grep dd | grep sda.

I can agree with you here, Windows cmd sucks and somehow powershell commands are all half a page long. I do not like writing bat files, if it’s something else than just a chain of commands, I’d rather fire up Delphi and write a program to do the thing I want.

I don’t keep many old files. Basically, for my small files, it’s easier to comment stuff out. Also, I do not really need a history of changes. When I change something, if it fixes the problem - cool, if nothing else breaks - even better. But if something does break, I find that out immediately or after a couple of days at most, so I still remember what I did (and have the backup file). I don’t think I ever needed to go multiple versions back, it’s either the “new” or the “before I screwed up” version.

I understand that this would be bad for a 200kB php file where some changes affect stuff that runs once a month and you may make multiple changes in the meantime and only later find out that version 5 definitely worked, version 15 doesn’t so now you need to find which version broke the thing.

And that’s where the aliases come in. I have an alias ll that does ls -alt

Until you need to undo the change you did last month, and only that change, because you just discovered it does not work right in some circumstances. I.e. there is no downside in using version control even for simple things, there is no need to reinvent the wheel only to end up with a worse subset of functionality.

And code loooks cleaner — there is no graveyard of commented out dead code all over the place.

Yep. It’s a subset of functionality and indeed it’s intended for different purpose but I know a lot of people who use it as poor man’s tmux :slight_smile:

Each pane in tmux had its own scroll back buffer.

I’m pretty sure it can be configured but I would not know… I have a … complicated relationship with a mouse, if you haven’t yet noticed :slight_smile:

Checkmate. Good point!

On the other hand, this removes useful usecases where ssh is a part of a more complex chain of commands — for example, zfs send /zfs receive piped over the ssh. SSH being a GUI app is not the same as a bunch of CLI tools running in a single gui terminal. Does not putty come with CLI helper though?

This brings memories. Is Delphi still a thing today? I remember decades ago we tried to make an UI app in Delphi, then migrated to Borland C++ Builder, and then threw in a tower and rewrote everything in MSVC, because Borland stuff would hit a wall and fall apart for more or less complex usecases. For simple stuff and quick prototyping it was ok. Today we use Python for that.

I often find issues months later, and I don’t just need to go back few revisions but revert that specific change only. Source control tools were made for this purpose — so why not use them, even if you may never need their full power? But if you do — then it would save a day. Overkill solutions for everything can be a good thing in the long run.

The downside is complexity. I don’t need to push or pull files for a 2 line change.
Usually I just open the file (in nano :)), change it, save it. Most of the time this works, when it doesn’t, I quickly undo the last change and try to figure out why it didn’t work. If I need to do a bigger edit that may not be as fast to undo or I am not sure if the change is going to work, then I either make a backup or a test copy.

But with source control I probably would have to do something like this: edit the file on one server, push the change to the git server (also writing a comment on how I added a semicolon), then pull it on the “use” server that I need. If I have two “use” servers and the files in both need to be slightly different, I get even more complexity.

And honestly, if there was a situation that my change broke something, but it became apparent a month later, I could probably debug the breaking faster (imagining it was some new bug) than I could going through change history trying to figure out if that change was the one which broke it. I either still remember the change or if I don’t, then just debugging it would be faster.

This has not happened to me. My stuff either crashes immediately, works OK or seems to work OK, but I get calls that it actually doesn’t work in about 15 minutes.
Probably the longest time I have to wait for answers is when I am tweaking a backup script. I change it, run it, but it may run for a few hours or longer.

My stuff is very simple. One of the more complicated things I did was modifying the code of Storj v2 node so it would use files for storage instead of some kind of a database (which was really slow if it got big). The complexity was because it was a language I did not know (node.js) and the code was split into multiple files. Still, do the change, fire up a test environment, try to upload a file, download a file, delete a file, it if works, update the node and replace the 2-3 files I edited. It actually worked quite good.

That’s cool, still no scrollbar to quickly go back up 1-10k lines (I don’t know from the beginning). From what I see in the screenshots, tmux is usually used to display multiple windows side by side, though I guess it probably can be used to display one window/tab at a time with some kind of title. It may be useful if I cannot easily use my GUI client to connect to that server, but. Still a GUI client has tabs, windows that can overlap (this is quite important to me) and scrollbar :slight_smile:

I like using the mouse, I guess that I got used to it, since pretty much all the time I used a PC it was Windows and I used DOS only to play some games, but even then, Norton Commander supports mouse :slight_smile:

I don’t know, but something not being “a thing” or being “unsupported” does not stop me from using it. There is an alternative that runs on Linux, though I do not remember what it’s called as I don’t use in on Linux. I can use bash or php there.

EDIT: GUI ssh vs CLI ssh. I use CLI ssh a lot - in scripts, connecting from one server to another. It is useful because I can do zfs send | ssh x zfs recv. However, I do not really need that in the initial connection from my PC to the server. The most I need is to upload or download files and some ssh clients also have scp or zmodem support for that.

git commit -a --amend
git push force --with-lease

or use a Gerrit:

I usually use a Visual Studio Code, because you can connect it to any server via ssh and edit remote files with a comfort (syntax highlighting, suggestions, linters, etc.), you can connect it into a docker container or pod in the k8s cluster, wsl2, and so on, and it has a lot of extensions and integrations, include GUI way to use a source control systems. And of course you can open a terminal right there.
By the way, you can open a VSC on GitHub in your browser - just press . (dot)
I use vim too, but much less often.

No servers involved. Git is local. You just do what you do, and commit. Locally.

It’s also a good idea to document what you’ve changed, so you already have the text to for the commit comment ready anyway. Using git costs you therefore nothing.

It’s just a matter of policy, if you always do this way — no extra thinking is involved.

And regressing an issue is always much faster than debugging — just binary search between the commit history. Can even be done automatically.

It’s a slippery slope. At some point maintaining the old stuff and working things around to make old stuff work overweights cost of migration to new stuff. Delphi is dead for all intents and purposes. Clinging to it is a classic sunken cost fallacy. There are modern tools to solve modern problems much better and more efficiently.

Why would you chose to use Norton commander and then use mouse there? Explorer is optimized for supports mouse; console tools are optimized for a keystrokes.

I used Dos Navigator, and then FAR manager. It’s the best thing ever. All to get away from a need to use mouse from day one. :).

I think FAR manager is still being developed, last I checked was few years ago.

Dos navigator actually had the best Tetris implementation I have ever seen! Oh the amount of time that was sunk there… good times.

Edit: yay!!! It’s still alive! https://www.farmanager.com/

Interesting. The only time I have seen git used was with some central server. But then again, it was used with a big program and not a 100 line script.

I think you are a bit overestimating the complexity of what I do :). I probably approach writing a script the way I approach repairing a tape deck. After I do the repairs, I check if it works properly and that’s it. If it fails some time in the future, it may not be because of my previous repairs, but because something else failed, so instead of retracing my steps, I just find the source of the problem and fix it.
I don’t remember ever having to undo a change that I made earlier than a few days before. I do it, the customer becomes happy (problem fixed, yay), still complains (not fixed yet) or starts complaining about something new (I probably broke it or maybe the problem was always there just that the previous problem was masking it).

How can it be done automatically? I mean, OK, let’s say I have all the previous versions saved and have comments on what was changed. I still would have to try each one to see if it works. Though, I guess, in my case it would be 2 versions saved if I saved only those versions that actually worked (at least initially).

Can I make a working 32bit Windows program with it? Yes.
It has been a while since I used it, because now I just use bash to do the same thing and do not need the program to run on Windows or have a GUI. But if I needed a program that ran on Windows or had a GUI, well, I would use it, I guess.

Just like I can call people and write text messages using a 15 year old phone.

Because Windows does not start for some reason or because I want to play a DOS game.
I never knew about Dos Navigator or FAR manager. At the time I did not have internet connection and used to think that “microsoft.com” written in a magazine was some kind of a program, because it had the “.com” extension.
I didn’t always use the mouse with NC, but sometimes I did. The dialogs (format a floppy etc) were similar to comparable Windows dialogs and were quite OK to use with the mouse.

1 Like

Via script, bi-secting revisions to find which revision where it works vs not. I do that quite often; granted, you would need to be able to automate the “does it work” checks. (I understand, you are not doing anything complex with this, but I still like overkill solutions).

Can you still run 32 bit apps on modern windows?? I seriously don’t know, but if so – I’m surprised and kudos to Microsoft for maintaining backwards compatibility for so long!

I like that approach. I do the same with everything but the phone, ironically. My car is 12 years old, the display – 10 years old, etc. but the phone and a laptop I upgrade every year, like a clockwork. Apple stuff has such a good resale value that I effectively “rent” equipment at a fraction of a cost.

DosBox?

I actually don’t remember having mouse in dos times. Maybe I’m mis-remembering. 286 and 386 hardware it was just dos, and precious ram would not be wasted by some unnecessary mouse driver.

It’s more fun on old hardware, but I was mainly talking about the time when Windows 95 was the latest OS. Some DOS games had mouse support and when the driver was loaded, I could use the mouse with NC as well.
Initially I did not have internet connection and when I got it later, I still could not effectively look information up, because my English skills were not that great.

Most of the time I can’t do it or writing such test would take much longer than writing the script in the first place.
I know that the way I do things would be really bad with anything complex. However, for simple things, it is much faster (for me). It’s the same like using a shovel to dig a 1m wide and 1m deep hole is faster (and cheaper) then getting an excavator.

Yes, you can’t run 16bit programs on 64bit windows, but 32bit stuff works. This is the reason why Windows has “Program files” and “Program files (x86)” and so on. One of the good things about Windows is the backward compatibility.

I tried a touchscreen phone and did not like it. I also sometimes have to use an Android phone or an Android TV (or STB) (because of an IPTV app) and usually when I need to do so, I don’t like it.
Car - 40 years old, I also use tape decks (R2R and cassette) a lot, both for playing music and recording new tapes and I also use VCRs, though not as much as I used to. My normal size (17") laptop is also something like 6-7 years old, but still good enough, except for playing new games. I also have a few mini laptops (6", 8") that are newer.

1 Like

6" laptops :rofl:
How can you work on that? I’ve seen someone strugeling with an excel table on a 13", but 6"? WOW!

easy. 10-11 years ago I have used a pocket PC (3.5". iPAQ 1940, resistive screen and stylus, you know) to fix my server on my work, while I was on the beach (GPRS via bluetooth).
My friends make a photo while I was working like that…

And some people claim to be able to work using a phone.

The mini laptop has a great feature in that it fits in a pocket, so I can carry it anywhere. Unlike a phone, it has a normal Linux OS (Kubuntu in my case) and a somewhat usable keypad. It also has a serial port (useful to connect to the console of some switch) and an ethernet port.

Would I write a program or even a 100 line script with it? Not if I can avoid it. But it is useful for some things especially if there is no table in that location. Using a big laptop by holding it on one hand and typing (or using the touchpad) with another is much worse than holding the small laptop with both hands and typing with my thumbs.

A long time ago I have a Psion 5 PDA that I used a lot. The mini laptops are basically the same thing, just with modern insides.

LOL! What a nice little thing! It has a touchpad also. I think the CLI Linux makes sense, but not Windows, with all those windows :wink:
Maybe if you shrink the interface to 25-50%, but the visibility it’s limited by resolution.

I use Kubuntu, with the GUI. Linux with just CLI is not very useful to me since I tend to have multiple windows/sessions open and it does not seem that something like tmux allows the windows to overlap.

It’s not something I would want to use the whole day, but for a short time it’s convenient as I don’t have to carry the big laptop. For example - replace a broken SSD in a server, then use this PC to connect to that server and run zpool replace command.

The resolution is quite good actually, Unlike some of the other small laptops I have, here the DPI is not too high. With high DPI displays, if something goes not work with UI scaling (say, a Windows program using Wine), then I have to look at the display from very close up.