« first day (1257 days earlier)      last day (3704 days later) » 

1:24 AM
I just found this old question:
11
Q: How does keyboard mapping work in Linux?

Alex BI have always had trouble with understanding the way keyboard mapping and related things are put together in Linux. When things break, it makes my blood boil if I have to sift through endless outdated mailing list and forum posts to find THAT one command or inputrc line that fixes my problem. T...

Do you think it should be closed as a duplicate of my recent reference question?
14
Q: How do keyboard input and text output work?

GillesSuppose I press the A key in a text editor and this inserts the character a in the document and displays it on the screen. I know the editor application isn't directly communicating with the hardware (there's a kernel and stuff in between), so what is going on inside my computer?

 
@Gilles absolutely, voting now
 
@Gilles, seems fair enough, +1 from me
 
Anyone have any ideas on this?
1
Q: Why does my umask keep resetting to 000?

MilesWhen I login anew my umask is 002. At least for a while. Then at some point, and I'm not sure when, it reverts to 000. This is very inconvenient and I'm now constantly living in fear of dropping files and folders with strange permissions across my home directory. The reversion to 000 can happen ...

What the hell could be doing that?
 
 
2 hours later…
3:28 AM
@slm posted
0
Q: Why are there so many different ways to measure disk usage?

GillesWhen I sum up the sizes of my files, I get one figure. If I run du, I get another figure. If I run du on all the files on my partition, it doesn't match what df claims is used. Why are there so many different figures for the total size of my files? Can't computers add? Speaking of adding: when I...

and now I'm going to get back to sleep. If I forgot something I'll deal with it later.
 
slm
4:23 AM
@terdon - if you're bored we can link Q's that are asking where's my diskspace being used to this Q&A that Gilles has posted.
 
@slm yeah, I want to add to that meta list of canonical Qs too. You thinking we should close as dupes or just link?
 
slm
I'd prefer dupping but maybe we should ask Michael what would be best first.
 
This one is pointed to by various:
5
Q: Why is there a discrepancy in disk usage reported by df and du?

garconcnI have a Linux(CentOS) server, the OS+packages used around 5GB. Then, I transferred 97GB data from a Windows server to two folders on this Linux server, after calculated the disk usage, I see the total size of the two folders is larger than the disk used size. Run du -sh on each folder, one use ...

 
@slm +1 for this
 
Actually, most of the ones I find are either already closed or slightly different situations, orphan file handles or ramdisks and the like
Yay, got one!
3
Q: Why is there a mismatch between size reported by LVM and the size reported by df -h?

Steven DI'm new to LVM and have been very confused by this: I am transfering a large file to a partition that I thought had about 1.5 terabytes of space on it. Near the end of the transfer, rsync exits with an error claiming that the partition is full. I investigate and find the following: $ sudo lvm...

Let's close this one as a dupe of Gilles's, most of the dupes point to it and it's answer is not that good:
5
Q: Why is there a discrepancy in disk usage reported by df and du?

garconcnI have a Linux(CentOS) server, the OS+packages used around 5GB. Then, I transferred 97GB data from a Windows server to two folders on this Linux server, after calculated the disk usage, I see the total size of the two folders is larger than the disk used size. Run du -sh on each folder, one use ...

 
slm
4:39 AM
@terdon - thanks that's the one I had in mind.
 
 
4 hours later…
8:38 AM
good morning everybody !
 
8:51 AM
Hi @Kiwy
@Gilles LVM also deserves a mention. Similar issues there.
 
9:38 AM
@FaheemMitha what aspects would you like to see mentioned? Difference between number of LV extents and total PV size?
unlike the du/df/partition size difference, I don't remember seeing enquiries about this
 
@Gilles nice df/du/tune2fs post
 
10:11 AM
@Gilles thanks for info :-) in fact it make sense to disable read to anyone but root to block device
whouhou Rajcounar is reincarnate see this useful answer
-1
A: How do I share internet with Windows from my Linux box?

amal.lol. ghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjhtggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhjjjjjjjjjjjjjjjjjjjjjj

How can we flag those guy to moderator directly ? flag as spam ?
 
10:32 AM
Is there a way to print a table in a post ?
 
