Common Commands For The Terminal And A Question

Sherri is a Cat

Well-Known Member
Joined
May 8, 2021
Messages
1,317
Reaction score
754
Credits
11,366
There are some commands I see more than others. I want to know what they mean or what they do.

Sudo- This is one of two I see all the time.
I think 'sudo' means it's me and my elevated privileges because I have to enter my password. I saw the term 'Super User Do' somewhere. That's the only reason I have a vague idea what it means

apt-
I have no idea what this means, but I see it all the time.

'locate (what I'm looking for)'
I found this one on my own. I recently used 'locate zoom'. I was looking for Zoom files, as in the app. I later realized the results were for every single file on my system that has the term 'zoom' in the (path?). The number of lines generated were so many that I couldn't enter them all in the code dialog! </>

I recognize a lot of other commands that I see over. Sudo is the one I see most and have been told to use when people are helping. Right now, it's just sudo and apt that I'm pretty sure I'm going to be asked to enter in the terminal.

Questions:
  1. How do I limit the results to the App? I'm guessing it might be a totally different command.
  2. What are the most common commands for the terminal?
 


@Sherri is a Cat wrote:


The command [icode]apt is used to manage packages in debian and debian based linux distributions. It's the package manager, and used in the terminal.[/ICODE]

Whilst the apt command itself has numerous uses, it's basic functions of installing and removing packages are the ones to master.

Basic use is as follows:

Before installing any new package, or upgrading a whole installation, one updates the apt databases on the system so that apt is made aware of the latest packages available to install:
[code]
apt update
[/code]
The apt command will use the sources.list in /etc/apt/sources.list to refresh its databases, and it's progress is shown on the terminal screen.

Then, the following commands can be run to effect results:

To install a new selected package, for example, the package: cowsay, run:
[code]
apt install cowsay
[/code]

To upgrade the whole installation, upgrading ALL packages that can be upgraded run:
[code]
apt upgrade
[/code]

To remove a package (using cowsay as an example):
[code]
apt remove cowsay
[/code]
When removing a package, apt will show on screen what will be removed, which may include a lot of dependencies which the user may not wish to also be removed. If the user doesn't wish to proceed, they can opt out at this point by hitting no.

To remove the package entirely, including its configuration files:
[code]
apt purge cowsay
[/code]

Sometimes users keep the configuration files on the system in case they re-install the package and wish to retain the configs, hence both "remove" and "purge".

There's an article on apt here: https://en.wikipedia.org/wiki/APT_(software)

There's quite a large family of apt commands, partially shown here: https://linux.org/threads/how-to-handle-bloat-on-gnu-linux.50147/#post-232163

The apt family of commands is an adventure. There are also a number of curses and GUI frontends for apt, but its operation in the terminal is very useful to know too.

So without understand everything else, apt code (not comand) is the first term in the line of code to identify the app you want to address??

I just want to understand this stuff. My mind organizes everything this way. I remember things better if I can understand what the purpose of a piece of code in the 'address'.

Right now, I'm thinking of it this way. Comparing it to a date, (and depending on where you live)...

Where I am we identify the month first. Today we are in the month of June.
Then we identify the day, June 30th. Then then year, 2024.

June 30, 2024

To me, it's more logical to identify the day then the month then the year. But they didn't ask me what they should do. It probably dates back to the time American Revolution. Danial Webster decided we should change the way some words are spelled. Like 'Favour' as opposed to 'Favor'. We have a lot of words like that! Even the way we pronounce words is different in some cases, such as 'Schedule'. It sound more like 'Skedule' when spoken.

Okay... some of that was off topic, but I think it explains how my mind is trying to file away this information
 
To me, it's more logical to identify the day then the month then the year. But they didn't ask me what they should do.

Imagine some files named like this...

01252021
11082023
12072023
01022024
02032024
03042024
11052024
12072024

Which file comes first? How would you sort them?
Linux reads filenames from left to right.

All the files that start with "0" would get sorted first, no matter what year was at the end.

Now imagine some files named like this.

20220805
20230915
20240205

It might be harder to read, but it's easier for the operating system to sort.
The files that start with 2022 would get sorted before the files that start with 2024.

We have a Bind DNS server.
The beginning of our config file has a serial number that looks like this.
2024080913 The "13" on the end is just the 13th time today that file has been edited.
Bind looks for this serial number in the file. It looks for the biggest number.

so if I named my files something like

12302022
01012024

which file come first chronologically?
But which is the bigger number?
 
I'm sorry that formatting of the post in post #2, is BAD, and I deleted it, but not in time unfortunately for you to catch it. Here is a proper format.

The apt command is used to manage packages in debian and debian based linux distributions. It's used in the terminal.

Whilst the apt command itself has numerous uses, it's basic functions of installing and removing packages are the ones to master.

