How To: Have Infinite Bash History

Today we’re going to have a good time because we’re learning how you can have infinite Bash history. There’s a bit more to it and not all of you will want an infinite Bash history. But, for those that do, we’re going to accomplish that right here in this article!

First, I’m assuming you’re using Bash as your shell. The odds are really good that you’d know if you’re not using Bash, as Bash is pretty much the default. Bash is the interactive shell you’re using, known as Bourne Again Shell. If you don’t know what shell you’re using, I covered that in an article about determining the shell you’re using.

Side Note: I sometimes write articles that are meant to preface another article, but then I forget and don’t write the additional article. I suppose that helps keep things interesting…

So, as you know, when you type a command into the terminal that command is stored in a file typically called ~/.bash_history – a hidden file in your home directory. Well, there’s a limit to how much history that file will retain and this is Linux – meaning that, of course, you can change that value. Today, we’ll be changing that value – making it ‘infinite’.

No, of course, it’s not really infinite. There’s a finite amount of disk space you have. This being a plain text file, it takes up very little space. While it’s not technically infinite you can store a whole lot of entries in your Bash history. We’ll set it to infinite, but I’ll show you how to set it to any value you want.

Ready?

Infinite Bash History:

As you can see, this is a Bash thing. That’s a good sign that you’ll need an open terminal. You can press CTRL + ALT + T and your default terminal should open. See? We’re already making progress!

With your terminal open, we’re going to edit another hidden file. The name of this file is .bashrc and it’s a file that stores things like terminal settings.

The tool we’ll be using is ‘nano‘. Click that link to learn about Nano, including how to install Nano should Nano not come preinstalled in your chosen distro. As you may know, Nano is one of my favorite text editors. We use Nano a lot around here.

Start with opening the ~/.bashrc file with nano, like so:

Scroll to the bottom and add the following lines:

Any negative value, in this case, -1, will result in an infinite history. However, you can make that value any number you want. When you’re done adding those lines, you have to save the file. Remember, to save a file in Nano, you just press CTRL + X, then Y, and then ENTER.

You could make the value 5000, for example. That’d simply look like this:

The sky is the limit. You can make that value any number you want, but all negative values will be treated the same. If the value is negative, it means you’ve got an infinite Bash history. Don’t forget to save any changes with Nano, as instructed above.

Now, you could reboot or log out to make the new settings take effect, or you can simply tell your system to reload the file to make the changes take immediate effect. That’s an easy command, simply use:

As you can see, infinite isn’t infinite (nothing is in the real world, according to current observations) and you don’t have to choose the infinite setting. You can pick whatever numbers you fancy and the process is the same.

Closure:

There you go, you now know how to set up your system to have an infinite Bash history. Well, an infinite ~/.bash_history if you prefer. With that setting engaged, you’re limited only by your creativity, fanaticism, and disk space. Go nuts with it! They make bigger disks! (Also, it takes up very little space.)

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Search For Command History By Date

Today’s article is going to show you how to search for the command history by date. This isn’t hard, but might seem a little advanced for some of the newer users. We’ll be doing this through the terminal, of course. That seems like a good idea to me!

Unless you’ve made some fairly drastic changes, Linux terminals keep a log of previously entered commands. This is on a per-user basis and considered relatively secure, or at least as secure as your user account is. It’s helpful to be able to look at your command history, especially if you’ve forgotten what you did and you really need to undo it!

Previous history articles include:

Delete An Entry In Your bash_history

Dealing With Duplicates In Your Bash History

So, I haven’t really covered the .bash_history (proper name, I suppose) all that much. There really isn’t all that much to cover, but today we’ll learn how to search your command history by date. It’s most useful when you remember when you made changes but you can’t remember the precise commands used when you made those changes.

Find Command History By Date:

Like oh so many articles, this one too requires an open terminal. You can open one easily enough. Just press CTRL + ALT + T and your default terminal should open.

