Useful commands
Now that you know how to access OpenELEC's XBMC through SSH, here are some useful commands. These commands can be copied inside the terminal, only you have to right click and paste them instead of Ctrl+V (which will not work).
The most important command while OpenELEC is developing is how to restart XBMC without a reboot. To restart XBMC, simply type
---------------------
systemctl restart kodi
To see what files and maps there are in the current directory, you can give the following command:
--------------------
ls -all
This will display all files and maps, just like you see them in any operating system, but than without the fancy GUI (displaying pictures of the files)
If you want to go into a map (the purple names), type:
----------------------
cd <map name>
for example, to go into the videos map, type: cd videos You can also directly go to a specific map from the root, if you know the exact map names. Ex.: If you want to go to the map movies inside the map videos, just type the following command:
----------------------
cd videos/movies
where the "/" marks the beginning of the name of that specific map inside the first map. This you can do unlimited, as long as the maps exists. Between every map you place a "/"
To go back one step, for example from /videos/movies to /videos/ use the following command:
---------------------
cd ..
To go back to the root (where you started when you logged in), use the command
---------------------
cd
To view a file (white colored) in the terminal (don't try this with video-, audio- and music files, as it will load an enormous amount of characters) type the following command:
-------------------
cat <file name>
To edit a file in a specific map that you have loaded, you can use the following command:
-----------------
nano <file name>
This opens the file and let you edit the lines you want to. It is very basic. To go to a specific line, use the arrows on your keyboard. When done editing and you want to safe the file, press Ctrl+X and type "y", after that it will ask you which name the file must have and after putting in the right name press Enter. If you accidentally edited the file, you can say "N" to the question if you want to safe the file and all changes will be discarded.
To make a new (empty) file in a current directory, use the following command:
--------------
touch <file name>
Note that most files need an extension for the system to know what it is. For example a configuration file needs the extension ".conf" (like file.conf).
To make a new directory, you can use the following command to make a new (sub)directory in the current directory:
---------------
mkdir <map name>
If you are in the root directory, and want to make a specific sub-directory in a map, the following command is needed:
----------------
mdir /<existing map>/<new to make map name
Also here you can add as much existing map names as you want, by separating them with a "/"
Removing a directory is the same as making a directory, but instead of "mkdir" you use "rmdir" in the above commands.
If a directory contains lot's of unwanted data, and you'll want to delete the whole directory, you may choose to use the following command. It forces a removal of a directory or file. Please use this only when you're very sure. The following command is based on a current directory that contains the file or directory that will be removed. If you want to use this command from the root directory, just add all the map names to the file or directory (ex. /<directory1>/<directory2>/ etc.) before the <directory or file name> without a space.
-------------------------
rm -rf <directory or file name>
To remove a separate file, use the following command:
-------------------------
rm <file name>
To copy a file to a specific place on the same computer, use the following command: This command will copy <file name> in the current directory to <directory2>, which is in <directory1>, which is in the root directory. The "~" in this command tells SSH to go first to the root directory, from there you have given the navigation to the file.
-----------------------
cp <file name> ~/<directory1>/<directory2>/
If you want to copy a file to a directory that is within the same directory as the goal directory (ex. you want to copy from /videos/ to /videos/drama/foreign/), you can also use the above code without the "~". Please note that <directory1> will now be the map /drama/ and <directory2> will be /foreign/, because we don't go back to the root directory.
The above code can also be used for moving a file, just replace "cp" in "mv".
If you want to display your current TCP/IP configuration (such as you IP address, used network device, etc.) (just like ipconfig on Windows), type the following command:
----------------------------
ifconfig
Advanced usage
Now we're going to show you some more advanced commands, most of them you only need when you're facing some problems and want to find out what it causes.
Displaying CPU and memory usage by the system can be done with the following command:
-----------------------------
top
You'll get the following screen:
To sort the list by memory usage, use the following key combination: Shift+m
To sort the list by CPU usage, use the following key combination: Shift+p
To exit this screen, use the following key combination: Shift+q
I know most of you will not know what everything in this screen will tell, but most of you know when you have a very high percentage CPU or memory usage, that that particular process is not working well. So when you report a bug or ask for help, you'll have detailed info which you can give for a solution!
To print a whole list of active processes, can be displayed with the following command:
----------------------------
ps -ef
Add "|more" after "-ef", the list will pause when the terminal window is full. Press any key to resume (if the list is too long, it will pause again when the terminal window is full)
Add "|grep <name>" after "-ef" to filter the list. This will show only the processes containing the word <name>
Add "|grep -v <name>" after "-ef" to filter the list. This will show only the processes that not contain the word <name>
A list of Kernel messages can be displayed with the following command:
------------------------
dmesg
To safe this Kernel messages to a file, use the following command:
------------------------
dmesg >>dmesg.txt
This file will be saved in the current directory, it can be wise to go to a specific directory (that is for example accessible by SAMBA) to safe this file.
To view common log-files of the system, use the following command to enter the directory that's containing them:
-------------------------
cd /var/log
For a live-view of an existing log-file (new added data will be shown directly and automatically scroll down), type:
------------------------
tail -f <log-file>
Notice that the above command will only work in the current directory of the log-file. To use this command from root, give also the containing directories as described before. To exit the live view, use the following combination "Ctrl+c"
We've implemented an automatic way of uploading troubleshooting logs to the pastebin website. This can be achieved in the following way.
Example 1. we ask you you to upload the message file:
------------------------
paste /var/log/messages
Above command will return with an URL to the pastebin website and your message file can be seen there.
Example 2. We ask for the dmesg output :
----------------------
dmesg |paste
Above will not show anything in your console, but will rather paste the output of your dmesg to the pastebin site. Again it will return with a URL which can be shared with developpers or in the forum for others to troubleshoot issues.
Warning! these commands will terminate your connection and turn of / reboot your system
----------------------
poweroff
reboot
Now that you know how to access OpenELEC's XBMC through SSH, here are some useful commands. These commands can be copied inside the terminal, only you have to right click and paste them instead of Ctrl+V (which will not work).
The most important command while OpenELEC is developing is how to restart XBMC without a reboot. To restart XBMC, simply type
---------------------
systemctl restart kodi
To see what files and maps there are in the current directory, you can give the following command:
--------------------
ls -all
This will display all files and maps, just like you see them in any operating system, but than without the fancy GUI (displaying pictures of the files)
If you want to go into a map (the purple names), type:
----------------------
cd <map name>
for example, to go into the videos map, type: cd videos You can also directly go to a specific map from the root, if you know the exact map names. Ex.: If you want to go to the map movies inside the map videos, just type the following command:
----------------------
cd videos/movies
where the "/" marks the beginning of the name of that specific map inside the first map. This you can do unlimited, as long as the maps exists. Between every map you place a "/"
To go back one step, for example from /videos/movies to /videos/ use the following command:
---------------------
cd ..
To go back to the root (where you started when you logged in), use the command
---------------------
cd
To view a file (white colored) in the terminal (don't try this with video-, audio- and music files, as it will load an enormous amount of characters) type the following command:
-------------------
cat <file name>
To edit a file in a specific map that you have loaded, you can use the following command:
-----------------
nano <file name>
This opens the file and let you edit the lines you want to. It is very basic. To go to a specific line, use the arrows on your keyboard. When done editing and you want to safe the file, press Ctrl+X and type "y", after that it will ask you which name the file must have and after putting in the right name press Enter. If you accidentally edited the file, you can say "N" to the question if you want to safe the file and all changes will be discarded.
To make a new (empty) file in a current directory, use the following command:
--------------
touch <file name>
Note that most files need an extension for the system to know what it is. For example a configuration file needs the extension ".conf" (like file.conf).
To make a new directory, you can use the following command to make a new (sub)directory in the current directory:
---------------
mkdir <map name>
If you are in the root directory, and want to make a specific sub-directory in a map, the following command is needed:
----------------
mdir /<existing map>/<new to make map name
Also here you can add as much existing map names as you want, by separating them with a "/"
Removing a directory is the same as making a directory, but instead of "mkdir" you use "rmdir" in the above commands.
If a directory contains lot's of unwanted data, and you'll want to delete the whole directory, you may choose to use the following command. It forces a removal of a directory or file. Please use this only when you're very sure. The following command is based on a current directory that contains the file or directory that will be removed. If you want to use this command from the root directory, just add all the map names to the file or directory (ex. /<directory1>/<directory2>/ etc.) before the <directory or file name> without a space.
-------------------------
rm -rf <directory or file name>
To remove a separate file, use the following command:
-------------------------
rm <file name>
To copy a file to a specific place on the same computer, use the following command: This command will copy <file name> in the current directory to <directory2>, which is in <directory1>, which is in the root directory. The "~" in this command tells SSH to go first to the root directory, from there you have given the navigation to the file.
-----------------------
cp <file name> ~/<directory1>/<directory2>/
If you want to copy a file to a directory that is within the same directory as the goal directory (ex. you want to copy from /videos/ to /videos/drama/foreign/), you can also use the above code without the "~". Please note that <directory1> will now be the map /drama/ and <directory2> will be /foreign/, because we don't go back to the root directory.
The above code can also be used for moving a file, just replace "cp" in "mv".
If you want to display your current TCP/IP configuration (such as you IP address, used network device, etc.) (just like ipconfig on Windows), type the following command:
----------------------------
ifconfig
Advanced usage
Now we're going to show you some more advanced commands, most of them you only need when you're facing some problems and want to find out what it causes.
Displaying CPU and memory usage by the system can be done with the following command:
-----------------------------
top
You'll get the following screen:
To sort the list by memory usage, use the following key combination: Shift+m
To sort the list by CPU usage, use the following key combination: Shift+p
To exit this screen, use the following key combination: Shift+q
I know most of you will not know what everything in this screen will tell, but most of you know when you have a very high percentage CPU or memory usage, that that particular process is not working well. So when you report a bug or ask for help, you'll have detailed info which you can give for a solution!
To print a whole list of active processes, can be displayed with the following command:
----------------------------
ps -ef
Add "|more" after "-ef", the list will pause when the terminal window is full. Press any key to resume (if the list is too long, it will pause again when the terminal window is full)
Add "|grep <name>" after "-ef" to filter the list. This will show only the processes containing the word <name>
Add "|grep -v <name>" after "-ef" to filter the list. This will show only the processes that not contain the word <name>
A list of Kernel messages can be displayed with the following command:
------------------------
dmesg
To safe this Kernel messages to a file, use the following command:
------------------------
dmesg >>dmesg.txt
This file will be saved in the current directory, it can be wise to go to a specific directory (that is for example accessible by SAMBA) to safe this file.
To view common log-files of the system, use the following command to enter the directory that's containing them:
-------------------------
cd /var/log
For a live-view of an existing log-file (new added data will be shown directly and automatically scroll down), type:
------------------------
tail -f <log-file>
Notice that the above command will only work in the current directory of the log-file. To use this command from root, give also the containing directories as described before. To exit the live view, use the following combination "Ctrl+c"
We've implemented an automatic way of uploading troubleshooting logs to the pastebin website. This can be achieved in the following way.
Example 1. we ask you you to upload the message file:
------------------------
paste /var/log/messages
Above command will return with an URL to the pastebin website and your message file can be seen there.
Example 2. We ask for the dmesg output :
----------------------
dmesg |paste
Above will not show anything in your console, but will rather paste the output of your dmesg to the pastebin site. Again it will return with a URL which can be shared with developpers or in the forum for others to troubleshoot issues.
Warning! these commands will terminate your connection and turn of / reboot your system
----------------------
poweroff
reboot
Yorum yap