Welcome to The-Server-admin.com the place were administrators can get the needed skills for the server room.




Linux TAR Command

Using Tar to zip and unzip files.

I use tar all the time to help zip and archive data on the servers I run. Here are a few tricks I use. If there are any questions, see the forum at forum.the-server-admin.com.


To archive all txt files I use the following command:

tar cvzf archive.tgz *.txt

To extract the contents of a tar file use:

tar xvzf archive.tgz

If you have a tar.zip use:

 

tar xfv *.zip.tar

 

Rsync Recursively

Rsync Recursively

I had to show a buddy this so here it is so we all know it:

To copy a directory with Rsync Recursively use
rsync -avP /form /to

This will build a list and show you what it is doing and keep permissions. This is also good for a backup to a mirror location.

 

If there are any questions, see out forum at forum.the-server-admin.com

 

Linux Cron

Linux Cron

Cron jobs are task setup on a Linux or UNIX system to run at a set time. I seen a few questions around about cronjobs. Here is a reference on cron.

How do I visit a site every day at 5 AM?Run the command “crontab -e” to edit the cron file. Then type:

0 5 * * * curl http://www.the-server-admin.com

Curl is a basic Linux command. Cron will run any command in this order.

How do I get cron Emails? Edit he crontab file: crontab -e Then make cron look like:

MAILTO: This e-mail address is being protected from spambots. You need JavaScript enabled to view it.

0 5 * * * curl http://www.the-server-admin.com

You can also get disk space output via cron. Edit the crontab... you should know who to do this by now. :) Make cron look like this:

MAILTO: This e-mail address is being protected from spambots. You need JavaScript enabled to view it.

0 5 * * * curl http://www.the-server-admin.com

0 12 * * * df -h

So any command you want to run everyday add the command to crontab.

If there are any questions, see our forum at http://forum.the-server-admin.com