Hi all. I was hoping someone may be able to clarify the use of the command type. I understand that it's a builtin command.It isn't clear as to why and when type should be used. I read (unix.stackexchange.com/questions/85249/…), however it's no clearer.
In reading (robelle.com/smugbook/whence.html), it suggests that type is one of a number of commands to determine if a particular command is an alias, program, script or built-in shell command. What is the typical use case of type in a real-world scenario?
I've a rpm package containing some files, eg rpm -qal | grep lsof /opt/usr/sbin/lsof /opt/share/doc/lsof-4.82 /opt/share/man/man8/lsof.8.gz
In my case it is mounted on other filesystem like EBS, is there a way in rpm or debian based machine where i could delete only the /opt/usr, but not /opt/share files, I tried using rpm -e but didn't worked
@Stuxnet78 That rpm package is violating the FHS. Unfortunately, that's not unusual.
@Stuxnet78 I'm not sure what you are asking. Why do you want to delete some of the files? And if you want to delete them, for whatever reason, then just delete them. What does rpm come into it?
Yeah I normally would but I figured I would have more issues explaining the problem and wanted to include the output in a gist
Thanks again though, that is some advanced awk wizardry. I know I am not an awk expert by any means but it still amazes me how much I don't know about it :p
@JeffSchaller ed! ed! ed! chanted the crowds, going wild
Jeff threw himself and surfed the crowd who carried him to a terminal with a shell prompt proudly blinking
the only editor on the system was ed
$ update-alternatives --config editor
There are 1 choices for the alternative editor (providing /usr/bin/editor).
Selection Path Priority Status
------------------------------------------------------------
* 0 /bin/ed -100 auto mode
1 /bin/ed -100 manual mode
@StephenKitt - Hi there Stephen, would you mind helping clarify what does it mean when a computer has a serial console but no monitor? Is (youtube.com/…) a good example of a serial console (albeit it's a USB connection but is similar in principle) but no monitor?
@Motivated what don’t you understand in “a computer has a serial console but no monitor”? (I’m not saying you should understand it, it’s a broad topic so I’d like to know what you know.)
youtube.com/watch?v=eQCJy9iUvTA is indeed a good example of a serial console and no monitor: the computer being used (the Jetson) has no monitor connected, and Jim interacts with it over a serial console (over a USB cable).
@Stephen Kitt- I'm currently reading a book on Linux commands and the topic touches boot options when installing a particular distribution of Linux. It reads defines "Your computer has a serial console, but no regular monitor." as the problem. The description is "You can run the install in text mode from the serial terminal. Use tty0 for the first virtual console, or ttyS0 for the first serial port.". The solution is "console=/dev/tty0".
@StephenKitt - I don't understand what it means to have a serial console (unless it is referring to a serial port that a device is connected to ).
@StephenKitt - Great. I wasn't far off from my understanding then.
@StephenKitt - On another topic In reading (robelle.com/smugbook/whence.html), it suggests that type is one of a number of commands to determine if a particular command is an alias, program, script or built-in shell command. What is the typical use case of type in a real-world scenario?
@Motivated yes, “have a serial console” means “there’s an input/output device of some sort connected to a serial port”, and the console=ttyS0 configuration tells the kernel to use that instead of (or in addition to) the default input/output console (the keyboard and monitor you’re familiar with).
@Motivated someone on my team is used to using pg as a pager (grep something | pg); on some systems, pg isn't installed, so they've set up an alias: alias pg=more
so if I "walked up" to that system and was surprised by the behavior of "pg", I could use type pg to find out it was really more
an AIX system has [ as a built-in, so type -a [ returns one line; on a Linux box, it's two lines: builtin and /usr/bin/[
@StephenKitt - Thanks. Would it be fair and reasonable to assume that the use of a serial console is only limited to an input and output device other than the keyboard, mouse and monitor i'm most familiar with?
@JeffSchaller - Thanks Jeff. Based on your example, it would suggest that type is used to determine the function of a particular file. Would that be correct?
@StephenKitt - If i have a keyboard and mouse connected to a system and in addition have a Jetson for example attached to a serial console i.e. USB, would that be analogous of the example of an input and/or output device that is connected to a serial port.
@RuiFRibeiro yeah probably the only hope short of a professional data recovery service (or someone with a soldering iron and some flash reading equipment)
@Motivated originally, serial consoles were this sort of device
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying or printing data from, a computer or a computing system. The teletype was an example of an early day hardcopy terminal, and predated the use of a computer screen by decades.Early terminals were inexpensive devices but very slow compared to punched cards or paper tape for input, but as the technology improved and video displays were introduced, terminals pushed these older forms of interaction from the industry. A related development was timesharing systems, which evolved...
“console” is the terminal used by the system administrator to control the system
@StephenKitt - Thanks. That's clearer now. I have to refer to multiple sources to try and make sense of a single concept. Only if i could download the understanding :-)
@StephenKitt - To clarify, do you mean to say that the serial console is the Jetson connected via USB that is interacting with a X terminal emulator?
@StephenKitt - Yes, i have attempted to understand the concept of console and terminal. It's a minefield of information to digest (at least for me at the moment).
@Motivated the serial console is a terminal of some sort (hardware, which was the case in the past, or emulated), connected to the system whose console it is, over a serial port
in some cases even the serial port is emulated
in the Jetson example, the hardware is a cable which provides a connection between a “serial port” on the Jetson and a USB-connected “serial port” on the PC, and the serial console itself is the communication tool used to talk to the Jetson
@Motivated pretty much; I’d say it’s whatever provides the terminal, which is usually some form of terminal emulator nowadays (e.g.minicom or even screen).
@StephenKitt - Probably digging a hole for myself here. Why call it console and/or terminal? It's confusing to go between the terms since my understanding of a console at least in today's term is the virtual console e.g. tty and the terminal is pty and pts.
@Motivated the terminology stems from systems which had multiple connected terminals; one of the terminals was designated as the console, and when the system booted up, only the console was active initially (in single-user mode), and the other terminals were activated later (in multi-user mode)
from the kernel’s perspective, the console is always present, other terminals may come and go
and then the terminology ends up being confusing since obviously the “user end” of the console can come and go too (you can close minicom at any time)
@StephenKitt - So in the context of consoles and terminals, do you mean to say that a computer along with a monitor, keyboard and mouse are not considered to be a console and/or terminal?
@StephenKitt - So hardware is not considered to be a console and terminal and it is the communication tool that is software that is either the console or terminal?
@Motivated on Linux, the default console is the virtual console which uses the attached keyboard and monitor, it’s not a serial console but it is a console
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying or printing data from, a computer or a computing system. The teletype was an example of an early day hardcopy terminal, and predated the use of a computer screen by decades.Early terminals were inexpensive devices but very slow compared to punched cards or paper tape for input, but as the technology improved and video displays were introduced, terminals pushed these older forms of interaction from the industry. A related development was timesharing systems, which evolved...
@Motivated the above are hardware terminals and can be used as consoles (serial consoles in fact since they connect over a serial port)
@StephenKitt - If i have understood this correctly, is that hardware terminals such as the one pictured was considered to be a console since it communicated over a serial port. Sorry for the questions since i'm trying to wrap the concepts in my head between hardware and software consoles and terminals.
@Motivated you’re mixing up “serial” and “console”; a console is a terminal with a specific role; in the Jetson example, that terminal is connected over a serial port, which is the form of communication.
In the Jetson example, minicom is emulating a terminal; that terminal is connected over a serial connection to the Jetson board, and because the Jetson’s kernel is configured to use a serial-connected device as its console, minicom ends up acting as the Jetson’s console.
minicom doesn’t know it’s a console; all it knows is that it’s emulating a terminal.
And I realise it’s all terribly confusing, because different people have slightly different definitions, and everything can be physical or emulated.
@StephenKitt - If i were to simplify the concepts, can i say conclusively that the keyboard, mouse and monitor are not the console and/or terminal or do are they considered to be a physical representation of a terminal?
@Motivated no, you can’t say that; you can say conclusively that they are not a serial console. But by default the keyboard and monitor connected to the system are its console (forget about the mouse).
@StephenKitt - Okay. That's clearer. Now if i attached the Jetson and attach it via USB, is the Jetson considered to be part of the console and it's connection to be the serial console?
@StephenKitt - I also assume the "system" is the CPU and operating system.
@StephenKitt - So in this instance the type of connection is USB and "console" is the function the terminal is establishing to communicate with the Jetson?
@Motivated USB on the PC end, something else on the Jetson end, and it appears as a serial connection. The whole contraption is a console because the Jetson’s kernel is told to use its serial port as a console (console=ttyS0).
In the Jetson example, minicom is emulating a terminal; that terminal is connected over a serial connection to the Jetson board, and because the Jetson’s kernel is configured to use a serial-connected device as its console, minicom ends up acting as the Jetson’s console.
@StephenKitt - All good. I'll read the answers again and attempt to anchor them to examples so that i have a clearer understanding. Thanks for your patience for seemingly obvious concepts.
@StephenKitt. I am attempting to have a precise understanding so that it enables me to establish a stronger foundation to progress further.
@Motivated Stephen Kitt is giving you a fairly strict definition of "console" (or at least trying to). Beware of confusion from people using that term more broadly, or in non-Unix contexts. E.g., if you have a Windows server where people connect with remote desktop, the keyboard/mouse/monitor connected to that server would likely be called the console. At least in the context of, say, an admin fixing it: "can't get to it over the network, will have to log in at the console".
It's still a similar idea, Windows of course presumes a GUI. And that's a special display, because it's the one that is always there and is used by the admin to fix the system if it breaks.
It might be useful to think of it historically too: you'd have a (big, think mainframe) computer system with a bunch of terminals (the actual hardware devices, pictures posted before) connected. Those terminals were spread across the building, or even in different buildings connected via phone lines. There was also a terminal in the room with the computer, that was the console. It was used by the admin(s). It was available even if someone put a backhoe through the phone lines, etc.
Potentially, the console also has special permissions. E.g., you could limit root login to console only — then you can use physical security (console behind a locked door) in addition to passwords.
Finally bought an SSD for my main system and I'm now unsure how I want to configure my partitions. Anyone with a 1SSD+1HDD configuration that can relate their experiences?
@Braiam I use windows for my main system ducks however I use a 10k RPM HDD for my boot filesystem and only use my SSD for games. My system boots almost immediately with the 10k spinning disk so I didn't see a need for my OS on the ssd
Does anyone know a way to stop programs like Okular, when invoked from a terminal (like Konsole), from writing reams of pointless garbage to the screen?
@Braiam Only one SSD? And yes, I have both HDDs and SSDs here.
I've semi-retired my HDDs. I put volumes on them that are infrequently used. LIke data.
@Braiam I have SSD + HDD configs, but not on a desktop yet. But more or less universally, you want to put things that are accessed frequently on the SSD.
Use HDDs for what they excel at — cost per gigabyte. So e.g., bulk video store.
Or music collection. Or any number of things where increasing IOPS (I/O per second) by 2–3 orders of magnitude isn't worth it.
@FaheemMitha on a serious note, you ought to be able to change the KDE/Qt logging level config. I know that's a thing you can do. I forget how, though, and would personally okular file.pdf >/dev/null 2>&1 if I cared...
The less flippant answer is you can monitor how quickly you're going through its life using smartctl. Which I've found — even for databases — is not a real problem.
177 Wear_Leveling_Count 0x0013 085 085 000 Pre-fail Always - 855 ... from a Samsung 850 Pro that's been running a pretty write-heavy MySQL instance for ~4 years
All of 15% through its wear leveling life. So that should last around 30 years total, I guess. Not going to worry about it.
231 SSD_Life_Left 0x0000 097 097 000 Old_age Offline - 3 ... that's a Kingston, with a backup database on it. Maybe only half a year on that, though. (The previous SSD failed, but from something other than running out of writes — it just stopped working. It was a Samsung no less...)
@FaheemMitha Like right now he has Mitch McConnell (not even a member of his staff!) making sure no spending bills get to his desk, to save him the arduous work of vetoing a bill
@Jesse_b A few hours ago I told one colleague to say hi to another colleague and then give him a short, swift kick to the goolies for divulging my name...
@FaheemMitha Mitch McConnell is the Senate majority leader, who isn't letting the Senate vote on any bills to re-open the government unless Trump approves. The second bit about arduous work is of course sarcastic.
If you really must know, I have severe problems with buyer remorse. So I research the crap out of everything. I usually throw in healthy pauses to make sure I'm not doing impulse buys. I don't really enjoy buying stuff, but sometimes it's necessary.
@FaheemMitha A lot of it looks really weird to folks outside India because, e.g., those kitchen scales you were looking at, here, are like the cost of a cheap (dining out) dinner. They're trivial.
@FaheemMitha Yeah but I am equally as skeptical about airbnb, it seems odd to be to find a random stranger on the internet and then stay in their house
Although I suppose you have the same chances of being murdered in a hotel, and most people are generally good people
Something about the internet really brings out the creeps though
@FaheemMitha I agree but I think they are weird for it. People wont bat an eye to spend $500 on a new phone but then complain it costs "too much" to eat healthy
@Jesse_b Well, part of that is probably a misunderstanding of what it means to eat healthy. And some of its true in terms of time — preparing healthy food does take more time than a lot of unhealthy options.
@derobert Yeah, I wasn't trying to argue if it is cheaper or not which I don't think it is, but just that many people in this country seem to have misguided priorities
@derobert And it's not just about the money. If you buy something that isn't good, well, you're stuck with something not good. Which does not, um, feel good.
And I realise Amazon accepts returns, but I don't really like doing that. Though I guess I'm going to have to do so right now. I bought a belt, but it doesn't fit. :-(
Actually, in the US it's easier, because you just have a lot more choices. Including, often, stellar options. Which you then, choose, naturally. Part of the problem here is that often there are no good options. Then you can either put a lot of effort into trying to find a good one, or accept a crappy one.
@Jesse_b Yeah, but I suspect he's pretending to be cheery while planning revenge. Which I guess is expected, maybe they just made him shave for photos.
@FaheemMitha maybe check the wayback machine to see how often its updated?
In the short span commuting and reading the transcript since my last message, I'm unsure how we arrived at the current topic... unless it's a ongoing meme
I've met a few people from Utah. Mormons, of course. There was a grad student at Duke. Nice guy. Very upbeat.
I remember that I had some Mormon missionaries come to my door one day. To my surprise, I recognized one of them. Curt has introduced us. It was kind of weird.
I wonder, if I converted, would I get to stay in the US? Might be worth it.
@Jesse_b The US does immigration on a per country basis. I think they have a quota. Guess what the most populous country in the world is? I'll give you a hint - it isn't Bulgaria.