With  your terminal open, we first have to tell Bash to store and show dates along with the history. That’s an easy command that you need only run once:

When you next type ‘history‘, it’ll look like a hot mess until you figure out what the command has done.

Now, to find command history by date. To do that, you just enter:

The format for me is YYYY-MM-DD, though I suppose it could be different for others who have an alternative date format set up. I don’t really know, but it’s easy to figure out by just running the history command and deducing the format from those results. If you’ve done it properly, it might look a little something like this:

searching command history by date
See? It works! It does show the command used to show these results, of course.

So, if you want to see what commands were run on a certain date, you can do that. You can also find what you entered when you remember the day but not the commands you entered. It can be pretty handy so search the command history by date. Keep it as a handy tool, as you never know when you’re going to need it.

Closure:

And there you have it. You have another article in a very long list of articles. This one is  handy if you need to know your command history by  date. I know I’ve been known to use this myself, largely because I sometimes need to narrow down my history quite a bit, as I do a great deal in the terminal and my history is a hot mess.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

[Fixed] A Rambling Post About Switching To Linux

Today, we’re going to talk about switching to Linux – in what I believe will be a brief article. This article is just based on some observations, and I think we can have some fun with it. (Ed. Note: It’s not very brief.)

Note: I hit the publish button instead of the Schedule button, so the article was briefly published and notifications went out about this. Sorry ’bout that. I’m an idiot. In my defense, I get it correct the vast majority of the time!

Moving on…

First, for this article, if you want to ‘help’ and ‘contribute’ then please do so as  a comment – you’ll see why before the article ends. Adding your comments as a comment here makes more sense.

When people take piano lessons, and history/experience tell me that this is similar for other instruments, 90% of them will quit within the first year. That is, they will have paid for equipment and formal lessons (as that’s where this data was drawn from) and they still quit taking lessons within a year.

Sure, you can learn a lot in a year – including how to give yourself further instructions. But, are they really quitting taking lessons for that reason – or are they quitting taking lessons for other reasons, like not making progress fast enough, not enough reward for the effort put in, or simply not having enough time to continue with a hobby when life has more pressing problems? Have they truly quit playing Piano?

And, well, I suspect the number is similar for people who try to switch to Linux. I strongly suspect, but have no data – simply observations – that approximately 90% of the people who try Linux will give up and return to using their previous operating system – be it Windows or MacOS, or what have you – within a year.

Let’s talk about …

Switching To Linux:

I get it. It’s hard. If you’ve been using Windows since Windows 95, you’ve got some serious muscle memory going on – and you have some legit knowledge built up. You’re pretty much an expert with Windows by then – or you’ve spent a whole lot of money to get other people to repair your computer for you. I suppose the latter is possible, but let’s just ignore that subset. You’ve still invested a ton of hours into learning how to use Windows itself – never mind the hours invested in learning to use the applications you are used to using.

Right now – and this is what prompted it – I am on my 4th day without smoking. (I am taking the drug Chantix. It’s awesome, at least for me.) 

I’ve tried quitting before – and I’ve even gone extended periods without smoking. I dare say that I’ve quit smoking so many times, I’m an expert at it! However, your odds of success get better every time you try to quit. I’m being optimistic, even though I’d kick a nun for a cigarette. (That’s a figure of speech… Well, it’s my figure of speech. Please don’t send ninja nuns to my house to beat me up.)

I can hear  you now… “Alright, David… What are you on about?”

Well, I’ve written about switching before – but this is a different aspect. See, when you make the switch, you’re not just starting to learn how to use Linux, you’re quitting using Windows. That’s a lot of habits and oh so many countless hours invested in learning to use Windows – and you’re giving up on all of that and all the benefits (and limitations) that entailed. You have things you know and those things you know are now things you knew – ’cause those things you knew ain’t true with Linux.

I don’t want to talk about formalities. This isn’t a technical article. Instead, I just want to show you one of the motivators I keep using to not smoke out of habit. (My cravings are kinda gone, I think. It’s just now the times I’d smoke out of habit.)

