How to Manage Your Nextcloud Server via Command Line
The occ command, which stands for occurrences command, has been added to the Nextcloud server as of version 12. This command allows you to do some basic management of your server through the command line interface on Linux systems, and it’s a great way to get familiar with managing your Nextcloud installation from the terminal if you haven’t done so before. Read this article to learn how to use the occ command and do some basic management of your Nextcloud server from the command line.
Step 1) Activate Shell
The following instructions will help you use the occ command for Nextcloud. For example, if you want to install a specific app like Roundcube, type in the following: sudo apt-get install roundcubemail. If you want to update your server packages, type in the following: sudo apt-get update && sudo apt-get upgrade -y. To terminate a process that is running on your server, type in the following: killall processname. To find out what processes are running on your server, type in the following: ps aux grep processname.
Step 2) Connect with SSH Section: Step 3) Installing ncdu
ncdu is a disk usage analyzer for Unix-like systems, and it’s a great command-line tool for managing your server. It does not require X11 on the remote machine, as it utilizes curses and doesn’t use up CPU time. ncdu updates in realtime as you scroll through directories. In order to install ncdu, type:
sudo apt install -y ncdu
Step 4) Running ncdu
ncdu is a disk usage analyzer for Unix systems which displays disk usage in a tree format. It helps identify large files and folders, determined by the user-defined threshold.
- The following command can be used to check the current directory recursively:
- $ ncdu /path/to/current/directory
- To change the default settings, run ncdu with the -h flag. This will present you with a summary of all available options
Step 5) Listing the folders with lots of data
You can find your data in the following directories: – all files: /var/www-data/nextcloud/data – uploaded files: /var/www-data/nextcloud/data/**/* – remote storage files: /var/www-data/nextcloud.remote.storage/*
Step 6) Deleting unnecessary data from Nextcloud server
To delete data from your Nextcloud server you can use the occ command. This will allow you to delete data with a simple terminal command.
For example, if you want to delete all files in a directory called `test`, then enter `oc delete test`. If you wanted to delete only the file called `important.txt`, then enter `oc delete important.txt`.
Nextcloud is a server application that allows you to host your own cloud storage. You can easily install it on your web server, but if you have a Linux system, like Ubuntu, you can do the same thing with the occ command line tool. The basic commands are easy and intuitive: occ