Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

5 votes
7 answers
804 views
Why is the output of Device Status Report sent to the standard input instead of output?
On Wikipedia [it is explained](https://en.wikipedia.org/wiki/ANSI_escape_code) that "Device Status Report" is an ANSI control sequence that "[r]eports the cursor position (CPR) by transmitting `ESC[n;mR`, where `n` is the row and `m` is the column". So, in MATE Terminal, in Bash, if I do ```bash ech...
On Wikipedia [it is explained](https://en.wikipedia.org/wiki/ANSI_escape_code) that "Device Status Report" is an ANSI control sequence that "[r]eports the cursor position (CPR) by transmitting ESC[n;mR, where n is the row and m is the column". So, in MATE Terminal, in Bash, if I do
echo -ne '\e[6n'
then I get ;1R. It looks like a part of the response that Wikipedia describes. If I then add read like
echo -ne '\e[6n' ; read
then I get ^[[2;1R. I have it where I would expect to provide input. I conclude that this is the proper output of Device Status Report, and that it is being sent to the standard input. **What are the reasons that it is sent to the standard input and not output?** I find this behavior unintuitive. If I would like to know the position of the cursor, ideally I'd have it on the standard output. Like, I could then assign it to a variable easily. Does it play a role that the control sequence is called "Device Status Report" and not "Cursor Position Report"? I see there are multiple questions here regarding Device Status Report, but I cannot find any that would answer this question. If there is, I'd appreciate a link.
decision-making-mike (179 rep)
Jul 16, 2025, 11:48 PM • Last activity: Jul 19, 2025, 06:41 PM
26 votes
3 answers
1826 views
Why does gmtime() give days 1-31, but months 0-11?
The 'gmtime()' standard library function returns a struct that has days numbered 1-31, but months numbered 0-11. Why is that? Presumably there is some historic reason?
The 'gmtime()' standard library function returns a struct that has days numbered 1-31, but months numbered 0-11. Why is that? Presumably there is some historic reason?
ああああああああああああああああああああああああああああああ (444 rep)
Jul 11, 2025, 10:04 AM • Last activity: Jul 15, 2025, 01:57 PM
22 votes
2 answers
15089 views
Why are utmp, wtmp and btmp called as they are?
I know what these files record, but I'd like to known what 'u','w','b' prefixes mean. Can anyone shed some light?
I know what these files record, but I'd like to known what 'u','w','b' prefixes mean. Can anyone shed some light?
sgx1 (321 rep)
Apr 30, 2014, 05:53 AM • Last activity: Jun 15, 2025, 12:41 PM
8 votes
3 answers
360 views
What ever became of the "prep" program? And what can I use instead on modern Linux systems?
Long ago, in Seventh Edition UNIX (a/k/a V7), there was a program called `prep`. Its primary use was to take files of text, and break them up into one word per line, for further processing by other tools in a pipeline. It could do a little bit of other manipulation too, like telling you the location...
Long ago, in Seventh Edition UNIX (a/k/a V7), there was a program called prep. Its primary use was to take files of text, and break them up into one word per line, for further processing by other tools in a pipeline. It could do a little bit of other manipulation too, like telling you the location of each individual word within a file, ignoring specific words in an ignore list, or only paying attention to words specifically mentioned in an include list. It's sort of difficult to explain exactly what it does, but here is a man page from 2.9BSD for it. It had an assortment of interesting uses - for example, building dictionaries, spell-checkers, and the like. This program was rather short lived. It only existed in V7 and a couple of offshoots (and 2.9BSD was basically an offshoot of V7). It didn't previously exist in V6. It was removed from V8. It never even made it into 4.2BSD. It doesn't exist (at least not in this form) in any Linux distribution that I'm aware of, nor in FreeBSD and friends. There was another program that also (as far as I am aware) first appeared on V7, called deroff, that was primarily for a completely different purpose - but it had a "-w" option that told it to do the "split up files into one word per line" thing, similar to prep, but didn't do any of the other functions (like word numbering, include lists, and ignore lists). I assume for purposes like dictionary building, deroff -w subsumed the function of prep. That was comparatively much longer lived - but these days, there doesn't even seem to be a version of deroff packaged for any major Linux distribution, I know it's not in any recent version of RHEL, it's not in Fedora 32, and it's not in Debian 10 (but I'm pretty sure it actually was in Debian until not that long ago). Why did prep go away? Was it really because deroff -w duplicated most of its function? I presume that deroff has disappeared in current Linux distributions because people generally don't deal with [nt]roff-formatted documents anymore, except maybe for man pages. But with both of these tools gone, what can one use to do the "split up a text file into one word per line" function? Is there anything packaged for any modern Linux distro that would perform this function? (If you're going to respond with, "you can probably do this yourself with a simple script", I concede that is probably correct - but that is not the answer I'm looking for right now, I'm looking for a way to do this with some existing tool that already exists in modern Linux distributions...) Ideally, I'd like to find something that implements all the features listed in the man page I linked (plus the "implied" behaviors that aren't explicitly specified in the man page, like not considering punctuation to be part of a word, and how numbers that appear as part of a "word" are handled). :-) Practically, I don't think the include and exclude lists are particularly crucial, and while I'd like to have the word numbering (it can sometimes be handy to know the location of a word in a file), it's not that important. Handling of hyphenated words at the end of a line would be desirable.
patbarron (1306 rep)
Sep 23, 2020, 05:04 AM • Last activity: Jun 14, 2025, 09:53 PM
0 votes
0 answers
68 views
How to keep all bash history?
Is there a way to keep all bash history without any kind of management? I know HISTFILESIZE is the variable where you can specify the number of bash history records that are kept. But I don't want to go back to my bash history file and check how many history records I've already used up and extend t...
Is there a way to keep all bash history without any kind of management? I know HISTFILESIZE is the variable where you can specify the number of bash history records that are kept. But I don't want to go back to my bash history file and check how many history records I've already used up and extend this if I get close to the set limit. I just want to set "keep all history" somewhere and not worry about it ever again?
Xoteric (1 rep)
May 24, 2025, 03:16 AM • Last activity: May 24, 2025, 03:18 AM
0 votes
0 answers
30 views
Is there a way to keep bash for reformatting my history?
I commonly want to do something with a bunch of files, so I type in something like: $ for nam in *.c > do > echo $nam > done Aaah, I failed to use upper case C so I go to edit again and since I have `set -o vi` in my .bashrc, I go to edit in vim and it comes up: for nam in *.c; do echo $nam; done I...
I commonly want to do something with a bunch of files, so I type in something like: $ for nam in *.c > do > echo $nam > done Aaah, I failed to use upper case C so I go to edit again and since I have set -o vi in my .bashrc, I go to edit in vim and it comes up: for nam in *.c; do echo $nam; done I deliberately entered newlines in between the commands, I don't want/need bash to improve my text by putting it on a single line. In this case, it is no big deal but if I had several variables and commands, the bash-ification is a pain. Is there a way to keep bash from reformatting my history?
user1683793 (423 rep)
Mar 27, 2025, 12:20 AM
8 votes
1 answers
273 views
bash or ksh 'vi' mode - How to jump to end of history (most recent command)?
I am a long time ksh user, and use bash under duress - both in 'vi' editing mode. One thing that has always niggled - after searching back through history for a command (.e.g ` /needle`), how do I then jump forward through the history again to the most recent command? `G` would be the logical 'vi' c...
I am a long time ksh user, and use bash under duress - both in 'vi' editing mode. One thing that has always niggled - after searching back through history for a command (.e.g /needle), how do I then jump forward through the history again to the most recent command? G would be the logical 'vi' command (i.e. jump to end of file)... but for some reason that jumps to the beginning of the history, i.e. the oldest command. Seeing that, you'd think the opposite might be correct, i.e. 1G, but it seems G commands are not accepted. Does anyone know the trick?
Annihilannic (318 rep)
Mar 21, 2025, 06:31 AM • Last activity: Mar 21, 2025, 07:08 AM
27 votes
4 answers
3066 views
Why didn't GNU Info succeed man?
As per my knowledge/understanding both help and man came at the same time or have very little time difference between them. Then GNU Info came in and from what I have seen is much more verbose, much more detailed and arguably much better than what man is. Many entries even today in man are cryptic....
As per my knowledge/understanding both help and man came at the same time or have very little time difference between them. Then GNU Info came in and from what I have seen is much more verbose, much more detailed and arguably much better than what man is. Many entries even today in man are cryptic. I have often wondered why Info which is superior to man in many ways didn't succeed man at all. I still see people producing man pages than info pages. Was it due to not helpful tools for info? Something in the licenses of the two? Or some other factor which didn't get info the success it richly deserved? I did see a few questions on unix stackexchange notably https://unix.stackexchange.com/questions/77514/what-is-gnu-info-for and https://unix.stackexchange.com/questions/19451/difference-between-help-info-and-man-command/159817 among others.
shirish (12954 rep)
Oct 7, 2014, 05:11 PM • Last activity: Mar 19, 2025, 11:10 PM
5 votes
1 answers
127 views
Why does this bash for loop syntax work?
Why does this braced syntax work $ for (( i=0; i<3; ++i )) { echo $i; } 0 1 2 when the manpage says the syntax is for (( expr1 ; expr2 ; expr3 )) ; do list ; done $ bash --version | head -1 # on linux mint virginia (ubuntu jammy) GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) If this is a...
Why does this braced syntax work $ for (( i=0; i<3; ++i )) { echo $i; } 0 1 2 when the manpage says the syntax is for (( expr1 ; expr2 ; expr3 )) ; do list ; done $ bash --version | head -1 # on linux mint virginia (ubuntu jammy) GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) If this is a syntax addition which just has yet to be documented, when was it added?
jrw32982 (1089 rep)
Mar 7, 2025, 02:26 AM • Last activity: Mar 7, 2025, 06:48 PM
4 votes
3 answers
1226 views
How would I get my terminal to regurgitate the previous output text from past commands? Is this even possible?
I just ran a job that takes several hours, and I forgot to pipe that text into a text file. pseudocode: echo [previous text output] > OutputHistory.txt Additionally, I can't just "copy and paste" what was in my terminal because 1) the display omits important formatting characters like "\t", and 2, I...
I just ran a job that takes several hours, and I forgot to pipe that text into a text file. pseudocode: echo [previous text output] > OutputHistory.txt Additionally, I can't just "copy and paste" what was in my terminal because 1) the display omits important formatting characters like "\t", and 2, I may have closed the terminal window. Is this possible with any Unix commands?
Tom (163 rep)
Jun 8, 2016, 09:41 PM • Last activity: Feb 20, 2025, 12:47 AM
506 votes
6 answers
98581 views
Why not use "which"? What to use then?
When looking for the path to an executable or checking what would happen if you enter a command name in a Unix shell, there's a plethora of different utilities (`which`, `type`, `command`, `whence`, `where`, `whereis`, `whatis`, `hash`, etc). We often hear that `which` should be avoided. Why? What s...
When looking for the path to an executable or checking what would happen if you enter a command name in a Unix shell, there's a plethora of different utilities (which, type, command, whence, where, whereis, whatis, hash, etc). We often hear that which should be avoided. Why? What should we use instead?
St&#233;phane Chazelas (579252 rep)
Aug 1, 2013, 10:58 PM • Last activity: Feb 7, 2025, 04:19 AM
247 votes
4 answers
99368 views
Why are tar archive formats switching to xz compression to replace bzip2 and what about gzip?
More and more [`tar`][1] archives use the [`xz`][2] format based on LZMA2 for compression instead of the traditional [`bzip2(bz2)`][3] compression. In fact *kernel.org* made a late "*Good-bye bzip2*" [announcement, 27th Dec. 2013][4], indicating kernel sources would from this point on be released in...
More and more tar archives use the xz format based on LZMA2 for compression instead of the traditional bzip2(bz2) compression. In fact *kernel.org* made a late "*Good-bye bzip2*" announcement, 27th Dec. 2013 , indicating kernel sources would from this point on be released in both tar.gz and tar.xz format - and on the main page of the website what's directly offered is in tar.xz. Are there any specific reasons explaining why this is happening and what is the relevance of gzip in this context?
user44370
Jan 6, 2014, 06:39 PM • Last activity: Jan 21, 2025, 02:31 PM
2 votes
2 answers
165 views
Why is session defined on kernel level? Is it introduced exclusively for tty/job control?
I have read a lot of articles and questions/answers on this site about sessions. I understand what they represent ([source](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html)) : > A collection of process groups established for job control purposes. > Each process group is a me...
I have read a lot of articles and questions/answers on this site about sessions. I understand what they represent ([source](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html)) : > A collection of process groups established for job control purposes. > Each process group is a member of a session. A process is considered > to be a member of the session of which its process group is a member However, my question is, is the session as part of the "core" of the kernel (part of the task structure) purely because of the terminal and job control? In other words, **is the goal of introduction just for that reason, or is the session introduced "for a higher purpose" and is used (or intended to be used) in other situations as well, where the terminal being just one of them?** If it's true that it's only because of the terminal, I think it makes little sense to me. It could be implemented at the shell level (as is the case with job control). I understand why process groups exist at the kernel level, for example to group processes and do something with them together (send a signal to entire group), but I don't understand the session, what do they bring to me at the kernel level...
Yakog (517 rep)
Jan 19, 2025, 03:28 PM • Last activity: Jan 20, 2025, 03:53 PM
1 votes
2 answers
282 views
Why does the command 'source' have that name?
I wonder why a command that *executes commands from a file in the current shell* is named `source`. I can't see a relation between **run commands in the current shell** and the meaning of the english word **source**. Is there a history behind that name?
I wonder why a command that *executes commands from a file in the current shell* is named source. I can't see a relation between **run commands in the current shell** and the meaning of the english word **source**. Is there a history behind that name?
rrd (145 rep)
Jul 12, 2019, 01:48 PM • Last activity: Jan 9, 2025, 12:46 PM
5 votes
4 answers
1036 views
Were there Unix equivalents to BBSes?
During the 1980s and 1990s [Bulletin Board Systems][1] (BBS) were widely used on all kinds of computers. The [BBS Documentary][2] documents the rise and fall of the BBS subculture. Watching this documentary left me wondering about Unix systems. They are - similar to BBS - designed to support remote...
During the 1980s and 1990s Bulletin Board Systems (BBS) were widely used on all kinds of computers. The BBS Documentary documents the rise and fall of the BBS subculture. Watching this documentary left me wondering about Unix systems. They are - similar to BBS - designed to support remote TTYs over a modem, using getty and login to provide access to the system. Does there exist any record of a *publicly accessible* Unix system during the 1980s and 1990s that people could call into using a modem?
Jaap Joris Vens (913 rep)
Jan 16, 2021, 02:13 PM • Last activity: Dec 19, 2024, 04:44 PM
7 votes
3 answers
13939 views
newgrp asks for a password
I don't understand why `newgrp` prompts me for a&#160;password when I want to change my group.&#160; I&#160;don't even know what password it is asking for, but it&#160;is certainly not mine (user clime). $ id uid=500(clime) gid=501(www) groups=501(www),500(clime) context=unconfined_u:unconfined_r:un...
I don't understand why newgrp prompts me for a password when I want to change my group.  I don't even know what password it is asking for, but it is certainly not mine (user clime). $ id uid=500(clime) gid=501(www) groups=501(www),500(clime) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 $ newgrp clime Password: <--- huh?! My system is CentOS 6.3.
clime (521 rep)
Feb 27, 2013, 05:10 PM • Last activity: Dec 14, 2024, 01:27 AM
61 votes
4 answers
11609 views
Is the shell ksh93 dead?
On 2013-01-10 Glenn Fowler posted this to the [ast-users mailing list](https://web.archive.org/web/20151130233422/http://lists.research.att.com/pipermail/ast-users/2013q4/004368.html): >As has been pointed out several times on the AST and UWIN lists, AT&T gives very little support to OpenSouce softw...
On 2013-01-10 Glenn Fowler posted this to the [ast-users mailing list](https://web.archive.org/web/20151130233422/http://lists.research.att.com/pipermail/ast-users/2013q4/004368.html) : >As has been pointed out several times on the AST and UWIN lists, AT&T gives very little support to OpenSouce software, which is why we have so few people involved with our rather large collection of AST software. In spite of this, ksh, nmake, vczip, UWIN and other AST tools continue to be used in several AT&T projects. > It turns out that software isn't the only thing lacking support: both dgk *(David Korn)* (AT&T fellow, 36 years of service) and gsf *(Glenn Fowler)* (AT&T fellow, 29 years of service) have been terminated, effective October 10. Our third major partner, Phong Vo (AT&T fellow, 32 years of service), left a few months ago for Google. The UWIN maintainer, Jeff Fellin, is still with AT&T and provides UWIN support for some critical operations. > Both dgk and gsf will continue to work on AST software, and might actually have more time (at least in the short run) to focus on it. > The download site and mail groups will remain within AT&T for at least the next several months. Our AT&T colleague, dr.ek, AST user and bug detector, will maintain the site. We have secured the astopen.org domain and are investigating non-AT&T hosting options, including a repository with bug tracking. > The process of change will take time; the patience of the user community will be greatly appreciated. Its quite a shock to have 3 weeks to plan personal, career, and hacking futures after working in an environment that has essentially been stable for almost 30 years. The user groups will be informed as plans solidify. [Korn's own wikipedia page](https://en.wikipedia.org/wiki/David_Korn_(computer_scientist)) says he worked for AT&T Labs Research *until 2013..., but he is now working for Google[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed)* . A [dgkorn github user account](https://github.com/dgkorn) was created in November 2014, but it has been the source of exactly 0 public contributions since that time, and subscribes to as many repos. Since 2013, the related mailing-lists have grown progressively less active. For example, the [fourth-quarter ast-developers list for 2013](https://web.archive.org/web/20151130233525/http://lists.research.att.com/pipermail/ast-developers/2013q4/date.html) had posted 156 messages by 2013-12-01, but the same list for [fourth-quarter 2015](https://web.archive.org/web/20151130233555/http://lists.research.att.com/pipermail/ast-developers/2015q4/thread.html) lists only three messages, and this is the last of them: > Subject: Re: [ast-developers] Transitioning ast to GitHub >>> Is there any intention to transition the ast codebase to a source code repository like GitHub? That would make it much easier for the community to contribute. I'm concerned that without such a collaborative environment, ast-related development will stall as bug reports and source-code patches get lost in the ether. >> Does anyone have a full git repo they can publish somewhere (repo.or.cz, github, whatever)? Git server is down for ages, now even www2.research.att.com (204.178.8.28) went down. > This makes one wonder about the future of Kornshell. Has it died? Are we to see no more releases? And, indeed, [though AT&T lists all of the AST links](http://www.research.att.com/software_tools?fbid=FfppKZYg2tq#Software) at their *labs research* landing page, none of these seem to work. These are the same dead links listed at [kornshell.com](http://www.kornshell.com) for download. Even if the current server state should prove only temporary for now, the dried-up mailing-list doesn't seem to bode well. And so, is the korn shell now kaput? Or is there more activity along these lines elsewhere?
mikeserv (59293 rep)
Nov 30, 2015, 08:12 AM • Last activity: Dec 3, 2024, 01:32 PM
-3 votes
1 answers
96 views
Why is the adm group named adm? What does adm stand for?
According to [the Debian wiki][1]: > **`adm`**: Group `adm` is used for system monitoring tasks. Members of this group can read many log files in `/var/log`, and can use xconsole. Historically, `/var/log` was `/usr/adm` (and later `/var/adm`), thus the name of the group. This explains that the group...
According to the Debian wiki : > **adm**: Group adm is used for system monitoring tasks. Members of this group can read many log files in /var/log, and can use xconsole. Historically, /var/log was /usr/adm (and later /var/adm), thus the name of the group. This explains that the group adm is named after the legacy command adm. But what is that command named after? What do the letters A.D.M stand for? Is "adm" short for something?
Flimm (4473 rep)
Nov 28, 2024, 11:01 AM • Last activity: Nov 28, 2024, 11:04 AM
1 votes
1 answers
161 views
Why does /etc/group file not use user IDs?
Looking at the Linux group file I see that it lists group members by name and not by ID. Other files which need to identify users (e.g. shadow file) use the id. My question is how or why did group end up like this? It seem awkward if the username changes.
Looking at the Linux group file I see that it lists group members by name and not by ID. Other files which need to identify users (e.g. shadow file) use the id. My question is how or why did group end up like this? It seem awkward if the username changes.
John Smith (61 rep)
Nov 17, 2024, 01:00 AM • Last activity: Nov 20, 2024, 03:20 AM
47 votes
2 answers
18342 views
Is there a reason why the first element of a Zsh array is indexed by 1 instead of 0?
From my experience with modern programming and scripting languages, I believe most programmers are generally accustomed to referring to the first element of an array as index 0 (zero). I'm sure I've heard of languages other than `zsh` starting array indexing on 1 (one); it's okay, as it is equally c...
From my experience with modern programming and scripting languages, I believe most programmers are generally accustomed to referring to the first element of an array as index 0 (zero). I'm sure I've heard of languages other than zsh starting array indexing on 1 (one); it's okay, as it is equally convenient. However, as the previously released and widely used shell scripting languages ksh and bash both use 0, why would someone choose to alter this common convention? There does not seem to be any substantial advantages of using 1 as the first index; then, the only explanation I can think of regarding this somewhat "exclusive feature" to shells would be "they just did this to show off a bit more their cool shell". I don't know much of either zsh or its history, though, and there is a high chance my trivial theory about this does not make any sense. Is there an explanation for this? Or is it just out of personal taste?
deekin (650 rep)
Dec 30, 2015, 05:11 PM • Last activity: Nov 16, 2024, 09:50 AM
Showing page 1 of 20 total questions