Getting Started with Linux Commands

If you have a VPS or dedicated server, then you may access the Terminal by going to Advanced > Terminal.

Here are some usuful commands.

Clear log


Count Files using wc

ls | wc -l

Delete Files Older Than x Days on Linux

First find the files. For example if you want to find all files that start with wp-load and are older then 5 days then run this command:

find 'firstletters'* -mtime +5

Then delete them

find 'firstletters'* -mtime +5 -exec rm -f {} \;

Get a file

When the cron job executes wget command (fetches URL resource), it creates a new file every time. It doesn’t overwrite the old downloaded file, but appends a number so by time, there will be thousands of files unless you tweak your crontab to suppress the output. So in order to suppress the output:

wget -q -O - "" >/dev/null 2>&1