Page 1 of 2

How do you remember bits of sudo code?

Posted: Sun Feb 09, 2020 9:58 pm
by SoyDodger
So following another discussion on the boards here, and as a new user, I'm now interested to learn how people remember all the bits of sudo code they use.
Is there a secret I don't know? Is it practice makes perfect? Frequent use? Do you just internet search for the lines you need?
Do you keep post-its around your monitor?
Do you rely on your eidetic memory?
Is there a repository of the most frequently used lines?

I know Mint's GUI bypasses the need of using Terminal for many users (like me) but I'd like to slowly get to grips with it if possible. Thoughts, feedback, humor and moral support welcomed.

Re: How do you remember bits of sudo code?

Posted: Sun Feb 09, 2020 10:18 pm
by deepakdeshp
The trick is to use command where ever possible. That way you would be familiar with the commands and sudo is used in combination with the commands.

Also use sudo carefully, otherwise it may destroy your system.

Re: How do you remember bits of sudo code?

Posted: Sun Feb 09, 2020 10:44 pm
by RIH
Hi SoyDodger.
I guess that you mean terminal code in general rather than just Sudo.

Like most things, repetition & constant use is the best way of committing something to memory.
However, I don't use the commands often enough to do that. :D
So what I have done is create a little text file on my desktop called 'Useful terminal Commands'.
It contains commands that others with knowledge have posted in the Forum in response to past queries & my own brief explanation of what the command does.
Then, when I need to do something in the terminal that my poor memory can't remember what the exact format is, I can open up the file & copy & paste the command from there.
The text file can be as complex, or simple, as suits you..

Re: How do you remember bits of sudo code?

Posted: Sun Feb 09, 2020 10:57 pm
by murray
I'm guessing that many people here will have been using Linux for many years (ie before desktop environments were available) and so have that experience to draw upon.

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 12:44 am
by Schultz
I keep a text file of some terminal (not sudo) commands.

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 1:41 am
by smurphos
Your terminal keeps a records of commands you enter in a history file - ~/.bash-history. That's my main method of remembering commands

Try the command

Code: Select all

history
in a terminal window to list all your terminal commands used

Then try the command

Code: Select all

history | grep sudo
to list all the terminal commands you have used that included sudo.

I've personally found it useful to maximise the size of the history by amending these lines in ~/.bashrc

Code: Select all

HISTSIZE=100000
HISTFILESIZE=1000000
My history file is in my list of important files to back-up and restore between different installs.

Another trick which will allow you to type the start of a partially remembered command in the terminal and then use the up/down arrows to find the last time you used it is to create a file called ~/.inputrc and add the content

Code: Select all

$include /etc/inputrc

# command history search
"\e[A": history-search-backward
"\e[B": history-search-forward

# extended command completion with tab
set show-all-if-ambiguous on
set completion-ignore-case on
You will need to log of and back on for that to take effect.

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 3:43 am
by Portreve
I'm a technology enthusiast, so even though my computer is my production machine, I also like to be as knowledgeable as possible so I can be as self-sufficient and functional as possible.

I don't know if there's any particular "trick" to it. You simply have to be someone who wants to know things and is willing to put in whatever requisite time and effort is required.

Once you learn the rudiments of anything, it's your job and responsibility to ask "What else is possible?" Whether this is terminal commands or how to cook, it really makes no fundamental difference.

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 9:06 am
by Hoser Rob
A lot of it is just repetition, but it halps a lot if you actually understand what the command in question is going to do. Then it's not just memorization.

If you want to be a sysadmin on a server you really do need to know all this CLI stuff because they don't install GUI shells on those. For desktop users, a good notes program will do fine. I like cherrytree.

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 12:08 pm
by all41
smurphos wrote:
Mon Feb 10, 2020 1:41 am

I've personally found it useful to maximise the size of the history by amending these lines in ~/.bashrc

Code: Select all

HISTSIZE=100000
HISTFILESIZE=1000000
My history file is in my list of important files to back-up and restore between different installs.
+1
I keep the history backed up and transfer it along as well.
I had originally set the ~/.bashrc size to 10000 way back when, thinking that would be waaay more than enough.
Reading this thread made me check things out---and my ~/.bash_history now has 9467 lines,
so I changed the size to 100000. Thanks for making me look.
my ~/.input.rc also contains some further entries:

Code: Select all

$include /etc/inputrc

# command history search
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char

# extended auto-completion with tab
set show-all-if-ambiguous on
set completion-ignore-case on


# colors
set colored-completion-prefix on
set colored-stats on

# misc
set blink-matching-paren on
set mark-symlinked-directories = on
I do not know the functions of the extra lines--do you?

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 2:12 pm
by smurphos
all41 wrote:
Mon Feb 10, 2020 12:08 pm
I do not know the functions of the extra lines--do you?
Not off the top of my head but man readline and info rluserman should be informative.

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 4:18 pm
by kukamuumuka
Good question which gives a lot of correct answers. :wink:

Re: How do you remember bits of sudo code?

Posted: Mon Feb 10, 2020 9:15 pm
by AZgl1500
I am memory challenged from 3 concussions when a Semi truck merged me into a center median 10 years ago.

So, I use www.EverNote.com to keep information in.

when I find something very useful, I make a note with a title appropriate to that topic.

then in the note area, I write up a generic way of saying the same thing,
and copy thread links and text into that note.

this has proven invaluable for me, I can now find 90% or more answers to what I want to do, without coming back to the forum.
My collection is now 2 years old... and gains more everyday.



