How to get file name only with find command?
Answer:
To show only the filename of Linux command, you can use
# find /dir -type f -printf "%f\n"
file1
file2
file3
...
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to get file name only with find command?
Answer:
To show only the filename of Linux command, you can use
# find /dir -type f -printf "%f\n"
file1
file2
file3
...
Parallel the execution of a job that read from stdin
Answer:
Assume you have a huge list of file, e.g.
line1 line2 line3 ..
You want to "feed every line" of this file to an external program that read from stdin, to parallel it, you can use the gnu parallel, e.g.
cat input.txt | parallel -j16 -N1 --pipe myprogram
How to view the keepalived multicast traffic used for master negotiation
Answer:
keepalived will advertise their priority frequently in order to provide the fail over capabilities, to view the messages exchanged by keepalived instances, try
# tcpdump -s0 -v -pni eth0 host 224.0.0.18
How to check how many established connection of my web server?
Answer:
Assume you server is listening on port 80, you can check how many established connection to this port with the following command:
netstat -an | grep :80 | grep ESTABLISHED | wc -l
4919
How to trace DNS from the root servers
Answer:
Use the command `dig`, e.g.
dig +trace mit.edu
;; global options: +cmd
. 19927 IN NS d.root-servers.net.
. 19927 IN NS e.root-servers.net.
. 19927 IN NS m.root-servers.net.
. 19927 IN NS l.root-servers.net.
. 19927 IN NS a.root-servers.net.
. 19927 IN NS k.root-servers.net.
. 19927 IN NS f.root-servers.net.
. 19927 IN NS j.root-servers.net.
. 19927 IN NS b.root-servers.net.
. 19927 IN NS h.root-servers.net.
. 19927 IN NS g.root-servers.net.
. 19927 IN NS i.root-servers.net.
. 19927 IN NS c.root-servers.net.
;; Received 228 bytes from 8.8.8.8#53(8.8.8.8) in 12 ms
edu. 172800 IN NS a.edu-servers.net.
edu. 172800 IN NS c.edu-servers.net.
edu. 172800 IN NS d.edu-servers.net.
edu. 172800 IN NS f.edu-servers.net.
edu. 172800 IN NS g.edu-servers.net.
edu. 172800 IN NS l.edu-servers.net.
;; Received 260 bytes from 199.7.83.42#53(199.7.83.42) in 223 ms
mit.edu. 172800 IN NS usw2.akam.net.
mit.edu. 172800 IN NS asia1.akam.net.
mit.edu. 172800 IN NS asia2.akam.net.
mit.edu. 172800 IN NS use2.akam.net.
mit.edu. 172800 IN NS ns1-37.akam.net.
mit.edu. 172800 IN NS ns1-173.akam.net.
mit.edu. 172800 IN NS eur5.akam.net.
mit.edu. 172800 IN NS use5.akam.net.
;; Received 404 bytes from 192.31.80.30#53(192.31.80.30) in 548 ms
mit.edu. 20 IN A 23.46.134.151
;; Received 41 bytes from 63.150.131.81#53(63.150.131.81) in 4 ms