20,097 reputation
34476
bio website
location United States
age
visits member for 3 years, 3 months
seen 6 hours ago

Debian user, GNU/Linux enthusiast, FLOSS supporter, hobby developer.


Jun
28
revised How to remember the difference between du and df?
Wikipedia is a decent source for Unix history. Abbreviations / command names fall under history.
Jun
27
comment Switch Fn key state
@Gilles Most laptops come with extra functions on the F1-F12 keys for actions like suspend, toggle wireless/touchpad, multimedia/volume control keys, that are accessed by holding down Fn. I've seen many laptops that have a BIOS option to choose whether the physical key registers as F1-F12 or the extra function, since a lot of end users don't use the F1-F12 keys. Thinkpad Edge's even do this by default (you need Fn-F1 to get F1). What I meant was if this is the case, finding the BIOS option would be much easier than trying to remap each F1-F12 key individually.
Jun
27
answered Find -exec + vs find | xargs. Which one to choose?
Jun
27
comment Find -exec + vs find | xargs. Which one to choose?
You meant -P instead of -p. Keep in mind xargs -P is not in the POSIX standard, whereas find -exec {} + is, which is important if you are going for portability.
Jun
27
revised Find -exec + vs find | xargs. Which one to choose?
edited body
Jun
26
comment Switch Fn key state
Check your BIOS for a setting to toggle the Fn key behavior.
Jun
25
revised How can I cd to the previous/next sibling directory?
Use a more sensible glob to only match directories.
Jun
24
comment find n most frequent words in a file
@lukas Useless use of cat wastes a process and buys you absolutely nothing that shell redirection doesn't already do, in this case.
Jun
22
comment Is learning a text editor like vi necessary and still worth the time today?
<joke>Make sure you learn /bin/ed for the next time you need to rescue your fstab and /usr/bin won't mount because it's on a separate partition</joke>. Also, few graphical IDE's come close to offering the feature set of vim or emacs, and I can usually go off for a coffee break while waiting for the fancy IDE's to start.
Jun
22
revised Suppress output unless non-zero exit code
use a sub-shell for safety, and use less verbose syntax
Jun
22
comment Suppress output unless non-zero exit code
This should be the default behavior of most commands (no output on success). If not, the first thing to do is to look for an option / switch to enable such behavior. Failing that, your approach is the right idea. Side note: I'm assuming you posted pseudo-code because it is not actually valid sh syntax, and your redirection order is backwards (do > "$file" 2>&1 and use more quotes).
Jun
22
revised What is the difference between ~/.profile, ~/.bashrc, ~/.bash_profile, ~/.gnomerc, /etc/bash_bashrc, /etc/screenrc …?
added 331 characters in body
Jun
22
comment What is the most correct way to pass an array to a function?
I'm not familiar with ksh88, but if you need to pass the entire array by value, have you tried func "${array[@]}"? If you only need to pass one element, just pass the element - no need to make it more convoluted by passing an array and an index.
Jun
21
comment How can I cd to the previous/next sibling directory?
@Esteis Thanks for the edit.
Jun
20
revised How can I cd to the previous/next sibling directory?
added 222 characters in body
Jun
20
answered How can I cd to the previous/next sibling directory?
Jun
20
comment Why does `cat`ing a file into itself erase it?
Please don't recommend sed -i. It's not portable and probably doesn't even work correctly on links. Non-portable alternatives include cmd file | sponge file. Portable alternatives include ed (ed is a file editor; sed is a stream editor, not a file editor), which has more or less the same commands as sed, or a temporary file.
Jun
20
comment Why does `cat`ing a file into itself erase it?
@rahmu POSIX does specify the order but it doesn't need to because if you think about it for just a moment, you'll realize that the shell is the one that does the redirections and it has to do them before running the command, since it will be too late to do it after the command has already started. Add that bit of common sense to the fact that the > operator includes truncation and this behavior becomes very logical.
Jun
19
comment Remove directory in ftp
What OS? You are claiming you get a rmdir message by running rm. What travesty has been inflicted on your rm? Try type rm.
Jun
19
comment Mapping between logical and physical block device names
Everything in the /dev/mapper directory is typically a symlink to the actual device.