How do you remember bits of sudo code?

Chat about Linux in general
SoyDodger
Level 1
Level 1
Posts: 11
Joined: Wed Dec 18, 2019 9:35 am

How do you remember bits of sudo code?

Post 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.
i5-3470, 8GB RAM, ASUS P877-M, a small SSD, noooo RGB, an nVidia GTX750 ti, and a partridge in a pear tree.

deepakdeshp
Level 17
Level 17
Posts: 7004
Joined: Sun Aug 09, 2015 10:00 am

Re: How do you remember bits of sudo code?

Post 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.
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help, and keeps the forum clean.
Regards,
Deepak

I am using Mint 19.3 Cinnamon 64 bit with AMD A8/7410 processor . Memory 8GB

RIH
Level 5
Level 5
Posts: 561
Joined: Sat Aug 22, 2015 3:47 am

Re: How do you remember bits of sudo code?

Post 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..
Host: bob-Aspire-TC-705 Kernel: 4.15.0-96-generic x86_64 bits: 64
compiler: gcc v: 7.4.0 Desktop: Cinnamon 4.4.8
Distro: Linux Mint 19.3 Tricia base: Ubuntu 18.04 bionic

User avatar
murray
Level 5
Level 5
Posts: 682
Joined: Tue Nov 27, 2018 4:22 pm
Location: Auckland, New Zealand

Re: How do you remember bits of sudo code?

Post 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.
Running Mint 19.3 Cinnamon on an Intel NUC8i5BEH with 16GB RAM and 500GB SSD

User avatar
Schultz
Level 7
Level 7
Posts: 1874
Joined: Thu Feb 25, 2016 8:57 pm

Re: How do you remember bits of sudo code?

Post by Schultz »

I keep a text file of some terminal (not sudo) commands.

User avatar
smurphos
Level 15
Level 15
Posts: 5960
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: How do you remember bits of sudo code?

Post 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.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
Portreve
Level 9
Level 9
Posts: 2585
Joined: Mon Apr 18, 2011 12:03 am
Location: Florida
Contact:

Re: How do you remember bits of sudo code?

Post 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.
Please be polite and remember to mark your fixed problem [SOLVED].

Presently running Linux Mint Cinnamon 19.3.

“The avalanche has already started. It is too late for the pebbles to vote.” — Ambassador Kosh

Still looking for a new job.

Hoser Rob
Level 16
Level 16
Posts: 6080
Joined: Sat Dec 15, 2012 8:57 am

Re: How do you remember bits of sudo code?

Post 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.

all41
Level 15
Level 15
Posts: 5950
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: How do you remember bits of sudo code?

Post 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?

User avatar
smurphos
Level 15
Level 15
Posts: 5960
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: How do you remember bits of sudo code?

Post 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.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
kukamuumuka
Level 16
Level 16
Posts: 6581
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: How do you remember bits of sudo code?

Post by kukamuumuka »

Good question which gives a lot of correct answers. :wink:

User avatar
AZgl1500
Level 12
Level 12
Posts: 4383
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: How do you remember bits of sudo code?

Post 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.

.
Linux Mint 19.3 Cinnamon

User avatar
dm999
Level 2
Level 2
Posts: 54
Joined: Sun Dec 01, 2019 1:04 pm
Location: West Somerset

Re: How do you remember bits of sudo code?

Post 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.
19.3 Cinnamon / Lenovo ideapad 500 15ISK / i5-6200U CPU @ 2.30GHz × 2 / 12GB RAM /

User avatar
AZgl1500
Level 12
Level 12
Posts: 4383
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: How do you remember bits of sudo code?

Post 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"
Linux Mint 19.3 Cinnamon

User avatar
trytip
Level 13
Level 13
Posts: 4508
Joined: Tue Jul 05, 2016 1:20 pm

Re: How do you remember bits of sudo code?

Post 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
Image

User avatar
dm999
Level 2
Level 2
Posts: 54
Joined: Sun Dec 01, 2019 1:04 pm
Location: West Somerset

Re: How do you remember bits of sudo code?

Post 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
19.3 Cinnamon / Lenovo ideapad 500 15ISK / i5-6200U CPU @ 2.30GHz × 2 / 12GB RAM /

essjam
Level 1
Level 1
Posts: 18
Joined: Sun Jun 05, 2016 2:28 am
Location: Kansas City, USA

Re: How do you remember bits of sudo code?

Post 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.
Linux Mint 19.3 "Tricia" - Cinnamon 64bit
(1) Asus K52F Laptop - i5 @ 2.53GHz, 8 GB DDR3 Ram
(2) ASUSTeK: Z97-A-USB31 - i7-4790 @ 4.00GHz, 32 GB DDR3 Ram
Raspberry Pi - Raspian Buster Lite - OpenMediaVault - 4TB NAS server

ZakGordon
Level 5
Level 5
Posts: 689
Joined: Thu Feb 12, 2015 11:07 am

Re: How do you remember bits of sudo code?

Post 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.
Laptop overheating? Check link here:itsfoss guide . A move from Cinnamon to XFCE can give a -5 to -10 degrees C change on overheating hardware.

Build a modern dual-boot Ryzen Win7/Linux Mint PC:Tutorial

Hoser Rob
Level 16
Level 16
Posts: 6080
Joined: Sat Dec 15, 2012 8:57 am

Re: How do you remember bits of sudo code?

Post 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.

rjsrjs
Level 3
Level 3
Posts: 137
Joined: Sun Mar 17, 2019 6:47 pm
Location: Florida

Re: How do you remember bits of sudo code?

Post 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.

Post Reply

Return to “Chat about Linux”