Solved Updating the Linux software

Solved issue

Skybear

Active Member
Joined
Mar 7, 2026
Messages
179
Reaction score
140
Credits
1,404
I prefer to update Linux using the Terminal. I enjoy using it and entering the commands. Although, as a newbie, I sometimes wonder if I'll break something.

As far as I understand it, to routinely update the Linux software (kernel, DE, programs, etc.), I need to run two commands:
1) sudo apt-get update
- then -
2) sudo apt-get upgrade

Is that right?
 


You can use this all in one

Code:
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt clean -y

it runs all that is needed to update/upgrade and cleans up after as well as answering with a -y (yes) when it asks if you wish to remove whatever it finds to clean
 
This from @osprey is a reliable read



This, if run after deleting apps etc etc, removes All configuration crap/leftovers

sudo apt-get purge $(dpkg -l | grep '^rc' | awk '{print $2}')
 
or, @wizardfromoz's general clean up routine:....either all at once or line by line

I run them all at once....it works

Code:
#!/bin/bash
sudo apt-get update
#sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
 
This is run after all the others. I am still unsure why

Code:
sudo dpkg --configure -a
 
This is run after all the others. I am still unsure why

Code:
sudo dpkg --configure -a
It's only needed if you interrupt update process.
 
general clean up routine:....either all at once or line by line

I run them all at once....it works

It would, but the two commented lines are unnecessary.
 
.....Tinkerer at work....
 
Lol, you or me, bro'?
 
probably both of us....
 
Lots of good information.

But I think I'm getting lost in the asides and exceptions.

@Condobloke, you wrote in post 2:
You can use this all in one
Code:
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt clean -y


And then in post 4:
Code:
#!/bin/bash
sudo apt-get update
#sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove

I understand most of the first coding but the second eludes me. Can you explain? And should I use the first one or the second?
 
He may be me Bestie but I can't speak for him. As you know, it is Mother's Day in Oz, he may be spending time with his missus. She is good people, and a wonderful cook to boot.

Mike do you use Firefox and do you search with Google?
 
No worries. This isn't urgent. I use Firefox and search with DuckDuckGo. Why do you ask?
 
I need to run two commands:
1) sudo apt-get update
- then -
2) sudo apt-get upgrade

Is that right?
That's right but it's easier to type apt instead of apt-get:
Bash:
sudo apt update
sudo apt upgrade

I don't agree to combine them with && and -y because I want to see what's being upgraded.
 
At this point I'd prefer to see everything so I can understand what's being upgraded and changed.

You don't have to type "-get"? I thought that was needed?

What are the "autoremove" and "clean" commands?

What is the bash script in post #4?
 
If I run it command line at all anymore, I follow OP's example. I prefer the separate stops, don't mind pressing Y, I like watching it complete one step before moving on. Sometimes I'll run autoremove too, sometimes not.

If I needed to script it, above are some handy examples of efficiency that can help make the day go faster. I don't have a bunch of machines to keep updated anymore, mostly just this one. I look forward to seeing what what Update Manager has waiting for me and my coffee in the mornings, and why. It's like reading the news that won't make me mad. Confused maybe. Then I let it update (it always does nicely) and go on about my business.

Mint Xfce really is like an old Honda, and it'll spoil you if you let it.
 
You don't have to type "-get"? I thought that was needed?
This are 2 different commands doing in essence the same things.
apt-get is more advanced allowing for more options (switches) but you don't use any so using apt does the same.

What are the "autoremove" and "clean" commands?
autoremove uninstalls installed packages that are no longer needed, it doesn't uninstall all of them, only some it does.
clean removes downloaded packages that are no longer needed.

I personally use this instead:
Bash:
sudo apt autopurge
sudo apt autoclean
autopurge does the same as autoremove, however it purges packages instead of removing them, this means it also removes any config files and leftovers that would stay on computer with autoremove
autoclean unlike clean only removes packages that can no longer be downloaded.

What is the bash script in post #4?
Same thing except it's a script.
 
combine them with && and -y
That's is a line of commands used by @KGIII, ...I copied and pasted that from a posting by him.

Personally, I don't care what commands I use.....I probably use too many and double up on what is actually necessary....and I don't care three flying hoots.

It is actually unnecessary to clean Linux to the extent we used to do with windows. In windows, we would use everything we could find to throw at that system and go down on both knees and pray that it was sufficient to keep the many gremlins at bay, there.

Linux does not have that problem

I do my clean ups with just ONE thing in mind....I Like to see just how much of my disc I can make available by using every command I can lay my hands on. That's it.

Unnecessary?......Definitely !

Do I regard it as a personal challenge ?

Yes.

It's great fun, try it some time
 
Last edited:
@Skybear
Since you asked about differences, I suggest you to run man apt-get and man apt, it will list you all available options as well as what they do in more detail so that you can learn.

It is actually unnecessary to clean Linux to the extent we used to do with windows.
Yes, I very rarely run autoclean and autopurge, however I use the *purge instead of *remove also when removing manually a single package.
I don't see any purpose to keep config files of software that's gone unless I manually modified some configs myself and want to backup them.
 


Follow Linux.org

Staff online

Members online


Top