this is just one example. every note that contains the word 'suspend' shows up in the left column, click on one of the shortcuts, and that topic is expanded in the right column.


Image


Evernote via the Web is free.
evernote on a device is limited to two devices.

I only have one device with the Evernote app, and that is my Smartphone.

there is one Caveat with Evernote, and probably with any other such application.

IF, 2 or more copies are open at the same time, only the changes in the LAST CLOSED COPY are saved.

that little bug-a-boo caught me in a bad way a time or three when I forget.

.

Re: How do you remember bits of sudo code?

Posted: Thu Feb 13, 2020 5:50 am
by dm999
I try (inert) commands when I see them mentioned on this forum and I do a bit of web research on them too. Also I made simple bash scripts for backups, giving them execute permission and creating launchers. Basically getting my hands dirty (without screwing my system).

+1 for CherryTree, I have a document for all things Linux which as a new user, I open and add to most days.

Re: How do you remember bits of sudo code?

Posted: Thu Feb 13, 2020 10:14 am
by AZgl1500
dm999 wrote:
Thu Feb 13, 2020 5:50 am


+1 for CherryTree, I have a document for all things Linux which as a new user, I open and add to most days.

for the life of me, I just cannot figure out how CherryTree works.....
I keep defaulting back to www.Evernote.com which I have used for nearly 3 decades now.

I much prefer to have my 'notebook' on the web, every time I go to a doctor's office, they want to know " have you ever? " and I just pull up my Smartphone and open Evernote and do a Search for "BP" or "Weight" or "Meds" and the doc can read it in Real Time.

my brain cells were never worth a damn for "facts"

Re: How do you remember bits of sudo code?

Posted: Thu Feb 13, 2020 10:20 am
by trytip
if i told you the secret, i'd have to kill you. but it's no secret, it's called a cheat-sheet. everytime you learn a code paste it into a text or doc file and there you have it. if you're organized you'll index it alphabetically for easier search

Re: How do you remember bits of sudo code?

Posted: Thu Feb 13, 2020 12:53 pm
by dm999
AZgl1500 wrote:
Thu Feb 13, 2020 10:14 am
for the life of me, I just cannot figure out how CherryTree works.....
I keep defaulting back to www.Evernote.com which I have used for nearly 3 decades now.
It's a usful bit of software, IMO. There's a quick start tutorial on the Cherrytree site - https://www.giuspen.com/cherrytreemanual/#_quick_start :D

Re: How do you remember bits of sudo code?

Posted: Thu Feb 13, 2020 3:43 pm
by essjam
Interesting discussion, I have used various forms of keeping notes about useful commands over the years. These included a spiral bound notebook for quick and dirty "Oh I better remember that" moments. Plus I keep a spreadsheet for Lessons Learned. This contains a variety of things from useful commands, to installation notes and trouble-shooting, and also a list of things I want to learn more about. Also, in windows I used Evernote (personal stuff) and OneNote (for work stuff).

When I moved to Linux, I was looking for similar capabilities. Obviously the spiral notebook is OS agnostic and is still in use. :) My Lessons Learned spreadsheet is still in place as it was transferred from Excel to Libre Calc. As for Evernote, Linux Mint comes with Tomboy Notes. It is a minimalist version of Evernote but gets the job done, but its organization and searching tools may get overwhelmed as the size of my note collection grows.

@smurphos - Thanks for the information about history. I didn't know that was available and will use it frequently.
@AZgi1500, @dm999 - Thanks for the mention of CherryTree. I will look at the tutorial see what it offers.

Re: How do you remember bits of sudo code?

Posted: Fri Feb 14, 2020 8:04 am
by ZakGordon
I'm such a GUI user (by history and habit in computer use) i basically don't remember terminal commands! (well except maybe inxi -Fxz)

Honestly i have to go back to my first computer, a 1kB ZX81, where everything was by the keyboard, and then something like the Atari 800 (when joysticks and trackballs started to emerge!) for an era when i was using a keyboard by default most of the time. As soon as the Amiga came along i saw the future and it was a rather nice GUI. That early introduction on the usefulness of GUI led directly into Windows 98 (my first PC operating system) and decades of Windows GUI use.

I only felt 'safe' looking at Linux when Ubuntu came along (in the 90's irrc) as that had a decent GUI. My growing dissatisfaction with Windows (from Windows 8 onwards, where among other things MS were seemingly trying to destroy their great GUI!) led me directly to Linux Mint, where it gives one of the best 'Windows like' Linux GUI experiences around (imho).

So i totally rely on the forums here as a record for the very rare occasion i need to use the terminal. I'm fine with it, but many Linux users will squirm at the 'damage' that GUI usage has done to me ;)

I just like GUI, and have since the Amiga. I feel right at home with Linux Mint.

Re: How do you remember bits of sudo code?

Posted: Fri Feb 14, 2020 8:56 am
by Hoser Rob
AZgl1500 wrote:
Thu Feb 13, 2020 10:14 am
.... for the life of me, I just cannot figure out how CherryTree works.....
I've found that going into preferences > toolbar and removing everything from it that I don't need (which is most of it) helps a lot. Programs that do a lot more than I need are fine if I can clean up the menu, and better than underpowered ones.

Re: How do you remember bits of sudo code?

Posted: Fri Feb 14, 2020 10:04 am
by rjsrjs
I usually open terminal type history and do a search for any previous commands that I typed in. If I can't find anything then it's time for forums city.