Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
access_the_batocera_via_ssh [2020/12/31 23:03] – [Internet functionnalities] added some pacman options fishouaccess_the_batocera_via_ssh [2021/03/18 10:26] – [Debugging] Added the batocera-screenshot command instead of the raspi2png fishou
Line 22: Line 22:
  
 Know that upon connecting, you will be put into the HOME folder of Batocera, this folder is called ''~'' and is located at ''/userdata/system''. Know that upon connecting, you will be put into the HOME folder of Batocera, this folder is called ''~'' and is located at ''/userdata/system''.
 +
 +Some command-line tools have an ''%%--help%%'' option describing how to use the program, for exemple, typing ''%%cp --help%%'' will print how the command is used in the command-line interface.
 +
 +<code>BusyBox v1.31.1 (2020-11-28 14:11:54 CET) multi-call binary.
 +
 +Usage: cp [OPTIONS] SOURCE... DEST
 +
 +Copy SOURCE(s) to DEST
 +
 + -a Same as -dpR
 + -R,-r Recurse
 + -d,-P Preserve symlinks (default if -R)
 + -L Follow all symlinks
 + -H Follow symlinks on command line
 + -p Preserve file attributes if possible
 + -f Overwrite
 + -i Prompt before overwrite
 + -l,-s Create (sym)links
 + -T Treat DEST as a normal file
 + -u Copy only newer files</code>
 +
 +Most command-line tools have a similar syntax: ''%%CommandName -Option Parameter_of_the_option path/to/input/file path/to/output/file%%''
  
 Using the command line with paths of files can be confusing at first, there are two types of paths: Using the command line with paths of files can be confusing at first, there are two types of paths:
Line 28: Line 50:
   * **Relative paths** : they are relative to you current position, for exemple, if you are in the ''/userdata'' directory, and you use ''nano system/batocera.conf'', you will execute the command nano on the file ''batocera.conf'' located in the ''/userdata/system'' folder.   * **Relative paths** : they are relative to you current position, for exemple, if you are in the ''/userdata'' directory, and you use ''nano system/batocera.conf'', you will execute the command nano on the file ''batocera.conf'' located in the ''/userdata/system'' folder.
  
-If a path, or a filename, contains special characters or spaces, you will need to put either single quotes ''%%'%%'' or double quotes ''%%"%%'' around it+If a path, or a filename, contains special characters or spaces, you will need to put either single quotes ''%%'%%'' or double quotes ''%%"%%'' around it.
  
 If a command needs to be manually closed, doing Ctrl+C will end it. If a command needs to be manually closed, doing Ctrl+C will end it.
Line 36: Line 58:
 ==== Basic file usage ==== ==== Basic file usage ====
  
 +A tool included into Batocera is Midnight commander, it is a powerful command-line file explorer, it should be enough for most users :
 +
 +  * ''mc'' : starts the command-line file explorer **M**idnight **C**ommander, this tool can be used to move, copy, delete, rename, and edit files, as well as create folders, make symbolic links, and change individual file permissions. This utility also supports a mouse input.
 +
 +You can also use the followings command to manipulate files : 
 +
 +  * ''pwd'' : tells you the current directory you are in [**P**rint **W**orking **D**irectory], for exemple, using ''cd /userdata'' then ''pwd'' will write ''/userdata''
   * ''cd'' : changes the current working directory [**C**hange **D**irectory], for exemple ''cd /userdata/roms'' puts you in the ''/userdata/roms'' folder   * ''cd'' : changes the current working directory [**C**hange **D**irectory], for exemple ''cd /userdata/roms'' puts you in the ''/userdata/roms'' folder
   * ''cp'' : copies a given file or folder to another path [**C**o**P**y], for exemple ''cp /userdata/system/batocera.conf /userdata/batocera.conf'' will create a copy of ''batocera.conf'' in the ''/userdata'' folder.   * ''cp'' : copies a given file or folder to another path [**C**o**P**y], for exemple ''cp /userdata/system/batocera.conf /userdata/batocera.conf'' will create a copy of ''batocera.conf'' in the ''/userdata'' folder.
