My Linux tip for today

Chat about Linux in general
Forum rules
Do not post support questions here. Before you post read the forum rules. Topics in this forum are automatically closed 6 months after creation.
Post Reply
wwblm
Level 4
Level 4
Posts: 210
Joined: Fri Mar 05, 2021 3:11 pm

My Linux tip for today

Post by wwblm »

As I continue on my journey with Linux I find that my memory can always be better :D Thought I would share this little tip as it really is quite helpful for me.

Code: Select all

 history > "worth learning from.txt"
Enjoy!

Wade
User avatar
Moem
Level 22
Level 22
Posts: 16238
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: My Linux tip for today

Post by Moem »

Sorry, I don't get it. What's the tip?
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: My Linux tip for today

Post by AndyMH »

Dumping your terminal history to a text file. While it is obvious in hindsight, a good tip.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
wwblm
Level 4
Level 4
Posts: 210
Joined: Fri Mar 05, 2021 3:11 pm

Re: My Linux tip for today

Post by wwblm »

Moem wrote: Sun Mar 03, 2024 4:23 pm Sorry, I don't get it. What's the tip?
I keep telling myself that I'm not a computer nerd :lol: Never took computer classes in school (my high school did not even have a computer). My college department got a single Apple II the semester I graduated.

Perhaps I just have an odd sense of humor. I love that terminal command because it points out an essential fact, that history is worth learning from. Dumping my command history into a text file that I can scroll through is useful for me. I also happen to get a chuckle out of just putting it into one sentence like that.
Catsbark
Level 3
Level 3
Posts: 193
Joined: Sat Jan 14, 2017 11:53 pm

Re: My Linux tip for today

Post by Catsbark »

Long ago, in MS-DOS, using two > in the command (history >> history.txt) would append the new information to the old history.txt file without deleting the existing content. I don't know if Linux follows that same convention, but I think it would be worth a try.
Catsbark
Dell Inspiron 15; AMD Ryzen 5; LM 20.3 Cinnamon
"A learning experience is one of those things that says, 'You know that thing you just did? Don't do that." - Douglas Adams
User avatar
Moem
Level 22
Level 22
Posts: 16238
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: My Linux tip for today

Post by Moem »

wwblm wrote: Sun Mar 03, 2024 5:03 pm Dumping my command history into a text file that I can scroll through is useful for me.
Okay, it wouldn't do much for me, as I avoid the terminal most of the time. But thanks for letting me know what that command does.
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: My Linux tip for today

Post by AndyMH »

Catsbark wrote: Sun Mar 03, 2024 5:27 pm I don't know if Linux follows that same convention
Yes, it does.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Dullard du Jour
Level 5
Level 5
Posts: 519
Joined: Fri Dec 23, 2022 10:43 am

Re: My Linux tip for today

Post by Dullard du Jour »

wwblm wrote: Sun Mar 03, 2024 5:03 pm
Moem wrote: Sun Mar 03, 2024 4:23 pm Sorry, I don't get it. What's the tip?
I keep telling myself that I'm not a computer nerd :lol: Never took computer classes in school (my high school did not even have a computer). My college department got a single Apple II the semester I graduated.
.
.
The only class I took in school that prepared me for life was a typing class 52 years ago. I was the first male, and only male ever permitted into the class at that time. I told the principal I planned on going into business and figured I needed typing. The actual reason is it was where all the girls were and I was the only boy there. :lol: I took two years of typing and later when I entered the military, I was probably the only male that could type, so, they stuck me on the keyboard of all the mainframe systems KSR. That is how I began my education in computers. :)
rickNS
Level 9
Level 9
Posts: 2981
Joined: Tue Jan 25, 2011 11:59 pm

Re: My Linux tip for today

Post by rickNS »

Moem wrote: Sun Mar 03, 2024 4:23 pm Sorry, I don't get it. What's the tip?
Frankly Moem I am with you, I do not get it either ? Specifically because, history is already, and automatically stored in ~/.bash_history, so the above command is redundant, and at least IMO pretty much unnecessary. No tip at all.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
User avatar
BG405
Level 9
Level 9
Posts: 2510
Joined: Fri Mar 11, 2016 3:09 pm
Location: England

