Astrofriend's homepage

www.astrofriend.eu
Share: Twitter Reddit Facebook Gmail Gmail Email
Search Astrofriend's homepage:

Valid CSS!

All pages shall now have been validated

Info Cookies (Kakor) / GDPR

Navigation

Advertisement /
Annons:

Tutorial News

Advertisement / Annons:

My astronomy project:
KStars and Linux


Content:

  1. Good to know Linux commands
  2. Linux udev rules
  3. To be continued

Related projects:

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


1: Good to know Linux 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.


General:

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)

Update:

  • 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

Ports:

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

IP:

List interfaces, wifi etc:

  • ip link

List log file online, wifi etc:

  • sudo tail -f /var/log/syslog

Focus:

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

GPS:

List GPS data stream on screen:

  • sudo screen /dev/ttyUSB0 4800

Quit with:

  • Ctrl+a k yes

Location:

  • sudo nano /etc/location.conf

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

  • cgps -s

Quit with "Ctrl C".

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, USB0:

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

Same commando in one line and USB1:

  • 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:1.3.3.3:1.0-port0

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'

alternative

  • 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 >

Raspberry KStars 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.

Raspberry KStars 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?"

Raspberry KStars 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 II

Advertisement / Annons: