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.

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
8
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
7
votes
You need to quote del-non-*-locales.sh*. The first run works because you don't have any file in the current directory matching del-non-*-locales.sh*, so by default the pattern expands to itself (with …
answered Nov 9 '17 by Satō Katsura
7
votes
It's possible if the target system uses shadow passwords, and /etc/shadow is not overridden by other mechanisms (via PAM, nss, etc.), and the target system doesn't hash /etc/shadow, and the target s …
answered Oct 30 '17 by Satō Katsura
5
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
5
votes
Since you tagged this linux I'll assume you have GNU find and GNU tar. If your filenames don't have embedded newlines and you don't want to archive empty directories: find "$3" -type f \! -empty …
answered May 31 '17 by Satō Katsura
3
votes
With bash: str1=$(echo -ne "\x01\x02" | base64) str2=$(echo -ne "\x03\x04" | base64) if [[ $str1 =~ =$ ]; then concat=$( { base64 -d <<<"$str1"; base64 -d <<<"$str2"; } | base64 ) else concat …
answered Jun 8 '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
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
3
votes
With Perl rename: prename -n 's!t10n(\d+)/data/file.dat\K(\d+)!$1*5+$2!e' t10n*/data/file.dat* Remove -n when you're happy with the result.
answered Oct 5 '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
3
votes
for setting preferred applications for opening files based on their MIME types. On Linux it's used by all major desktop environments. The latter is available only on certain Linux distributions, and …
answered Jun 9 '17 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
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

15 30 50 per page