As per title I want to check output of the equivalent command but on a Solaris 11 box.
Is there a similar command?
In Solaris 11 you have standard ntp daemon so you can use command:
ntpq -p
to get the list of peers. And with this command you can see also some local time sync parameters:
root#sol1:/etc/inet# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+time.cloudflare 10.74.8.178 3 u 15 64 3 9.287 -241.90 210.255
*mail.eban-meban 147.125.80.35 3 u 36 64 1 4.415 -192.07 16.270
-purple.bonev.co 151.237.71.222 2 u 14 64 3 5.197 -242.41 219.576
+ntp.netguard.bg 20.39.126.15 2 u 47 64 3 4.570 -162.62 147.576
Related
I'm running example programs (hello-world & pi) with mvapich2 2.2.
After computing I see info that looks like debug (in error thread).
output thread
Process 2 of 5 is on 37eff7e817ee
Process 0 of 5 is on cb1479885879
Process 4 of 5 is on 6511b189f06b
Process 1 of 5 is on 6511b189f06b
Process 3 of 5 is on cb1479885879
pi is approximately 3.1415926544231230, Error is 0.0000000008333298
wall clock time = 0.051757
errors thread
[2] 40 at [0x0000000001d8dd28], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[2] 136 at [0x0000000001d8dbf8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[4] 40 at [0x0000000000df3868], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[4] 136 at [0x0000000000df3738], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[3] 40 at [0x0000000001bf32c8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[3] 136 at [0x0000000001bf3198], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[0] 40 at [0x00000000012ebda8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[0] 136 at [0x00000000013029b8], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
[1] 40 at [0x0000000001514788], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1123]
[1] 136 at [0x0000000001514658], pid/ch3/channels/mrail/src/gen2/rdma_iba_priv.c[1110]
Environment:
CentOS 7;
Mellanox MT25204;
mvapich2-2.2 (installed from yum).
screenshot
How can I disable it?
These prints are caused by memory leaks inside the MPI library or the application itself. It also shows that you are using a debug build of MVAPICH2. If you built MVAPICH2 yourself, remove the options --enable-g=all --enable-fast=none --disable-fast from configure. This will also improve your performance.
How to calculate X power Y in the unix shell script where value of Y is being supplied by a loop eg. Y=1 to 5. It means I would like to calculte (X^Y)
In bash you could do:
$ for i in {1..5}; do printf "$((2 ** $i))\n"; doneprintf "$((2 ** $i))\n"; done
2
4
8
16
32
Many shells however do not support raise to power operation and in
such situations you need to use bc:
$ for i in $(seq 5); do printf "%s\n" "$(echo "2 ^ $i" | bc)"; done
2
4
8
16
32
There are 3 files in a directory. How can i print first file 1st line, Second file 3rd line and Third file 4th line using UNIX command ?
I tried with cat filename.txt| sed -n 1p but it is applicable for only one file. How can I view all the three files at a time ??
Using awk. at the beginning of each file f is increased to follow which file we're dealing with then we just team that up with the required record number of each file (FNR):
$ awk 'FNR==1 {f++} f==1&&FNR==1 || f==2&&FNR==3 || f==3&&FNR==4' 1 2 3
11
23
34
Record of the first file, the others are similar:
$ cat 1
11
12
13
14
I've used the comm command to compare two files, but I'm unable to pipe it to a third file:
comm file1 file2 > file3
comm: file 1 is not in sorted order
comm: file 2 is not in sorted order
How do I do this? The files are sorted already.
(comm file1 file2 works and prints it out)
sample input:
file1:
21
24
31
36
40
87
105
134
...
file2:
10
21
31
36
40
40
87
103
...
comm file1 file2: works
comm file1 file2 > file3
comm: file 1 is not in sorted order
comm: file 2 is not in sorted order
You've sorted numerically; comm works on lexically sorted files.
For instance, in file2, the line 103 is dramatically out of order with the lines 21..87. Your files must be 'plain sort sorted'.
If you've got bash (4.x), you can use process substitution:
comm <(sort file1) <(sort file2)
This runs the two commands and ensures that the comm process gets to read their standard output as if they were files.
Failing that:
(
sort -o file1 file1 &
sort -o file2 file2 &
wait
comm file1 file2
)
This uses parallelism to get the file sorted at the same time. The sub-shell (in ( ... )) ensures that you don't end up waiting for other background processes to finish.
Your sample data is NOT sorted lexicographically (like in a dictionary), which is what commands like comm and sort (without the -n option) expect, where for example 100 should be before 20.
Are you sure that you aren't simply not noticing the error message when you don't redirect the output, since the error would be intermixed with the output lines on the terminal?
You have to sort the files first with the sort program.
Try :
sort -o file1 file1
sort -o file2 file2
comm file1 file2 > file3
I don't get the same results as you, but perhaps your version of comm is complaining that the files are not sorted lexically. Using the input you provided (the ... makes it interesting, I know it's not a part of your actual files.)
$ comm file[12]
10
21
24
31
36
40
40
87
103
...
105
134
...
I was surprised that ... wasn't in the third column, so I tried:
$ comm <(sort file1) <(sort file2)
...
10
103
105
134
21
24
31
36
40
40
87
That's better, but 105 > 24, right?
$ comm <(sort -n file1) <(sort -n file2)
...
10
21
24
31
36
40
40
87
103
105
134
I think those were the results you are looking for. The two 40s are also interesting. If you want to eliminate these:
$ comm <(sort -nu file1) <(sort -nu file2)
...
10
21
24
31
36
40
87
103
105
134
I ran into a similar issue, where comm was complaining even though I had run sort. The problem was that I was running Cygwin, and sort pointed to some MSDOS version (I guess). By using the specific path (C:\Cygwin\bin\sort in my case), it worked.
I had a similar issue when I had sorted files but was getting the same error with
comm -23 16-unique.log 23-unique.log > 16-only.log
but I figured the redirection wasn't working properly so I tried
(comm -23 16-unique.log 23-unique.log ) > 16-only.log
but using sort to ensure the inputs where sorted was the business.
comm -23 <(sort 16-unique.log) <( sort 23-unique.log) > 16-only.log
[As an side the -23 switch means that only the unique rows in the first file will be in the output] also man comm
Using the command:
wc -l + `find . -name \* -print`
You can get the total number of lines of all files inside a folder.
But imagine you have some folders (for example libraries), which you don't want to count their lines because you didn't write them.
So, how would you count the lines in a project excluding certain folders?
cloc has always been a great friend whenever I need to count lines of src-code. Using 2.6.29 linux kernel as an example:
$ cloc .
26667 text files.
26357 unique files.
2782 files ignored.
http://cloc.sourceforge.net v 1.50 T=168.0 s (140.9 files/s, 58995.0 lines/s)
--------------------------------------------------------------------------------
Language files blank comment code
--------------------------------------------------------------------------------
C 11435 1072207 1141803 5487594
C/C++ Header 10033 232559 368953 1256555
Assembly 1021 35605 41375 223098
make 1087 4802 5388 16542
Perl 25 1431 1648 7444
yacc 5 447 318 2962
Bourne Shell 50 464 1232 2922
C++ 1 205 58 1496
lex 5 222 246 1399
HTML 2 58 0 378
NAnt scripts 1 85 0 299
Python 3 62 77 277
Bourne Again Shell 4 55 22 265
Lisp 1 63 0 218
ASP 1 33 0 136
awk 2 14 7 98
sed 1 0 3 29
XSLT 1 0 1 7
--------------------------------------------------------------------------------
SUM: 23678 1348312 1561131 7001719
--------------------------------------------------------------------------------
With find, you can also "negate" matching conditions with !. For example, if I want to list all the .java files in a directory, excluding those containing Test:
find . -name "*.java" ! -name "*Test*"
Hope this helps!
Edit:
By the way, the -name predicate only filters file names. If you want to filter paths (so you can filter directories), use -path:
find . -path "*.java" ! -path "*Test*"
you could always exclude them by listing out the files using regular expressions,
for example,
*.txt will include only txt files and so on...
I made an NPM package specifically for this usage, which allows you to call a CLI tool and providing the directory path and the folders/files to ignore
it goes like:
npm i -g #quasimodo147/countlines
to get the $ countlines command in your terminal
then you can do
countlines . node_modules build dist