How to get free space on server?

If you want to get info about free space on server, or in particular directory, execute next code in your browser – it will give you info about free space on server’s directory defined in variable $dir: $dir = ‘/var/www/htdocs/’; $space = round(disk_free_space($dir) / 1024 / 1024 / 1024); echo (“Free space: ” . $space…

Find recently changed files

How to search for recently changed files, ie. in last 24 hours Files changed in last 24 hours: find . -mtime -1 -print To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories: find /directory_path -mtime -1 -print To find all files with regular…

How to sync two Linux directories?

You can sync two directories using command rsync. Practical example is to run next command: rsync -avz –delete /sourceDirectory /destinationDirectory This will sync /destinationDirectory with content of /sourceDirectory, with additional: a for archive more (more to follow about this), v for verbose, and z for zip compression. Option –delete means that rsync delete option deletes…