Reputation
729
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
6 13
Impact
~28k people reached

  • 0 posts edited
  • 0 helpful flags
  • 572 votes cast
Jan
23
comment Write output of `time` in a file, why are parentheses needed?
+1 nice explanations
Dec
18
comment Why do my xmodmap binds involving AltGr only work one some keys?
No idea exactly what's going on, but if you haven't done so already, you might want to run xev and press the various key combinations to see if the hardware and up to the Xwindows level is getting distinguishable keypresses to start with.
Nov
13
comment Is there any manual page for colored shell output?
See wynnnetherland.com/journal/… for a bunch of useful info including the grc package which can do all sorts of colorizing things with command output.
Nov
13
comment How to untar safely, without polluting the current directory in case of a tarbomb?
FYI: Found it at sourceforge.net/projects/patool . It's an rpm and I used alien to convert it to a deb for Ubuntu.
Oct
23
comment Automation: Autorearrange/reorganise Desktop Icons
Don't know Cinnamon, but does it have any option to lock the icons on your desktop (like KDE does)? That would probably fix it, if it exists. I get really annoyed when something scrambles my icons which I have carefully placed just where I want them! Is there a way to put new device icons in a folder (or somewhere else) instead of directly on the desktop? That would fix it too.
Oct
23
comment What causes a copy/paste in terminal to sometimes execute the command?
Sort of related: I have ended up with some file names with newlines in them caused by copy and pasting text from a web page into a file rename dialog. A file name like that can break lots of things. You really have to be careful when you copy and paste anything.
Oct
19
comment When would you use an additional file descriptor?
I know this isn't a new answer, but I had to stare at this quite awhile to see what it does and thought it would be helpful if someone added an example of this function being used.This one echos and captures the whole output of a command - df, in this case. dl.dropboxusercontent.com/u/54584985/mytest_redirect
Oct
17
comment The Linux kernel: breaking user space
@FaheemMitha "obvious" is in the eye of the beholder. If you have worked on a system (any system) for a long time, many things are obvious to you that would not necessarily be obvious to someone else. And almost everyone has their own ideas on how to do things and what makes sense. It's more of a human nature (and, sometimes, ego) thing than something specific to any particular endeavour.
Oct
3
comment Confine the directories in which a script will act
Like @JJoao says, a script like this is dangerous at best. It needs a lot of error testing and more complete paths to be remotely safe. And, I don't even want to think about what could happen if some of your directory/subdirectory names have spaces in them since the variables aren't quoted! I've never used it, but there is a chroot command that would help, but rewriting the script would be much better.
Sep
26
comment sudo script - best practice?
If you later use your script in a pipe or run it from a gui, then stdin/stdout probably won't be connected to your terminal/screen. That's why I often use kdesudo (gksudo) instead. Putting sudo outside the script doesn't fix this, but you find out if it's a problem sooner.
Sep
26
comment How can X11 shortkeys be captured by a Python program?
You might want to take a look at AutoKey. It's essentially a large Python program which does things like this and more. github.com/autokey/autokey
Sep
26
comment How does Linux know which USB hard drive is which?
UUIDs are great and work as noted in the answers. But, they are not human friendly. Whenever I create partitions (anywhere), I give them unique human readable labels that make sense to me. This is especially helpful when writing backup scripts dealing with several drives. You don't want to get a source and destination reversed by accident! Also, whenever you reformat a partition, it gets a new UUID and you have to edit anything that used that UUID, whereas you can still use the same label as before and not have to change anything.
Jun
24
comment How can I combine values from two columns?
Wow! That makes a lot more sense (and shows me a bunch of things I need to learn more about.) In particular, I had never noticed the use of // to reuse the current pattern. That's the kind of thing you read over and forget until you run into an actual example. Thanks a lot. It made me laugh to see how much power could be packed into a miniscule command and how much it took to explain it.
Jun
20
comment How can I combine values from two columns?
I believe it works, but I can't parse it. Overall, you're setting up an addition for dc. The first pattern makes sense. I think it matches the date and trailing blanks, but I don't get what putting that inside the character class brackets ([&]) does. It would be great if you would spell this one out.
Jun
20
comment Download a webpage by putting everything it needs in a dedicated directory?
Here's a guess as to what's going on. As you know, wget -p will download what is needed for the webpage to display offline - like its source code. References to external files are embedded in the webpage source. If they were downloaded in another directory structure, then all those references would have to be modified to reflect that. When a browser looks at a webpage, it renders it into a displayable whole - like compiled code. It has used the files and has the result. It is in a very different situation than wget is, so it may be able to save the result rather than the initial input.
Jun
13
comment manipulate multiple windows simultaneously
No answer, but I put in an informal feature request for something like this on a KDE list a long time ago (with no responses). I sometimes run multiple torrents using Transmission and it allows you to open a window following each one. I wanted to be able to minimize/move/close the whole lot of them at once with a window group. The main deal was that I wanted to be able to do things to them while keeping who was on top of who the same.
May
23
comment Prepare answers for questions of a command
+1 because I didn't know autoexpect existed and had figured that the expect learning curve was too steep for me to bother with. I'll take another look.
May
9
comment Why is my Bash script returning a syntax error?
Since it is generally recommended that the output of ls should not be used in scripts, I tried to figure out how to do this with find. I got as far as find . -maxdepth 1 -type f -printf '%c\t%f\n' -name '*', but the date is still hard to sort. It's not in epoch format yet. The tab is for use later with cut after sorting. AFAIK, the answer above (and all the others based on using ls) will potentially return directory names as well as file names - which might cause unexpected results with a command which expects to see a regular file.
May
8
comment Identify alias for the command typed
bash also has a read command which may be used to get input which is not subjected to any of it's many expansions. It may be possible to use that instead of an external program such as AutoKey, but it can get fairly tricky because using what you have read in can often expose part or all of it to expansions.
May
7
comment Identify alias for the command typed
That looks really interesting! However, man bash says ALIASES Aliases allow a string to be substituted for a word when it is used as the first word of a simple command. which means there can be other stuff after the alias on the command line. If I read your code correctly, it would fail to match an alias for a command line with anything after the alias. So, the approach is great, but it may need some additional code to make sure you're just matching the alias and not the whole line.