Re: My Linux tip for today

Post by BG405 »

One thing I've done when I want to "remember" a command which is rarely used but when it is, it's essential for something, is to repeat it but add a # to the beginning, press enter and then it's easily found with e.g. history | grep '#'. (The command won't actually be executed when you press Enter, with the #).

It's also worth appending e.g. export HISTSIZE=10000 to your ~/.bashrc otherwise you'll quickly start losing the old commands off the top of the list. I think the default is 500 or something. :D
Dell Inspiron 1525 - LM17.3 CE 64-------------------Lenovo T440 - Manjaro KDE with Mint VMs
Toshiba NB250 - Manjaro KDE------------------------Acer Aspire One D255E - LM21.3 Xfce
Acer Aspire E11 ES1-111M - LM18.2 KDE 64 ----Two ROMS don't make a WRITE
wwblm
Level 4
Level 4
Posts: 210
Joined: Fri Mar 05, 2021 3:11 pm

Re: My Linux tip for today

Post by wwblm »

rickNS wrote: Wed Mar 06, 2024 9:47 pm
Moem wrote: Sun Mar 03, 2024 4:23 pm Sorry, I don't get it. What's the tip?
Frankly Moem I am with you, I do not get it either ? Specifically because, history is already, and automatically stored in ~/.bash_history, so the above command is redundant, and at least IMO pretty much unnecessary. No tip at all.
Some people have no desire to use the terminal and have nothing to learn from it. I knew the history command. Forgot the location of the file. Knowing that, I can go to Nemo, show invisible, and do the whole thing without the terminal LOL!
Piping history to a file the way I presented it was my idea of a mnemonic device to engage a concept. For me it is just a way to try to become a little more productive with less effort.

For example: Browsing through my history with the intent of learning from it I can see what I like to do on initial install and just copy and paste the essentials into a file for new install. Some things took me a while to figure out -- like getting QEMU / KVM up and running. I actually did take notes on that. However, looking through the file it is easy for me to copy and paste into a very concise and short file and I won't even need the effort of reading my notes. I forget too many things. By browsing through the history my memory gets restored. I don't actually use the terminal all that much. However, there are several things I prefer it for and some of it is muscle memory more or less and some of it takes a little jogging for me to remember.
wwblm
Level 4
Level 4
Posts: 210
Joined: Fri Mar 05, 2021 3:11 pm

Re: My Linux tip for today

Post by wwblm »

BG405 wrote: Wed Mar 06, 2024 10:25 pm One thing I've done when I want to "remember" a command which is rarely used but when it is, it's essential for something, is to repeat it but add a # to the beginning, press enter and then it's easily found with e.g. history | grep '#'. (The command won't actually be executed when you press Enter, with the #).

It's also worth appending e.g. export HISTSIZE=10000 to your ~/.bashrc otherwise you'll quickly start losing the old commands off the top of the list. I think the default is 500 or something. :D
Thanks for the tip! BTW, I think you actually want to modify the HISTFILESIZE. The HISTSIZE is the casche that is stored if I understand it correctly.
User avatar
BG405
Level 9
Level 9
Posts: 2510
Joined: Fri Mar 11, 2016 3:09 pm
Location: England

Re: My Linux tip for today

Post by BG405 »

Both I think, in Mint. Thing is, I've done system upgrades, compiles etc. and found I lost half the output due to those default limitations. Same thing with the bash history.
Dell Inspiron 1525 - LM17.3 CE 64-------------------Lenovo T440 - Manjaro KDE with Mint VMs
Toshiba NB250 - Manjaro KDE------------------------Acer Aspire One D255E - LM21.3 Xfce
Acer Aspire E11 ES1-111M - LM18.2 KDE 64 ----Two ROMS don't make a WRITE
Post Reply

Return to “Chat about Linux”