@Kiwy I don't think so. It's not included in Markdown and it's also not in the list of allowed HTML tags as per meta.stackoverflow.com/questions/1777/…
 
@JennyD :-( I also check and it seems to be a ban element on stackexchange
 
@Kiwy You can still make an ascii table, of course.
 
@JennyD do you know any simple way of doing that ? :D
 
@Kiwy That would depend on your definition of "simple"...
 
10:38 AM
@JennyD ok, I'll stick notepad++ and collumn edition :D you're probably about to offer me to use an obscure addon to emacs :P
 
@Kiwy Not an obscure one, no :-)
But there's a web page that does it for you, google for "ascii format text as table"
 
@JennyD They all are
 
does a good job of it, I think.
 
@JennyD that's indeed a very nice solution :-)
thank you
 
You're welcome
(And in emacs, it's about as non-obscure as possible: M-x insert-table)
 
10:47 AM
I will give emacs another shot day, but not now...
maybe now I'm use to nano, emacs would be less painfull
Also do you have any memory of bad example for regexp and pattern usage ?
I promise once to write a nice article on **what's difference between regexp and pattern and there usage** and the first thing i want to mentions is the thing you should not try to do with regexp
 
11:09 AM
@Gilles There was a question mentioned just above -
3
Q: Why is there a mismatch between size reported by LVM and the size reported by df -h?

Steven DI'm new to LVM and have been very confused by this: I am transfering a large file to a partition that I thought had about 1.5 terabytes of space on it. Near the end of the transfer, rsync exits with an error claiming that the partition is full. I investigate and find the following: $ sudo lvm...

@Gilles And whatever you want to mention. The thing I have noticed is the difference between logical volume size and what size is reported by df.
 
slm
11:35 AM
@Kiwy yes that would be spam. If you mention it here we 3 of us can vote to delete it too. DV'ing it and also you could flag with a custom message if you want to specify something to the mods directly.
 
@FaheemMitha I cover that when I say that the filesystem might be smaller than the containing volume if you've been resizing things
I might have aimed for too much stuff in one post, not everything can stand out
 
is there any way to set batch to print any non printable character like \n \r \s things like this ?
@slm OK :-) I will
 
11:52 AM
@Kiwy batch?
 
@Graeme bash :D SORRY
 
@Kiwy you can use sed l or cat -A to see non printing characters
cat -A is more ambiguous and less portable, but I find it easier to read in most cases
 
@Graeme how would you do so with the output of ls -l for example ?
 
Just pipe it - ls -l | cat -A
 
hey great
$ stands for jumpline ? or end of line ?
 