Basic use is as follows:

Before installing or upgrading any new package, one updates the apt databases on the system so that apt informs itself of what is the latest to install or upgrade:
Code:
apt update

This apt command will read the file: /etc/apt/sources.list, to locate the online repositories of packages to get the latest info.

Then to install a new selected package, for example, the package: cowsay, run:

Code:
apt install cowsay

To upgrade the whole installation, upgrading all packages that can be upgraded run:
Code:
apt upgrade

To remove a package (using cowsay as an example):
Code:
apt remove cowsay

To remove the package entirely, including its configuration files:
Code:
apt purge cowsay

Some times users keep the configuration files on the system in case they re-install the package and wish to retain the configs, hence the two options "remove" and "purge".

There's an article on it here: https://en.wikipedia.org/wiki/APT_(software)

There's quite a large family of apt commands, partially shown here: https://linux.org/threads/how-to-handle-bloat-on-gnu-linux.50147/#post-232163

Familiarising oneself with the apt family is an adventure :)
 
All the files that start with "0" would get sorted first, no matter what year was at the end.
This is what I was thinking, the smaller 'number' first.

1 sudo_me with elevated privileges
2 apt (x variable)_ the thing I want to address
3 I guess what I want to do with x variable?

Now imagine some files named like this.

20220805
20230915
20240205
Logic, exactly where my mind goes with everything. It's a lot harder for me to remember something if I can't identify the logic in it. Like those long strings of code... sudo and apt might be the first terms in the command, but if I don't what the first 2 terms mean, I won't remember on single bit of it or how to use them

It might be harder to read, but it's easier for the operating system to sort.
The files that start with 2022 would get sorted before the files that start with 2024.
It's easier for me too!
 
I'm sorry that formatting of the post in post #2, is BAD, and I deleted it, but not in time unfortunately for you to catch it. Here is a proper format.

The apt command is used to manage packages in debian and debian based linux distributions. It's used in the terminal.

Whilst the apt command itself has numerous uses, it's basic functions of installing and removing packages are the ones to master.

Basic use is as follows:

Before installing or upgrading any new package, one updates the apt databases on the system so that apt informs itself of what is the latest to install or upgrade:
Code:
apt update

This apt command will read the file: /etc/apt/sources.list, to locate the online repositories of packages to get the latest info.

Then to install a new selected package, for example, the package: cowsay, run:

Code:
apt install cowsay

To upgrade the whole installation, upgrading all packages that can be upgraded run:
Code:
apt upgrade

To remove a package (using cowsay as an example):
Code:
apt remove cowsay

To remove the package entirely, including its configuration files:
Code:
apt purge cowsay

Some times users keep the configuration files on the system in case they re-install the package and wish to retain the configs, hence the two options "remove" and "purge".

There's an article on it here: https://en.wikipedia.org/wiki/APT_(software)

There's quite a large family of apt commands, partially shown here: https://linux.org/threads/how-to-handle-bloat-on-gnu-linux.50147/#post-232163

Familiarising oneself with the apt family is an adventure :)
Again using cosway, why wouldn't it be written this way?

apt update cosway


Or do you first have to tell the terminal...

"Hey terminal! We're about to update an app" .... apt update

Now I have the terminals attention and it's waiting for me to tell it which app I want to update?

Or... unless I identify a specific app, the terminal will update everything?? Given that when I entered 'locate zoom' and I was presented with every single file with the term 'zoom' in the address, this would make sense to me.

Without understanding this part, I'm getting lost in the rest of what you said. My mind is going back and forth trying to use the rest of the information to figure out what the first part is!

I know you've probably been doing this a long time. I know when I try to explain something I know very well, I go far beyond what someone can understand. It's either something like that, or I'm dumb!!!

Please tell me I'm not stupid!! :p :eek::p[/code]
 
No stupidity is involved :)

The "apt update" option in post #4 doesn't do anything but update the database on the system so that the apt command can know what the latest applications/packages are available to update. If you make no further commands, nothing will be installed or removed or updated on the system, apart from the apt database which is largely out of view of the user, unless they go and look for it on the system.

To install the package, e.g. cowsay as the example in post #4, the command to install has to be run:
"apt install cowsay".

It's possible to run the install command without first running the update command, but the problem with that is the program which will be installed may be an older one with difference dependencies and not the latest one. That can result in needless complications, although they can be managed.

On remembering options, there are so many, one usually consults the man page for the lesser common ones, but for the basic 3 to 6 options, one can usually recall them and they may suffice for most if not all the time.

With the apt command, there are GUIs that do quite a lot of the same functions, but not all.
 
