Shutdown Linux X minutes later
Answer:
To schedule Linux shutdown in X minutes later, use the following command
E.g. shutdown in 10 minutes
# sudo shutdown -h 10
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Shutdown Linux X minutes later
Answer:
To schedule Linux shutdown in X minutes later, use the following command
E.g. shutdown in 10 minutes
# sudo shutdown -h 10
List files in a tar file
Answer:
To list all files inside a tar file, use the following command
# tar tf test.tar
Insert search string back to the result in sed
Answer:
Following command will replace "foo" by "bar", using the sed.
# echo "foo" | sed 's/foo/bar/'
But how to append the word "foo" at the end of "bar"?
Here is the solution with the & (& defines the pattern found in the search string)
# echo "foo" | sed 's/foo/bar&/'
Rescheduling mlocate to run weekly instead of daily
Answer:
As explained before, mlocate is a useful tool for quickly find files on the filesystem based on their name.
When you installed the mlocate, it created a daily cron job under /etc/cron.daily/ which build the database daily. However, it is quite IO intensive when you build the database, and it is not recommended to run the indexing in a production server in such high frequency...it is better to run it weekly or monthly.
E.g. To reschedule the the cron job to run weekly
# mv /etc/cron.daily/mlocate /etc/cron.weekly/
Set the hardware clock to the same time as the system clock
Answer:
You can change the hardware clock to the same time as your system clock using the following command.
# sudo hwclock --systohc