Working with OSMC via the command line

OSMC is based on Debian which allows us to deliver a very powerful and expansive system. While OSMC can be fully managed and configured via a graphical interface, we have preserved access to the unfettered level of
configuration that a full Linux system promises, giving you complete access and control over your device. For newcomers, this can be quite daunting – however with some patience and guidance, you can pick up how to use the command line. If you have any suggestions or questions, let us know. Here are a few commands to get you started:

ls
This command is used to list files and folders in current directory. In
order to view hidden files and filepermissions us ls -al. You can also
list files and folders in a remote directory, ls /etc/apt

cd
Short for change directory, cd .kodi or if you like to jump multiple
directories in one command, cd .kodi/userdata. And to hop a directory
back use cd ..
You can directly jump to the current users home folder with cd ~

mkdir
This is how you make a new folder. mkdir newfoldername creates a new
folder in the folder you’re standing in. You can also create a remote folder
in the filesystem mkdir /home/osmc/newfoldername

cp
The first command listed here that need two arguments, cp is for file copying.
cp sourcefile destinationfile and as always you can copy with paths.
cp /home/osmc/mytextfile ./texts/ this will copy mytextfile into the
folder texts in current directory(./). To copy a folder, you need to add an option to the cp command, like this cp -r foldername foldercopyname.

mv
The command to rename and/or move files and folders, to rename a file use this
mv old-file-name new-file-name, and to move mv myfile.pdf ./pdfs/. This
will move the myfile.pdf to the pdfs folder located in your current folder. And to move
and rename at the same time mv myfile.pdf ./pdfs/mycharts.pdf

rm
To delete a file you use rm filename or to delete a folder rmdir foldername. Rmdir warns if there is files inside the folder or use the second more unforgiving rm -r foldername. Last alternativ deletes folder and all the containing files.

wget
Download a file from the web to your current folder.
wget https://github.com/zjoasan/x11-osmc/raw/master/install_x11.zip

df -h
Used to see how much used/freespace there is on connected media, including your SD-card.

top
This is an interactive process viewer, which you exit with q. If you want more information about top, pressh while it’s running.

nano
A simple text editor, nano filename opens the texteditor and lets you do the what you need to do. Use CTRL+x to exit. If there were any changes made you will be prompted if you want to save the file and a filename for the saving.

sudo
Sometimes you need higher priveliges then osmc user has, like when you need to edit a systemfile. For example adding a new source in /etc/apt/sources.list, this can not be done by osmc user, so you have to get root(system administrator) filerights. This is done via sudo like sudo nano /etc/apt/sources.list.

All these commands, except cd, have a some help information. To access this you
type this “command --help”.

Nice list, just one comment…

Maybe it would be wise to distinguish between rm filename to remove a file and rmdir foldername to remove a folder and a third option of rm -r foldername to remove a “non-empty” folder. Than way people may be less likely to delete things they didn’t want to? (rmdir will object if folder not empty).

You need to explain what ./ does before using it in an example

“cp
The first command listed here that need two arguments, cp is for file copying.
cp sourcefile destinationfile and as allways you can copy with paths.”

This is just a spelling issue, should read “always” not “allways”.