Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 117516

These questions are about Linux in general -- NOT specific to a particular distribution. If the question just happens to be in a Linux environment, please specify your Linux distribution in the body of your question, but do NOT use the /linux tag.

1
vote
There are a number of things you can do to log command times, the easiest being accounting (cf. man accton), but all of them have to be turned on explicitly. If you didn't turn on accounting first th …
answered Oct 17 '17 by Satō Katsura
1
vote
Since you tagged this as linux I'll assume GNU utilities. Copy directory structure from $src to $dest: find "$src" -type d -print0 | cpio -padmv0 "$dest" Also copy a random sample of $nfile files …
answered May 31 '17 by Satō Katsura
31
votes
, you probably don't need to bother with redirections. Edit: Some quick (and completely broken) benchmarks: In a Linux console, 240x75: $ time (for i in {1..100000}; do echo $i …
answered Oct 12 '17 by Satō Katsura
3
votes
Here's a quick checklist: use TABs to indent action lines (rm, tar, g++ etc.) use $(FOO) to expand variable FOO instead of ${FOO} or $FOO add dependencies where relevant. Your Makefile should look …
answered Nov 10 '17 by Satō Katsura
7
votes
ttyS0 is the device for the first UART serial port on x86 and x86_64 architectures. If you have a PC motherboard with serial ports you'd be using a ttySn to attach a modem or a serial console. ttyUS …
answered Sep 2 '16 by Satō Katsura
2
votes
Since you tagged the question as Linux, you can use flock to put a lock on a well-known file: flock "${TMPDIR:-/tmp}"/some_name.lock /path/to/your_command -options A second instance of the command …
answered Nov 4 '17 by Satō Katsura
3
votes
One way to do it: #! /bin/sh n=$1 m=$2 # Reference: http://math.stackexchange.com/q/48080 sum=$(( (m * (m + 1) * (2 * m + 1) - (n - 1) * n * (2 * n - 1)) / 6 )) echo $sum Result: ./sum 3 7 135
answered Sep 15 '16 by Satō Katsura
3
votes
On Linux: printf -- '-get data_%d.txt\n' $(seq 1 3 100) | sftp -b - user@example.com On BSD (with no seq(1) in sight): printf -- '-get data_%d.txt\n' $(jot 100 1 100 3) | sftp -b - user@example.com …
answered Sep 8 '16 by Satō Katsura
2
votes
One way to do it: awk -F \| -v OFS=, '{ NF--; for(i = NF-2; i <= NF; i++) $i = sprintf("%07.2f", $i) } 1' filename
answered Dec 20 '16 by Satō Katsura
4
votes
With GNU find: find /some/path -type f -name '.*' -execdir sh -c 'mv -i "$0" "./${0#./.}"' {} \; With Perl rename: find /some/path -type f -name '.*' -exec prename -i -n 's!.*/\K\.!!' {} + (remo …
answered Oct 2 '17 by Satō Katsura
1
vote
Get your monitor's EDID and save it to a file. You can do that from Linux, with read-edid. Then go to Windows and get the parameters for the working mode. I no longer remember the details (I had … is important. If I recall correctly you want your preferred mode first. When you have the cooked EDID file copy it to Linux, and point xorg to it. Back when I did that I had to add an option like …
answered Sep 10 '16 by Satō Katsura
2
votes
With perl: perl -MJSON -F: -ple '@A = qw/randomId id userId dns status/; $_ = encode_json({map { shift @A => { "s" => $_ } } @F } )' input.csv
answered Mar 24 '17 by Satō Katsura
2
votes
If you absolutely must do it with sed: to add the line at the beginning of file: sed -i -e '1i\' -e 'HAVE_OPENBLAS = \\usr' ./settings.mk to add the line at the end of file: sed -i -e '$a\' -e 'H …
answered Nov 7 '17 by Satō Katsura
3
votes
With awk: awk '{ if(NF>4) for(i=5; i<=NF; i+=4) $i = "\n" $i } 1' file With sed: sed 's/ /\n/4;T;P;D' file With perl: perl -lpe '$c = 0; s/ /++$c % 4 ? " " : "\n"/goe' file Output: 1 2 4 5 6 …
answered May 25 '17 by Satō Katsura
0
votes
You're asking phpMyAdmin to connect by TCP but your database is listening to an UNIX socket. Remove the connect_type line and set host to localhost: $cfg['Servers'][$i]['host'] = 'localhost';
answered Oct 30 '17 by Satō Katsura

15 30 50 per page