Astrofriend's homepage
Share: Twitter Reddit Facebook Gmail Gmail Email
Search Astrofriend's homepage:

Valid CSS!

All pages shall now have been validated

Info Cookies (Kakor) / GDPR


Advertisement /

Twitter @AstrofriendLars

Follow Astrofriend

Tutorial News

Advertisement / Annons:

My astronomy project:
Building an astroserver with a Raspberry Pi4


  1. Introduction
  2. The passive cooler
  3. Formatting the microSD card and transfer of the mirror file
  4. Setup KStars and Ekos
  5. Setup INDI Control Panel 'Telescope simulator'
  6. Setup INDI Control Panel 'Canon DSLR'
  7. Battery test
  8. Indoor test of focus control
  9. Adding a GPS receiver
  10. First Light
  11. Setup as Hotspot controlled from a pad
  12. Setup drivers peripheral
  13. Serial ports handling
  14. Good to know commands
  15. To be continued

Related projects:

  1. HEQ5 as portable mount
  2. Pentax 645 300 mm ED IF f/4 lens
  3. KStars / EKOS and Raspberry Pi4

I take no responsibility or liability for what are written here, you use the information on your own risk!

14: Good to know commands

When solving problem with the Raspberry computer it's good to know some commands. I have here list of the most common commands I use. Most related to the GPS and the mount which always cause problems for me. You type the commands in the Commando Window.

I normally high lite the commando here with the mouse and copy it with "Ctrl C" and then paste it in the Raspberry. But note, Raspberry isn't Windows, it's Linux, you must right click and choose Paste where you want to place the command.


Generally -help gives a help menu

  • xxxx -help

or sometimes

  • date --help

Generally question mark gives a help menu

  • ls ?

List installed packages

  • dpkg -l (Ctrl C exit)


  • sudo apt-get update
  • sudo apt-get upgrade

Or in one line:

  • sudo apt update && sudo apt upgrade && sudo apt dist-upgrade

Language in menus, example, en_GB.utf-8:

  • sudo dpkg-reconfigure locales

Erase libraries and files that still are there after delete:

  • sudo rm -rf /media/astroberry/*

Example on manual for commands:

  • man rm


List connected USB devices

  • lsusb
  • ls -l /dev/USB*

List tty devices

  • ls -l /dev/tty*

List ACM devices

  • ls -l /dev/ACM*

List syslog

  • sudo tail -f /var/log/syslog


With the USB-Focus V3 there can be problem to connect it. This commando stop the modem manager which can "steal" the port:

  • sudo apt-get remove modemmanager


List GPS data stream on screen:

  • sudo screen /dev/ttyUSB0 4800

Quit with:

  • Ctrl+a k yes


  • sudo nano /etc/location.conf

Show GPS window, can be from GPS, or pos from site or local stored

  • cgps -s

When wrong GPS time or coordinates, test to restart GPSD:

  • sudo systemctl restart gpsd

Show default data for GPSD:

  • sudo nano /etc/default/gpsd

Setup GPS dongle to NMEA mode:

  • sudo stty -F /dev/ttyUSB0 4800
  • sudo gpsctl -n -D 4 /dev/ttyUSB0
  • sudo stty -F /dev/ttyUSB1 4800 && sudo gpsctl -n -D 4 /dev/ttyUSB1

Stop, disable, enable and start GPSD:

  • sudo systemctl stop gpsd && sudo systemctl disable gpsd && sudo systemctl enable gpsd && sudo systemctl start gpsd

Maybe this command do the same.

  • sudo systemctl restart gpsd

USB dongle at address:

  • /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:

Log of activity:

  • sudo tail -f /var/log/syslog

History of commands:

  • Ctrl R

Date Time:

Set date and time: (2023-04-06 20:10:00, April 6th)

  • sudo date -s 'YYYY-MM-DD HH:MM:SS'


  • sudo date --set="6 APR 2023 20:10:00"

Make a script with a command:

Some commands will be used often and it could be convenient to have a script to run it from. The command to restart the GPSD device I use often and I have done like this to execute it.
Open it from:
Preferences > Main Menu Editor >

RPi4 command restart GPSD

Open the preference menu from the left icon on the top list. Use "Desktop Session Settings" to create a new menu (map). In this new map "RPi4 commands" I will store my scripts.

RPi4 command restart GPSD

Open the new menu. Click on new item. Give it a name that remind you of what command to be execute. On the Command line, type in the command you will execute.

In this case:

  • sudo systemctl restart gpsd

Enable "Launch in terminal?"

RPi4 command restart GPSD

When done, open the menu with the left icon once again, now the new library with your command will be there.

Go Back to content

Go Back
To page IV, to be continued

Advertisement / Annons: