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
...
Replace newline by comma
Answer:
To replace all newline in a file by command, you can use the command
# tr '\n' ',' < input.txt > output.txt
How to assign a raw string in Python
Answer:
In Python, if you want to assign a raw string without any character escape, you can use the following:
s = r'\\foo\\\bar'
print s
How to check the SSL cert expiration date using command?
Answer:
To check the SSL cert expiration date of a domain, you can use the following command:
# echo | openssl s_client -connect www.google.com:443 2>/dev/null | openssl x509 -noout -dates
notBefore=Dec 11 12:02:58 2013 GMT
notAfter=Apr 10 00:00:00 2014 GMT
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