A simple stop watch
Answer:
In Linux, you can use a simple command to count the time.
# time read [press Ctrl+D to stop]
real 0m0.967s
user 0m0.000s
sys 0m0.000s
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
A simple stop watch
Answer:
In Linux, you can use a simple command to count the time.
# time read [press Ctrl+D to stop]
real 0m0.967s
user 0m0.000s
sys 0m0.000s
Validate the syntax of PHP files in a directory
Answer:
To validate the syntax of PHP files in a directory, to check if any syntax error so we can fix them before they really happen at runtime.
You would need to have the GNU parallel installed in order to use the command below.
# find -type f -name '*.php' | parallel php -l
Extract tarball from Internet with saving first
Answer:
You can extract a tarball from Internet with saving first, just use the command below:
# wget -qO - 'http://curl.haxx.se/download/curl-7.21.2.tar.gz' | tar zxvf -
Executing jobs in parallel using GNU parallel
Answer:
GNU parallel is a tool for executing jobs in parallel. It is not part of standard Linux distribution yet, so it is so worth to install it.
You can download the latest version from: http://ftp.gnu.org/gnu/parallel/
E.g.
# wget http://ftp.gnu.org/gnu/parallel/parallel-20101202.tar.bz2
# tar -jxvf parallel-20101202.tar.bz2
# cd parallel-20101202
# ./configure
# make && sudo make install
Example usages:
# echo -e "a\nb\nc" | parallel echo "foo"
foo a
foo b
foo c
Monitor a directory for file modification
Answer:
You have a directory to monitor, you want to know which files inside is currently changing.
Try the following magic command:
# watch -d -n 2 'df; ls -FlAt;'
When a file is changed, it will be highlighted.