Line 48: Line 77:
   * ''unzip'' : decompresses a given .zip file in the working directory, for exemple ''unzip file.zip'' will extract all the data in file.zip in the current working directory. You can ask to extract it elsewhere using the ''-d'' option [**D**irectory], for exemple, ''unzip file.zip -d uncompressed'' will extract all the data in file.zip inside a subdirectory called uncompressed.   * ''unzip'' : decompresses a given .zip file in the working directory, for exemple ''unzip file.zip'' will extract all the data in file.zip in the current working directory. You can ask to extract it elsewhere using the ''-d'' option [**D**irectory], for exemple, ''unzip file.zip -d uncompressed'' will extract all the data in file.zip inside a subdirectory called uncompressed.
 ==== Debugging ==== ==== Debugging ====
 +
 +The following commands can be used to debug Batocera, some of them are part of the ''batocera-es-swissknife'' command
  
   * ''aplay -l'' : returns the list of playback hardware devices [**A**udio **PLAY**er, **L**ist] (can be used to debug audio issues on PC).   * ''aplay -l'' : returns the list of playback hardware devices [**A**udio **PLAY**er, **L**ist] (can be used to debug audio issues on PC).
 +  * ''%%batocera-es-swissknife --arch%%'' : prints the current **ARCH**itecture running.
 +  * ''%%batocera-es-swissknife --emukill%%'' : **KILL**s any **EMU**lator running.
 +  * ''%%batocera-es-swissknife --restart%%'' : **RESTART**s EmulationStation.
 +  * ''%%batocera-es-swissknife --reboot%%'' : **REBOOT**s the entire system.
 +  * ''%%batocera-es-swissknife --shutdown%%'' : **SHUTDOWN**s the entire system.
   * ''emulationstation'' : starts emulationstation.   * ''emulationstation'' : starts emulationstation.
   * ''kill'' : kills a process with a given PID, for exemple if ''pidof retroarch'' returned 640, then doing ''kill 640'' will terminate the retroarch process.   * ''kill'' : kills a process with a given PID, for exemple if ''pidof retroarch'' returned 640, then doing ''kill 640'' will terminate the retroarch process.
   * ''pidof'' : gives a list of processes identifyiers (PID) for a running process name [**P**rocess **ID**entification **OF**], for exemple ''pidof retroarch'' returns a number when a retroarch-based emulator is running.   * ''pidof'' : gives a list of processes identifyiers (PID) for a running process name [**P**rocess **ID**entification **OF**], for exemple ''pidof retroarch'' returns a number when a retroarch-based emulator is running.
-  * ''poweroff''shutdowns the system. +  * ''batocera-screenshot''Saves a **screenshot** of th current screen in the ''/useerdata/screenshots'' folder.
-  ''raspi2png'' : Exclusive to raspberry pi, saves a screenshot of batocera in the current working directory. +
-  * ''reboot'' : reboots the system.+
  
 ==== Internet functionnalities ==== ==== Internet functionnalities ====
  
   * ''batocera-upgrade'' : let's you update batocera using the command-line with the correct URL, see [[upgrade_manually|Manual upgrades/downgrades]] for more details   * ''batocera-upgrade'' : let's you update batocera using the command-line with the correct URL, see [[upgrade_manually|Manual upgrades/downgrades]] for more details
-  * ''pacman -Ss'' : let's you search through the pacman packages using the command-line [**PAC**kage **MAN**ager, **S**ync], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos. +  * ''pacman -Ss'' : let's you search through the pacman packages using the command-line [**PAC**kage **MAN**ager, **S**ync, **S**earch], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos. 
-  * ''pacman -S'' : let's you install a package using it's name [**PAC**kage **MAN**ager, **S**ync, **S**earch], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos.+  * ''pacman -S'' : let's you install a package using it's name [**PAC**kage **MAN**ager, **S**ync], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos.
   * ''pacman -Rsd'' : let's you remove a package using it's name [**PAC**kage **MAN**ager, **R**emove, recur**S**ive, skip **D**ependancies checks], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos.   * ''pacman -Rsd'' : let's you remove a package using it's name [**PAC**kage **MAN**ager, **R**emove, recur**S**ive, skip **D**ependancies checks], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos.
   * ''pacman -Scc'' :  clears the entire cache of the pacman manager [**PAC**kage **MAN**ager, **S**ync, clear **C**ache (extra **c** forces a complete clear)], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos.   * ''pacman -Scc'' :  clears the entire cache of the pacman manager [**PAC**kage **MAN**ager, **S**ync, clear **C**ache (extra **c** forces a complete clear)], see [[pacman_package_manager|Batocera Package Manager (pacman)]] for more infos.