Last edited:
Take this with a large block of salt, as I'm a neophyte myself. Only been using Mint Cinnamon for less than 2 years. But here's what I've told myself about these two commands.
Sudu = "log in as administrator" in the winblows world.
Apt = "run software manager" with update, install, remove, purge, etc being which aspect of the software manager to be used. Of course these are not really what's going on, but it's how my mind processes the meaning of the terms as I have zero formal schooling in programming or even using computers. But I have been toying with them since the early 1980's.
As for the date format, well, I'm a creature of habit. And having spent close to two decades in an Army uniform, there are only two ways to document a date. The first being the julian calander which is unknown to microsneak and Linux both as far as I know. The second, and the one that is displayed on all of my clocks is day, month, year. Mind you, I haven't used the terminal and command line for file manipulation since the GUI was invented. Which I first encountered on an Amiga 500 I bought used from a German gentleman on my second tour in Europe so I don't bother worrying about how terminal sorts the output.
 
No stupidity is involved :)

The "apt update" option in post #4 doesn't do anything but update the database on the system so that the apt command can know what the latest applications/packages are available to update.
This makes sense. I'm telling the terminal I'm going to update something. The terminal 'gets itself ready', it locates the database and gets ready to go...and that's it.... because you didn't say what you want to update.

The analogy I'm thinking of now would get me kicked off of the forum. I'll keep that one to myself!

If you make no further commands, nothing will be installed or removed or updated on the system, apart from the apt database

apt is the data base? Or sort of like a name for the data base, what the terminal knows is the data base.

which is largely out of view of the user, unless they go and look for it on the system.

To install the package, e.g. cowsay as the example in post #4, the command to install has to be run:
"apt install cowsay".

one can usually recall them and they may suffice for most if not all the time.
This is what I want to know as a new Linux user. For me, it seems like it wouldn't be much work then to find out how or what to change for most other things. I think these are the things I should remember as a newbie


With the apt command, there are GUIs that do quite a lot of the same functions, but not all.
Same as above.
 
Chuckle. Thanks osprey. It's been a long time since I've actually needed the julian calander. But it is nice to know it's available if the need ever arises again!
 
Try output for

Code:
apt list --installed '*zoom*'

I'm going to table this one because I have questions about this too. What I just learned needs to settle first!

Not only that, but when I reply, I see what you wrote this way.

Code:
   ( the code you just wrote)
 
@Sherri is a Cat wrote:
apt is the data base? Or sort of like a name for the data base, what the terminal knows is the data base.

The "apt update" command reads the /etc/apt/sources.list file (and also the files in /etc/apt/sources.list.d/ directory, if any), and gets the information of the latest available packages from the sites which are listed in those files.

The information it gets is stored in a database in the directory /var/lib/apt/lists/. There's a bunch of compressed files there with the info.

When apt is then asked to install a package, it has the latest info of where to get the package from, and where to get any dependencies it might need.

The terminal is just the medium and passes the apt command, whatever it is, to the kernel to take the necessary steps in relation to the hardware usage to enact the user's request.
 
Sudu = "log in as administrator" in the winblows world.

Apt = "run software manager" with update, install, remove, purge, etc being which aspect of the software manager to be used.

I guess the PTSD is passing and I'm well on my way to becoming a true Linux geek. This makes perfect sense to me. Maybe a few months ago I would have thought of this... If forgetting this is the price of freedom, so be it!
 
@Sherri is a Cat wrote:


The "apt update" command reads the /etc/apt/sources.list file (and also the files in /etc/apt/sources.list.d/ directory, if any), and gets the information of the latest available packages from the sites which are listed in those files.

The information it gets is stored in a database in the directory /var/lib/apt/lists/. There's a bunch of compressed files there with the info.

When apt is then asked to install a package, it has the latest info of where to get the package from, and where to get any dependencies it might need.

The terminal is just the medium and passes the apt command, whatever it is, to the kernel to take the necessary steps in relation to the hardware usage to enact the user's request.

Similarly

Although I cant see it, apt 'knows' it's available. But that's it...

1719803759517.png


Nothing is installed until I 'check' the box for this update.

apt install (what ever it is I want updated)

1719803995870.png


It's late where I am and my ADHD medication is wearing off. I'm not sure I can absorb much more than this!
 
Morning Sherri

another you will see is inxi, this is a machine information application and worth a play with, it may already be installed in your distribution and can give a multitude of information or just information on just one component.
inxi comes in 3 levels for you to try [and see the difference] these are the codes for a full report

inxi -Fnxxxz [note the z on the end] this is a filter to remove sensitive information for posting online if requested]

inxi -Fnxx [no z] will give you more information you may be asked for but it is down to trust if you wish to give it out on an open forum

Sudo inxi -Fnxxx is the fullest report and definitely not for posting

if inxi is not pre-installed, it will be in the software manager.
 
 


Latest posts

Top