Please, click this link to see a timeline of benefits you get from quitting smoking:

What happens after you quit smoking?

Edit: Here’s a link from a .gov site, so maybe having more authority.

Ideally, that link will take you to the anchor – which is a timeline of benefits you get when you quit smoking. If not, scroll down until you get to said section. Those benefits are what’s keeping me motivated. Those are my rewards for putting up with the discomfort. (I dare say they’re pretty good rewards, but that’s a topic for an article on a different site.)

I have a point to this! It’s coming!

Timeline of Benefits:

If you have followed the link(s) above (and please do before commenting), you’ll see that there are benefits as soon as 20 minutes has passed. That’s right, just 20 minutes after quitting smoking you’ll have some benefits.

So, for this exercise, I want you to tell me what benefits you’d have (at those, or other) various timed intervals after quitting Windows and switching to Linux.

Like, so…

After 20 minutes of quitting Windows, you’ll see that you actually decide when your computer is updated and rebooted! So far so good!

After 12 hours of quitting Windows, you’ll see that you don’t have to hunt for software because everything you need to get started is available in the default repositories – and it’s free! These are benefits you get from switching to Linux!

After 24 hours of quitting Windows and switching to Linux…

(And carry on like that…)

You don’t have to do the full list unless you feel like it. You can even change the timeline hours/days/weeks/months, whatever – just have fun with it. It’s not some school exercise, it’s just for fun.

I do ask that you leave these replies as comments here, so that others can find and read them down the road. If you’re unwilling to do that, feel free to leave them on Reddit or on Linux.org, but here would be ideal. So far, in all my years hosting sites, I’ve never sold anybody’s data – and I’ve never had your personal information compromised. Commenting here is pretty painless and relatively low-risk.

Like I said… Don’t just have fun with it, be funny with it – if you want. The sky’s the limit. Do what you will with the idea!

Closure?

By the way, I think users HUGELY underestimate how many hours they’ve invested in learning to use Windows. It’s just like how they don’t recall how many hours they took to learn to walk, to talk, to spell in their native language, etc… They don’t seem to realize they’ll need to put in a similar number of hours to learn to use Linux. Ah well…

Have fun with it. “In 15 years, you’ll be a wizened old graybeard writing shell script like a wizard cast spells, with Windows being naught but a dim memory only recalled when drinking heavily or in the feverish nightmares of an old man.”

What was it like when you were switching to Linux? What was your timeline like? If you’re just switching, what do you want your timeline to look like?

What was the timeline like for you? Feel free to make it an accurate summation of events as you witnessed them. You do what you gotta do, but leaving them as a comment will mean they’re attached to the post ‘forever’ (or as long as I keep paying the bills). So, be funny, be real, be optimistic, or be you. 

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Delete An Entry In Your Bash History

In today’s article, we’re going to learn how to delete an entry in your ‘bash’ history. It’s a useful skill to have, for any number of reasons. It’s not all that difficult and this shouldn’t be a very long article. Read on, my dear readers! Even a long-term Linux user might learn something – but I make no promises!

I’ve previously covered how to remove duplicates from your bash history. It may be worth checking that article out, as most of you are going to be using bash. Sure, there are other shells, but bash is the most common on desktops and servers. So, we might as well learn with bash.

If you don’t know, bash is both a language and an application. Unless otherwise specified, you’re almost certainly using bash when you open a terminal or TTY. 

When you enter a command in the terminal or TTY, it’s saved to your bash history. In fact, it’s saved to the hidden file ~/.bash_history. If you so wanted, you could just open the .bash_history file with a text editor and remove lines as you wished. That works just fine.

However, in this article we’ll be using the ‘history’ command. It’s a handy command, useful for recalling previously entered commands and managing those stored commands. I guess this is really more an article about performing some very basic tasks with the history command. Like I said, it’s good for you to know this sort of stuff – especially as a Linux beginner.