Line 76: Line 110:
 ===== Custom aliases ===== ===== Custom aliases =====
  
-While not mandatory, it is good to know you can create aliases of commands, they let you launch a command with a simple keyword. One way to do this can be done by creating a text file in ''/userdata/system'', that file must be named ''.profile'' : it will contain aliases commands and  will execute them when batocera is launched, so be careful of what you do.+While not mandatory, it is good to know you can create aliases of commands, they let you launch a command with a simple keyword. One way to do this can be done by creating a text file in ''/userdata/system'', that file must be named ''.profile'' : it will contain aliases commands and  will execute them when Batocera is launched, so be careful of what you do.
  
 The alias command syntax is as follow: The alias command syntax is as follow:
Line 82: Line 116:
 ''alias customname=%%'du -sh /userdata/system/batocera.conf'%%'' ''alias customname=%%'du -sh /userdata/system/batocera.conf'%%''
  
-In this exemple, once batocera has been restarted, entering ''customname'' in the command line will do the same as entering ''du -sh /userdata/system/batocera.conf'' (in this exemple, it basically returns the size of the batocera.conf file in the command-line interface)+In this example, once batocera has been restarted, entering ''customname'' in the command line will do the same as entering ''du -sh /userdata/system/batocera.conf'' (in this example, it basically returns the size of the batocera.conf file in the command-line interface)
  
-a more useful, yet complicated exemple, would be to try and use ffmpeg to save a screenshot of batocera in the screenshots folder, as devices other than raspberry pies don't have an equivalent of raspi2png, in this exemple I call the custom alias "pc2jpeg".+a more useful, yet complicated example, would be to try and use ffmpeg to save a screenshot of Batocera in the screenshots folder for x86_64 devices, as devices other than raspberry pies don't have an equivalent of raspi2png, in this example I call the custom alias "pc2jpeg".
  
-''%%alias pc2jpeg='ffmpeg -f x11grab -i :0.0 -frames:v 1 /userdata/screenshots/$(date +%y-%m-%d_%H-%M-%S).jpg'%%''+''%%alias pc2jpeg='ffmpeg -hide_banner -loglevel error -f x11grab -i :0.0 -frames:v 1 /userdata/screenshots/$(date +%y-%m-%d_%H-%M-%S).jpg'%%''
  
 This commands does the following : This commands does the following :
-  * ''ffmpeg'' : an command-line encoder included inside batocera +  * ''ffmpeg'' : an command-line encoder included inside batocera
-  * ''-f x11grab -i :0.0'' : uses ''x11grab'' to capture the screen 0 (this lets you use the screen as the source) +  * ''-hide_banner'' : prevents ffmpeg from printing the copyright notice when running this command. 
-  * ''-frames:v 1'' : the number of video frames to capture+  * ''-loglevel error'' : will only alert in the command-line if there is an actual error preventing the command from working. 
 +  * ''-f x11grab -i :0.0'' : uses ''x11grab'' to capture the screen 0 (this lets you use the screen as the source). 
 +  * ''-frames:v 1'' : the number of video frames to capture.
   * ''/userdata/screenshots/$(date +%y-%m-%d_%H-%M-%S).jpg'' : the full path to the file we want to save.   * ''/userdata/screenshots/$(date +%y-%m-%d_%H-%M-%S).jpg'' : the full path to the file we want to save.
-    * ''$(date +%y-%m-%d_%H-%M-%S)'' : executes the ''%%date +%y-%m-%d_%H-%M-%S%%'' command and reurns its result in the command line (for exemple, it will return ''20-12-31_21-52-19'' the 31st december of 2020 at 21h52m19s), so the path before would be read as /userdata/screenshots/full_capture/20-12-31_21-52-19.jpg+    * ''$(date +%y-%m-%d_%H-%M-%S)'' : executes the ''%%date +%y-%m-%d_%H-%M-%S%%'' command and reurns its result in the command line (for exemple, it will return ''20-12-31_21-52-19'' the 31st december of 2020 at 21h52m19s), so the path before would be read as ''/userdata/screenshots/20-12-31_21-52-19.jpg''.
  
 So by using the ''pc2jpeg'' custom command, a .jpeg file will be created with a filename based off the date of the screenshot. So by using the ''pc2jpeg'' custom command, a .jpeg file will be created with a filename based off the date of the screenshot.
  • access_the_batocera_via_ssh.txt
  • Last modified: 8 weeks ago
  • by cs