11:56 AM
Or ls -l --color=always | cat -A` if you want to see the escapes for the colours
yes, $ is the end of line
 
@Graeme ok thank you
 
actually sed -n l is prob what you want for sed to not print every line twice
 
@Graeme yes I tested it also, cat -A is more usable in my case
 
@Kiwy btw the rm *(1)* question that you put me on to yesterday is now top on my profile. I guess a thanks is in order, probably wouldn't have answered if you never pointed it out.
 
@Graeme you're welcome, I was really curious to have an explanation on that, the one you provide is nice btw :-)
 
12:13 PM
@Kiwiy, thanks. Its amazing how some questions don't take that long to answer, and seem to be really popular, yet with others you can and up spending hours investigating and nobody cares :)
 
@Graeme I realize this also, well glad that I made you win somme rep points :D can you confirm something ?
ls -l | grep *
should show every line of ls -l ?
 
Um no
Not sure what that actually does
* will give every file to as a separate argument to grep
 
does grep not suppose to use bash pattern ?
 
No, grep is regex, not glob
 
ok is there any way to test what I want simply ?
with bash pattern ?
 
12:19 PM
ls -l | grep ., will do what you want - . matches lines containing any character
 
@Graeme it makes sense if it uses regexp, but now I'd like to test it agasint bash pattern :-)
 
How about this - ls -l | grep $(printf " -e %s" *)
 
hum it looks really complicated to test a bash pattern :D
 
Yeah, won't work if there are any spaces in the filenames either
 
@Graeme what do you mean I want to search the ouput of ls -l not inside the file :-/
we might have misunsterdand ourselves ?
 
12:27 PM
@Kiwy, with grep * the first filename is the search pattern and the rest are files to look in. In this case your pipe is ignored
I think
 
@Graeme to be sure that I understand correctly .
grep use pattern,
grep -e use regexp
grep * will read each file in the folder and try to match * (wich mean any string in bash)
grep * - whould match the pattern * but use standard input instead no ?
 
If you want print each line of ls you need to specify each file as a different pattern and preferably use grep -F in case any of the file names contain characters that affect the regex (now that I think about it)
For grep * the * never makes it to grep, the shell expands it into a list of files that become the arguments to grep
 
@Graeme OK let's start again, I want to test **bash pattern** against anything, file content, command output. By bash pattern I mean the pattern like ls a* to list every files/directory that start with an a in the current dirrectory,.
is there any possibilities to to do such a thing ?
 
you need grep '*' to match the regex * - which will match a literal *
@Kiwy, not really for an actual bash pattern - what bash does is expand these patterns into lists of files rather than matching against arbitrary strings. Really this is what regex is for, some other programs use glob patterns similar to bash, but again this is usually only to match files.
 
12:43 PM
@Graeme in fact i'm trying to write a comlpete post about bash and regexp and that's what I though bash pattern are made to match file name.
So here comes my next question, own can I create a file with a jumpline in the name ? :D
 
You mean a newline? That's easy - touch "firstline
secondline"
 
sometime the easiest trick are the better trick :D
 
@terdon Do you want to reverse your close vote on this one please?
2
Q: GUI library or Window Manager using HTML

azariahHi I've been searching for the past couple of months for a Linux DE that's built on HTML. I found this as I was starting this question http://blogs.gnome.org/alexl/2010/11/23/gtk3-vs-html5/ and it's great but that's GTK via browser. What I want is to able to build my own DE as such using HTML. I...

 
@goldilocks having just read your answer, I will and with pleasure
 
@terdon :)
 
12:48 PM
@goldilocks I can't actually, I haven't voted to close it :)
 
@Graeme he he he it works thank you a lot for all the infos :-)
 
@Kiwy grep always uses regex unless you use the F switch
It normally uses BREs, -E makes it use EREs and -P makes it use PCREs
 
@terdon Delete (at least some of) your comments then -- my guess is they have inspired others to do inappropriate things.
 
Gilles's post on the different regex families is really good on this
 
@terdon I was convinced grep used bash pattern except when using -E :-) I'm going to learn a lot today
 
12:51 PM
@goldilocks I'd only left one! And that's gone and you addressed the reason for it nicely in your answer too.
@Kiwy no, it never uses globs AFAIK
 
@terdon @terdon where it is ?
 
Also, I was quite confused on the difference between globs and regex untill I asked this:
9
Q: What is the definition of a regular expression?

terdonI recently got into a friendly argument with Ghoti about what constitutes a regular expression in the comments to my answer to this question. I claimed that the following is a regular expression: `[Rr]eading[Tt]est[Dd]ata` Ghoti disagreed, claiming it is a file glob instead. The glob page on w...

22
Q: Why does my regular expression work in X but not in Y?

GillesI wrote a regular expression which works well in a certain program (grep, sed, awk, perl, python, ruby, ksh, bash, zsh, find, emacs, vi, vim, gedit, …). But when I use it in a different program (or on a different unix variant), it stops matching. Why?

 
@Kiwy double ping is the worse ping ;)
 
@Braiam I use the reply plus the @flag :D sometimes, when I really want something, I really put all my rage into it :D
 
@terdon Ok
 
12:59 PM
@Kiwy I was searching for a grep alternative that uses a glob style syntax, but no joy. It seems like something someone would have attempted to do at some point. I think the bottom line is probably that regex is way more useful for arbitrary strings and there is just too much you can't do with glob.
 
@terdon I wanted to do such a thing, but i could never beat the posix master
 
@slm why are we closing this? unix.stackexchange.com/review/close/41340
 
Anyone else have any ideas?
 
@Graeme not sure how glob would help here, it is a very limited approach
 
@terdon, same thoughts, but on the other hand it feels like there should be some obscure utility that is capable of this.
 
1:03 PM
The @Gilles explanation on regexp explains also why I hated sed so much, it uses BRE and not ERE and I'm pretty good playing with extended version of regexp but not that much when it comes to Basics one.
 
Just curious if there is
 
@Graeme how would that work?
@Kiwy use sed -r
 
@terdon @Graeme I was looking for a way to test shell pattern instead of regexp, obviously there no tool for it
@terdon yes I will :D
 
@Braiam probably because it's not a question but an assertion.
 
@terdon, just something like grep --use-glob blah*, instead of grep '^blah I guess
 
1:06 PM
@goldilocks why don't you break [that post ](unix.stackexchange.com/q/96774/22222) up into an actual question and post most of it as an answer? You have some great info there but there's no question
@Graeme grep blah.* ?
 
@terdon it seems that there are two quesiton in here
Is the method I used to attempt to wreck the card viable, keeping in mind it's intended to reproduce the effects of continuously re-writing small amounts of data?
Is the method I used to verify the card was still okay viable?
 
@Kiwy I have absolutely no clue, way over my head
Trying to read the question now it just reads like an answer and not a question :)
 
@terdon :D well i'm not even part of this debate , i don't yet reach the 3k power :D
 
@terdon I see "is my approach of wear testing actually accurate?" kind of question.... but maybe that's just me
 
@Braiam Is that in the post?
This is way too hardware for me, I don't understand half of it
I find myself wanting to both vote it up cause it's a hell of a lot of work and close it as NARQ :)
 
1:10 PM
@Braiam OMG -- I wrote that last year, partially because of a pattern w/ newbies on the raspberry.pi exchange having SD card corruption problems (often likely because they pull the plug without a shutdown) becoming convinced, through haywire telephone game online posts, that this was because SD cards wear out at the drop of a hat. So last night I went to reference it in response to yet another such post, and added a comment at the end of a string of absurdist comments left by one "Jason C"
He's a complete bullshiter. I also believe he left so many comments on my Q so that he could recieve notification if I added any. Unbelievably, within minutes of me adding a warning note -- remember, this is more than six months later -- he was right back at it.
 
@terdon, does there exist a utility, like grep, but which can accept glob patterns instead of the usual regex?
 
@terdon in numbered list
 
?
 
@terdon Excellent idea -- hopefully I can shake the troll that way too.
 
@Graeme I very much doubt it simply because globs are a shell thing and not designed for searching as such but for matching.
@goldilocks Yeah, shake that troll!
:)
 
1:12 PM
isn't "shake that thing" that goes the song?
 
@Braiam By its malformed head would be nice.
 
Man, this kind of thing is really where this site shines:
4
Q: Why is iterating over a file twice faster than reading it into memory and computing twice?

phuneheheI'm comparing the following tail -n 1000000 stdout.log | grep '"success": true' | wc -l tail -n 1000000 stdout.log | grep '"success": false' | wc -l with the following log=$(tail -n 1000000 stdout.log) echo "$log" | grep '"success": true' | wc -l echo "$log" | grep '"success": true' | wc -l ...

Pretty sure this boils down to tail being faster than echo though
 
@terdon programmatically there isn't much difference between matching filenames and line from a file. Anyway, I give up, if such a thing exists we have already established that it wouldn't be that useful. Maybe DOS had something like it.
 
1:27 PM
@Graeme that's an easy troll, it's a bit like invoking Hitler every which way :P
 
There, posted an answer
@Graeme try the <<< on which approach?
 
Instead of echo "$log" | just do <<<"$log"
 
@Graeme ah, OK, I doubt that will make a difference though, the data still need to be printed. Lets see
 
I'm wondering if it is the way bash handles builtin arguments, <<< would possibly get around that
 
@terdon and @Graeme I'm sure it's only because tail limitate the output to a certain number of line
 
1:40 PM
@Kiwy that's true in both cases
 
@terdon my mistake
 
@Graeme it's even slower actually, probably because it all gets concatenated to a single line so grep is slower
I updated the answer
 
@terdon In my tests it wasn't echo that was such a big deal - though it was pretty pointless - it was stopping and starting all over again.
 
@mikeserv as far as I can tell, and this is quite intuitive, as long as you are printing the data it will be slow. That is the rate limiting step in all cases.
 
@terdon Yeah keeping it out of your terminal is a big deal, too. I tried it with >&2 as well - much slower.
 
1:57 PM
@terdon, that's interesting, I thought a here string would at least have been faster than echo.
 
@Graeme Probably it would have if it wasn't in a variable - I think the shell will still try to handle quotes and IFS and all of that when piping it through.,
 
@Graeme I don't see why, in both cases it needs to copy each character to a buffer, that's the slow thing. I remember being shocked the first time I commented out a print call to a C program and the speed changed by several orders of magnitude (enormous amount of data)
@mikeserv exactly, it does splitting (it concatenates to a single line) and that also slows down the grep as I show with my last example
 
Yeah it was several orders of magnitude for me as well - 3 secs to .07s.
 
@terdon, printing to a terminal is much slower than to a pipe.
 
Yeah, but it's still a shell construct - you're hampered there.
 
2:01 PM
Also, the fact that the variable is quoted means that it will avoid word splitting
 
I think it still gets evaluated though, but I don't know for sure. Maybe not.
 
@Graeme actually, the printing to the buffer should be identical, what is slower is displaying.
@Graeme ah, that;s a good point, yes
 
Almost certainly there is a deep copy going on before it leaves bash
 
I'm pretty sure the here string is just a background build of a here doc.
Even in my examples there zsh kept calling the heredoc I was running <<<
 
@Gilles I don't follow what the relevance of this is.
 
2:05 PM
I thought that echo would have at least one extra deep copy though - from arguments to output. I thought that might be avoided with the here string as is was a shell construct there might be a more direct path
 
@Graeme I added an example with quoting, it's a little faster but not much. As long as you're printing (irrespective of whether you're displaying) in any way, it will be slow
 
@terdon, ok. Although now I am curious to see how cat would compare with echo. Whether that is faster or about the same...
 
Way faster.
It's super fast.
I tried using it too, and basically did with tee, but I had to use it twice.
 
So it is whatever the shell is up to for sure, but not word splitting and not necessarilly time spent writing to the pipe
 
Well, cat's just really fast. The quickest way for me was to do as little reading and writing as possible, while still keeping everything going. Stopping once - for instance to read into a variable - is going to at least double your time.
 
2:13 PM
What buffering would bash use, line buffering would obviously slow things down.
 
That's the only one it does I think - readline.
I did do a shell glob pattern search once.
Like you guys were talking about earlier. It just used the tail="${str#"${head:="${str%%[${GLOB}]*}"}" kinda deal and built from it.
It was pretty slow.
 
I imagine it would be
 
Maybe there are faster ways, but that's all I knew to do.
 
I would be interested to hear Stephane weigh in on that Q though. I'm not convinced the current answers really get to the bottom of it.
 
I'm hoping he will.
 
2:21 PM
anyon knows a terminal web browser that has non-interactive capabilities?
 
I had a lot of false starts.
@Braiam: You mean - scriptable?
 
I need to parse html
 
curl ?
 
yeah, curl prints html code
 
Bettersoup is what I've used when I had to - Python.
 
2:23 PM
is that what you need @Braiam ?
 
@mikeserv beautiful soup surely?
 
release=$(lsb_release -sc)
arch=$(uname -m)
package=$@

for i in $package; do
   curl packages.ubuntu.com$release/$arch/$i/filelist
done
the problem with that ^ is that also prints the html code
 
That one.
 
so, I need to manually remove it or parse it somehow
 
You are correct.
It's always bs4.
 
2:24 PM
curl gnia > /dev/null ?
 
@Braiam what exactly do you need to get from the html?
 
Obviously that's ubuntu.
 
@Graeme a package list
 
@Braiam you should use regular expression maybe :D
sorry personnal troll to myself
 
@Braiam, you can probably just uses sed for that
 
2:27 PM
I'm gonna run it.
 
@Braiam you could use perl's XML::Xpath
it would be the nicest way to parse a html file in bash
 
Ok, what's uname -m give you though?
 
mm.... then perl's XML::Xpath is installed in all systems?
 
if the file is simlpe enought you could just try to parse it with a regexp or womething like this (though it's not recommanded for markup language)
@Braiam if you only need standard tool :/
 
I don't get anything from that, but I doubt it's because of uname. It's whatever your $@ is.
sed will work... for a while at least.
 
2:30 PM
@Braiam, python xml.dom should be
 
Can you get json though? If you can, that's what you want.
 
It's quite good to use as long as you don't have anything too complex to do
 
One way to find out is to send whatever POST gets you the list as a GET instead.
A quick look shows this: script src="/packages.js"
 
@mikeserv there's no need for POST, the url itself gts me what I want
no, the list is html generated :/
 
Should be easy enough to get what you want with awk, everything is inside a <div id="pfilelist"><pre>
 
2:40 PM
 
@Braiam are you needing to get package contents for uninstalled packages too, or just installed ones? dpkg -L <package> works for the installed ones
 
The list section has no tags, treat it as normal text and no need to fear tony
 
You would have to be careful to account for possible variations in the html code, but I don't think there are any major advantages to using a dedicated parser here.
 
You just want div id=pfilelist
 
@casey you can use apt-file for uninstalled ones. I wrote up an answer on this a while ago.
 
2:41 PM
@casey any package, installed or not
 
@Braiam apt-file ?
 
@terdon there's an answer with that
 
ah, never had a reason to try it on packages I didnt have :)
 
@Braiam ah, you want to answer the Q?
 
I'm trying an adhoc method that would work without installing additional software or downloading a database
no, Oli asked another similar question
 
2:43 PM
This does it: curl packages.ubuntu.com/saucy/amd64/acct/filelist | sed -n '/pfilelist/,/^<\/pre><\/div>/p'
 
I'm checking perl now, since parsing html is always a bad idea
 
Then you trim the first and last lines.
 
@mikeserv that freaking works...
 
Yeah.
 
actuall only using pre
 
2:45 PM
Well, yeah, probably. But those are javascript marker tags. There's gotta be a POST sometime. Not in what you showed me though.
 
Why not just use grep ^/ ?
 
That would skip the first one, I think.
 
@mikeserv no, and it doesn't need parsing to remove the tags
 
@Braiam the pfilelist id is a better anchor than the pre - less likely to change next time the page is updated.
 
The source on the page concactenates the beginning of the <pre> tag, doesn't it? Or is it just my browser.
 
2:46 PM
@mikeserv I take that back, it does miss the 1st
 
?
Oh.
 
and I was hacking together a perl method... :/
 
Well, it's probably a better idea. Better still - json. You can get it if you can figure out what to call here: packages.ubuntu.com/packages.js
function init_tab_list(id) is the one you want I think.
 
as I said, the package list isn't a dynamic content @mikeserv
 
I don't think it is at that point, and certainly when I loaded it there were no POSTs, but something tells me there's gotta be an engine for that somewhere.
 
2:50 PM
@mikeserv php in the server end :/
 
Oh, well, shows what I know.
 
curl packages.ubuntu.com/saucy/amd64/acct/filelist | grep -oP '/[\w\d/.]+$'
That one should work and removes the tags also
Nope, needs - as well. Dammit.
 
Anyway, this handles the tags too:
 
mm... yeah, now I'm thinking about parsing the command not found database :D
 
curl packages.ubuntu.com/saucy/amd64/acct/filelist | sed -n '/pfilelist/,/^<\/pre><\/div>/{s/<.*>//g;p}'
 
2:54 PM
curl packages.ubuntu.com/saucy/amd64/acct/filelist | grep -oP '/[\w\d/.-]+$'
 
just in case ;-)
4430
A: RegEx match open tags except XHTML self-contained tags

bobinceYou can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool th...

 
@Kiwy yeah yeah, we all know Tony :)
 
I'm very familiar with that. You can target a specific page, at least until you can't.
 
@terdon yes but always nice to show this when 3 persons trys to accomplish such a task :D
 
15 mins ago, by terdon
The list section has no tags, treat it as normal text and no need to fear tony
 
2:57 PM
L O L
\o\ \o| |o| |o/ /o/
 
:)
 
Can't you get this stuff with apt, though?
 
@terdon also do you know how the strange unselectable characters appears on the post ?
 
@Kiwy look at the source, the man's an artist
 

« first day (1257 days earlier)      last day (3704 days later) »