Delete An Entry In Your Bash History:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open right up and be ready for use!

So, with your handy-dandy freshly-cracked-open terminal, let’s just display your bash history. You’re going to do that with just the following command:

You’ll notice that every stored command from your bash history is assigned a number that’s shown on the left (or right, if you use a RTL language). Well, that’s how you delete it. You use that number in the following command:

You can use that command to delete an entry in your bash history, and you can do so as often as you’d like. While you’re there, you can also just plain clear your entire bash history with this command:

That will clear all of your bash history – more or less. Your current session may have not been written to the history at the time you issued that command. It might not be saved until you close the terminal instance. This makes it slightly more complicated to make sure the history is truly empty. However, it’s definitely close enough.

Anyhow, you might want to delete your bash history to remove commands that you’ve memorized. You might want to remove commands that didn’t work. If there are sensitive commands in your bash history, this is a way to remove them, surgically or en masse. There are all sorts of reasons why you might want to go through your bash history to delete past commands – and now you can!

Closure:

Yay! It’s another back-to-basics kind of article. In this one, we learn how to delete an entry in your bash history file. In some cases, it may be easier for you to just do so with a GUI and a GUI text editor. You don’t even need ‘sudo’ to make the changes and removing a lot of entries might be faster with a graphical application. Just remove the lines you don’t want showing up in the history any longer.

Also, I should mention somewhere that you can see the history by just pressing the up arrow, but I suspect folks will already know that. ‘Snot the best way to go about managing them, but you can see and select them, running them again as you wish.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

History: How Linux Got The Name “Linux”

If you’ve ever wondered how Linux got the name Linux, then wonder no longer, as this article will tell you about Linux’s naming history. It’ll be a relatively quick and easy article, which is perfect for today.

Assuming I scheduled this properly, this article will be published on America’s holiday, “Thanksgiving.” I suppose that means two things – thanks and giving. So, I’m thankful for Linux and I’m giving you this article explaining how Linux got its name.

This article was almost all copied directly from Wikipedia. That’ll save some time and effort! And, really, they detail it better than I could.

How Linux Got The Name Linux:

Quoting straight from Wikipedia:

Linus Torvalds had wanted to call his invention “Freax”, a portmanteau of “free”, “freak”, and “x” (as an allusion to Unix). During the start of his work on the system, some of the project’s makefiles included the name “Freax” for about half a year. Torvalds had already considered the name “Linux”, but initially dismissed it as too egotistical.

In order to facilitate development, the files were uploaded to the FTP server (ftp.funet.fi) of FUNET in September 1991. Ari Lemmke, Torvalds’ coworker at the Helsinki University of Technology (HUT), who was one of the volunteer administrators for the FTP server at the time, did not think that “Freax” was a good name, so he named the project “Linux” on the server without consulting Torvalds.[52] Later, however, Torvalds consented to “Linux”.

According to a newsgroup post by Torvalds,[9] the word “Linux” should be pronounced (/ˈlɪnʊks/ (About this soundlisten) LIN-uuks) with a short ‘i’ as in ‘print’ and ‘u’ as in ‘put’. To further demonstrate how the word “Linux” should be pronounced, he included an audio guide (About this soundlisten (help·info)) with the kernel source code.[53] Contradictory, in this recording, he pronounces ‘Linux’ (/ˈlinʊks/ (About this soundlisten) LEEN-uuks with a short but close unrounded front vowel.

And there you have it. That’s how Linux got the name Linux – and how to pronounce it, in case you didn’t already know.

And, wow am I grateful for Linux. Linux has brought me so many things and has opened so many doors. So, I’m gonna take a minute to also thank those who have helped get me here. Thank you. You know who you are. Thanks!

Closure:

Yup… This isn’t much of an article, but it is an article! I deserve an easy day or two. It’s the holidays and I’ve been particularly well behaved this year. Also, I’ve been exceptionally busy this year. Don’t worry, there won’t be too many articles like this.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.