index   prev   next RISC OS Notes


"I don't like GUIs" Linus Torvalds Finland Security is in the linux dna - learn to dance with it From Ma Bell labs in 1969 - multics > unix > minix > linux

# what am I? who am I? where is it?

a[Tab][Tab] list all commands beginning `a' apropos net list commands related to net cat /etc/os-release linux version info cat /proc/version linux version info cat /etc/passwd info on all users cat /proc/cpuinfo rpi model info clear clears screen you can still scroll back compgen -c | sort sorted list of all bash commands ctrl-c or ctrl-d interrupt process (eg ping) cd /etc;ls multiple commands separated by semi-colons declare show env vars ** Warning lots of stuff df display free df -h show devices (h is for human) dig riscpc dnsutils *install dmesg msgs from /var/log relative to most recent boot echo $UID|$HOME|$PATH display system variables env displays environment variables - $NAMES find /etc/*ftp* search live system finds string after path free show memory free -m ( megabytes) history list commands eg use !198 to run command from list hostname name of machine eg hp-lubuntu hostname -I ip address id user and group info ifconfig -a ip address mac address locate x11vnc search dbase of file names string anywhere in path ls list current directory contents ls -A show nearly all ls -ld show permissions ls -lish list all except hidden ls -lisha list all including hidden ls -lishaR list all recursive *** may be lots ls /bin list your system commands: lsblk partitions show lsusb list USB devices man hostname online manual neofetch essential raspberry pi info - *install nmap -sn show all devices on subnet pwd show current working directory $PWD PS1="\u\w >" user\path > terminal prompt string pstree show processes as tree diagram sudo apt install xyz get and install xyz sudo passwd -Sa show password status of all users sudo raspi-config show change start up parms sudo shutdown -r now shutdown and reboot now top show active tasks live process display top -d 5 -n 3 (d seconds, n iterations) umount /dev/sda1 device unmount which ls returns path of executable who users logged on whoami current user whereis hostname binary, source and man locations for hostname

structured list of commands - click here


# some more linux cmds

arecord list hard devices audio arecord -l cat foo cp copy cp xxx ~/yyy ( current to home) du -h directory size echo echo string to std opt echo $USER $PS1 file foo for jpgs shows resolution info read Info documents less pipe view scrollable less xxx md make directory (or path) md xdir/ydir (creates both) mv foo ~ - moves file to home dir passwd chg password of current user poweroff pwd present working dir(where am I?) reboot rm remove (delete) files rmdir remove (delete) dir stat foo file info sudo exec command as superuser top real-time view of system touch create empty file touch x y z useradd create new account vi editor visudo edit sudoers permissions file sub mode | pipe $ prefix env var in echo space bar q ctrl c pipe to file lspci > xxlspci.txt

# access permissions

3 x 3 - 9 bits or 3 octal values or 10 letters where: first position is object type (d,l,-) for (directory,link,file) r is read yes, w is write yes, x is execute yes no is shown by a dash (-) Eg drwxr-xr-x 755 d directory r read owner yes w write owner yes x xecute owner yes r read group yes - write group no x xecute group yes r read other yes - write other no x xecute other yes sudo chown john filefoo file change owner sudo chmod ugo+rwx foo file change permissions sudo chmod -R ugo+rwx * sudo chmod -R a-x * remove execute

# nano quick guide

You don't need much more than the Help text ˆg display help text F1 also display help text note copy and paste are non standard: use mouse to select and mouse menu to paste note also problem with RISC OS Nettle N/L Return unflows all text! but shift Enter may work

# vi editor surVIval guide

NOTE : is the escape character vi filename :help is the key to vi read first page carefully :q to return to editor if no changes :q! quit abandon changes :wq! save and quit ! over-rides readonly flag however saved but no quit had to :q! to really quit back to prompt ZZ save and exit vi arrows move around x delete char at cursor X delete char before cursor 7x delete 7 chars

# reset forgotten password

Boot in to Recovery Mode: Select "root - Drop to root shell prompt" : mount -rw -o remount / : ls /home : passwd username : (enter new password and confirm it) : passwd abcxyz321 : exit


linux forward slash / ms backslash \ directory symbols / root directory eg cd / ~ (tilde character) My home directory (normally /home/my_login_name). "cd" alone is equivalent to "cd ~". . (dot) Current directory. Eg ./my_program executes file "my_program" in current work dir .. (two dots) Directory parent to the current one. - (dash) changes to previous directory location (equiv to $OLDPWD) pwd shows current Working Directory / root bin/ essential software, user cmds, eg ls, sort,.. boot/ bootable kernel and boot loader configs grub dev/ virtual files allowing access points to devices etc/ system global config files /etc/init/vsftpd.conf /etc/vsftp.conf home/ user directories eg john/ lib/ libraries proc/ info about sys resources, stats, eg cpuinfo root/ home directory for root acount sbin/ admin cmds and daemons for root user /sbin/vsftpd srv/ servers? has empty ftp dir sys/ related to proc/ usr/ user doc, user admin, software, sys libraries tmp/ temporary files for apps var/ sys data, app data logs, spool /var/log/vsftpd.log

# Device management

df shows devices - on Lubuntu the hard disk shows as: /dev/sda7 Udev - device manager for Linux kernel it responds to hotplug events File manager can show drives >>View>Side Pane>Places|Directory View Mounting a USB Pen Drive create mount point:- sudo mkdir /media/USB mount the drive:- sudo mount -t vfat /dev/sdb1 /media/USB -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

# running apps

To run app or script from cmd line it must be in path or explicitly referenced eg if it is in current dir ./ (note .sh suffix required) ( echo $PATH - all directories with commands you can run) Note - Name of app may not be same as the command to run it. eg. to run Leafpad use "leafpad filename" navigate to /usr/bin to find these executables Run from >>Start menu. eg start to type torus - first matching entry pops up -click to start

# Scripts aka shell scripts (.sh)

use a text editor to create file (leafpad or gedit) first line should be:- #!/bin/sh save with filetype sh eg set permissions to allow execution sample script:- #!/bin/sh echo "hello world"

# execute app at boot startup autostart Lubuntu

copy from file: /usr/share/applications/appjr.desktop to file: /home/username/.config/autostart >>Start>Preferences >Desktop Session Settings... check box in the Desktop Session Settings application.

# VNC Server on Raspberry Pi

builtin - enable via >>preferences >Raspberry Pi Configuration >Interfaces Authentication for RISC OS using GUI - >> V2 > Options ... Security ... Encryption > prefer off Authentication > VNC password Users and Permissions Standard user enter password OK Change Desktop bacground to plain FIX broken headless HDMI configuration (pre Bullseye):- >sudo nano /boot/config.txt add:- dtoverlay=vc4-kms-v3d,nocomposite

Set static ip address for Raspberry Pi

good description here:- 1. ip r #find router address 2. cat /etc/resolv.conf #find dns server address 3. sudo nano /etc/dhcpcd.conf #add these lines with your addresses interface wlan0 static ip_address=192.168....../24 static routers= static domain_name_servers=212.104.... 4. save and reboot

Install neofetch on Raspberry Pi

sudo wget -O /usr/local/bin/neofetch sudo chmod a+x /usr/local/bin/neofetch neofetch --version neofetch

SSH on Raspberry Pi

Enable SSH Server in Raspberry Pi Configuration ssh clients store keys per ip address in known_hosts file if key changes on Server, Client will reject logon:- WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! To fix: on client computer remove keys for that ipadddr ssh-keygen -R

Libcamera on Raspberry Pi 3B+

***FIX for camera apps not working*** sudo raspi-config >advanced options >enable glamor graphic acceleration reboot

SMB Managing Samba

(setup SMB see sudo apt install samba change hostname from raspberrypi to eg raspi-v SMB Lnx Configuration File Reference Manual EDIT Configuration File sudo nano /etc/samba/smb.conf SAMBA logs log file = /var/log/samba/log.%m eg log.smbd - smbd daemon status daemon smbd ready to serve log.nmbd - nmbd daemon status failed to register my name RASPBERRYPI on query name response from ...27 log. empty CHECK SYNTAX OF SMB.CONF testparm CHECK WHO IS LOGGED ON sudo smbstatus RESTART SAMBA:- sudo systemctl start smbd sudo systemctl restart smbd.service VIEW LIST OF SHARES - needs install password - raspberry smbclient -L localhost pi@raspberrypi:~ $ smbclient -L localhost Unable to initialize messaging context Enter WORKGROUP\pi's password: Sharename Type Comment --------- ---- ------- print$ Disk Printer Drivers piroot Disk the whole pie pidesk Disk home pi desktop IPC$ IPC IPC Service (Samba 4.9.5-Debian) pi Disk Home Directories Reconnecting with SMB1 for workgroup listing. Server Comment --------- ------- sudo Workgroup Master --------- ------- WORKGROUP RASPBERRYPI pi@raspberrypi:~ $

SMB /etc/samba/smb.conf

[homes] create mask = 0775 directory mask = 0775 [piroot] comment = the whole pie path = / [pidesk] comment = home pi desktop path = /home/pi/Desktop read only = no create mask = 0777 directory mask = 0777 Guest ok = yes

© JR 2022