Reputation
115,833
Next tag badge:
97/100 score
36/20 answers
Badges
18 146 291
Newest
 Enlightened
Impact
~4.4m people reached

3h
comment How to find out the number of network interfaces available in a linux system?
Linux doesn't allow creating network interfaces with newline in their name, but it allows network interfaces whose name starts with ., so you'd need ls -A here.
12h
comment How to print control characters with escape sequences?
Is it just the ESC (0x1b) character you want to convert to \E, or other control characters?
13h
comment list processes belonging to a network namespace
@vyom, note that I was note suggesting to upgrade to 14.04, just to install the linux-image-generic-lts-trusty 12.04 package to get a supported kernel in your 12.04. You'd get that kernel automatically if you installed 12.04.5 now.
1d
comment sort in unix on a big file
sort -k1,1 -k2,2n -k3,3n
1d
comment How to sort/reformat text information in a file?
@G-Man, indeed, that's a bit cheeky. awk is a poor choice here as an answer let alone a tag for the question, I don't understand why that was approved. The whole Q&A is poorly worded and unlikely to be useful to anyone anyway, no need to lose sleep over it.
1d
comment list processes belonging to a network namespace
@vyom. Note that that 3.5 kernel has been out of support since April 2014. You'd probably want to upgrade to the 3.13 (linux-image-generic-lts-trusty) or downgrade to 3.2.
1d
comment list processes belonging to a network namespace
@vyom, yes. See the alternative I gave for older kernels. That would probably mean you'd need to compile a newer version of util-linux as I don't think 12.04's ones will include nsenter. Namespaces were still quite experimental when 12.04 came out.
1d
comment To count number of matches in a mega string quickly
@Masi, timing will be affected by the system's caching. If the data is not in cache, then the bottleneck will be disk I/O, not grep.
1d
comment To count number of matches in a mega string quickly
@mikeserv, they diverged slightly after they were rewritten from scratch (different options and option handling (for instance wrt -r IIRC). BSDs grep are now backward compatible to the old version of GNU grep they were originally based on, but no longer to recent versions of GNU grep or even between each other (IIRC Apple's one diverged from FreeBSD for instance).
2d
comment To count number of matches in a mega string quickly
How about LC_ALL=C grep -ao CDA | wc -l?
2d
comment list processes belonging to a network namespace
@vyom, you must have a 3.2 kernel. I confirm it doesn't work there.
2d
comment list processes belonging to a network namespace
The error about /proc/self is to be expected when using sudo or a shell that doesn't expand globs in the process they're executing the command in. I've edited the answer to avoid it (but that wouldn't prevent listing the pids)
2d
comment list processes belonging to a network namespace
@vyom, does grep /run/netns /proc/self/mountinfo report anything? What kernel version are you using (uname -rs)?
2d
comment list processes belonging to a network namespace
@vyom, yes from the top level pid and mount namespace (though I suppose you could create netns'es in other mount namespaces which would void that command).
2d
comment What's the 'right' format for the HTTP_PROXY environment variable? Caps or no caps?
@Gilles, lynx uses CERN's libwww where that feature probably comes from (seems to be appearing in 2.15). It's not impossible that the lynx developers contributed that feature back though.
Jun
29
comment Add a newline into a filename with `mv`
@ and , would be more harmless than - (like in first position) or %. All those recomendations are mainly to work around bugs in some applications (that break on filenames that are otherwise valid from the OS point of view). It feels backward to ask people to not use those characters rather than fixing their bugs.
Jun
29
comment Bash: increment a variable in a while loop?
Related: Why is using a shell loop to process text considered bad practice?
Jun
29
comment How to get last N commands from history?
That seems to be for tcsh, yash and bash. You may want to give the corresponding information for other shells like zsh, fish, ksh, and the POSIX way.
Jun
29
comment find | xargs shasum creates checksum of checksum file itself (prematurely) and fails when checking
Also note that it means running one shasum command per file which would be less efficient than a find -exec ... {} + approach.
Jun
29
comment find | xargs shasum creates checksum of checksum file itself (prematurely) and fails when checking
Note that bash before 4.3 did follow symlinks when descending directories (a la find -L).