usefulCommands Useful
Useful commands
wget https://git.christianimmanuel.de/scripts/raw/Useful/usefulCommands && chmod 740 usefulCommandsusefulCommands raw
##################################################
### Useful commands
espeak "Hello, how are you?" -w /home/guido/espeak.wav -s145
#######################################
## cmus
# change cmus audio output
:set dsp.alsa.device=default
:set mixer.alsa.device=default
:set dsp.alsa.device=bluealsa
:set mixer.alsa.device=bluealsa
#######################################
## audio
ffmpeg -i Music/Changes.mp3 -f s16le -ac 2 -ar 44100 - | aplay -r 44100 -c 2 -f S16_LE -D hw:1,0 # test hw audio output
#######################################
## record
arecord --duration=5 --format=dat /tmp/test-mic.wav && mpv /tmp/test-mic.wav # record from mic with default alsa?
arecord -D plughw:1,0 -f S16_LE -r 44100 -d 3 -vv /tmp/test.wav && aplay /tmp/test.wav # record
arecord -f S16_LE -r 44100 -d 3 -vv test-mic.wav && aplay test-mic.wav # record & play
#######################################
## video
ffmpeg -f alsa -i hw:1,0 -f video4linux2 -s 320x240 -i /dev/video0 /tmp/out.mpg # record video
#######################################
## zathura -> view pdf
zathura file.pdf
a s d # change position of page
# clipboard:
mkdir -p "~/.config/zathura/" && echo "set selection-clipboard clipboard" > ~/.config/zathura/zathurarc
#######################################
## make beep
sleep 8m && speaker-test -t sine -f 1000 & pid=$! ; sleep .8s ; kill -9 $pid && notify-send -u critical "Timer done !!"
#######################################
## users // groups
useradd -m USERNAME # create user and home dir
useradd -m USERNAME -d PATH/TO/HOMDIR # create user and home dir
uname -m
groups
cat /etc/user
cat /etc/group
## add user to group
usermod -a -G groupname username
## remove user from group
gpasswd -d user group
groupdel 10448 # remove group
getent group 10448 # get infos about gid
stat -c '%g' /path/to/file # get gid of file
find / -group 10450 # find files owned by groupId
find / -user 10450 # find files owned by userId
#######################################
## size of folder
du -sh /var
du -c -h --max-depth=0
df -ah # size of partitions
#######################################
## update initframes
sudo mkinitcpio -P
#######################################
## backup
sudo dd if=/dev/sda of=windoofUSB bs=128K conv=noerror,sync status=progress # backup usb // make disk img of usb
#######################################
## dd
xz -dc file.img.xz | dd of=/dev/mmcblk0 status=progress
#######################################
## awk
echo $STRING | awk '{print $NF}' #get last word of string
echo ${#word} # count characters of string // $word
# get nth last word of dir
PJNAME="$(echo $CONFDIR | awk -F / '{print $(NF-1)}')"
echo $(basename -- $FILE)
#######################################
## cut
echo $STRING | cut -c2- #remove first character
#######################################
## get nth line of file
head -nX FILE |taill -n1
#######################################
## tail
tail -n+2 # print all but the first line
#######################################
## grep
-v, --invert-match # select non-matching lines
grep "^in\|in$" input.txt
echo $STRING | grep -o "$VAL.*" # grep all from match
echo "Here is a string" | grep -o -P '(?<=Here).*(?=string)' # get between match/ two pattern
-m 1 ## stop after first match
grep -A 1 "TEXT" # get n lines after match (-B for before)
grep -s # hide is not a directory // hide direcory
grep file foo | while read line ; do echo "$line" | date %s.%N ; done
grep -v '^$' your_file # This command excludes empty lines from the file.
grep -a FILE # binary file matches
#######################################
## printf
printf '#%.0s' {1..80} # repeat # 80 times # print character n times
#######################################
## ls
ls -lt # sort by date
ls --full-time # ls year
#######################################
## stat
stat -c %g filename # get gid of a fil
#######################################
## find
find /path/to/dest -type f -empty # find empty file
find /path/to/dest -type d -empty # find empty dir
find /path/to/dest -type d -empty -not -path "./directory/*" # exclude dir
find / -gid 99999
find / -group install
#######################################
## wget
wget -c https://download.qt.io/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz # continue to download with -c
#######################################
## pstree
pstree # top all list all processes
#######################################
## ps
ps -ef --forest # list all processes
ps -f -p"$(pgrep -d, -u $USER -P 1)"
ps -p 26791 -f # get pid info details of pid
ps -p "$(pgrep vimb | xargs)" -o user= # display user names without header
#######################################
## top
top -p `pgrep "java"` # top search process // grep fro process
P # top sort by cpu
M # top sort by memory
< // > # top change sort
W # top save actual setting
#######################################
## sed
echo $STRING | sed s/"$WORD"// #remove specific word
sed -i '12d' file #remove specific line from file
sed -n 's/^.*VARIABLE//p' #after match
sed 's/ ([^)]*)//g' # remove between brackets
sed "/muhahaa/d" # remove line containing match
sed "2aMUUUU" # insert after nth line
#######################################
## remove leading and ending whitespace
sed 's/^ *//;s/ *$//g' <<< "$var"
sed '0,/MATCH/d' <<< "$var" # remove all lines before match and match
sed '/^[[:blank:]]*$/ d' file.txt # remove empty linesed 's/\.[^ ]*\///g' # replace all ./.*/ ## replace before first occurrence
#######################################
## vim
https://www.baeldung.com/linux/vim-gdb-integration # compiler
:%s/foo/bar/gc #replace over file ask yes no
:g/word/d # remove line
:g!/word/d # remove all other lines
:%s/foo/bar/g #replace over file
:%s/foo/bar/gci #replace over file, ignore Capitals, ask for confitm
:%s/^ [1-9]\+ // # line starts with: ' NUMBER '
:v/;$/d # find line without simicolon at the end
/^\(.*;\)\@!.*$ # find line without simicolon at the end
:'<,'>w !wl-copy # copy to clipboard
zR # unfold everything
da" #remove between quotes"
:w !wl-copy # copy file to clipboard
w !wl-copy # copy visualized part to clipboard
Ctrl + r + \" # insert yanked text to command line (just one qute without backslash)
:hi # View vim colors
:set number # get line number
:set omnifunc=csscomplete#CompleteCSS
:set omnifunc=htmlcomplete#CompleteTags
:set omnifunc=javascriptcomplete#CompleteJS
:set foldmethod=syntax #set fold
# split window
# str ww to switch window
:spilt
:sp
:vsplit FILENAME # open a file splitted vertically
:vs # shortcut for the above (also possible to open te same file)
:sort ui ## sort lines: mark with v mode whole lines till end type
zo # open at cursor
z+Shift+o # opens all att cursor
zc close
O
gg =G # auto indent file
:!gcc -o somename % && ./somename # compile c file
:!gcc % -o %< && ./%<
# or
:make %< # compile
:!./%< # run
## ctrl+n for autocomplete; ctrl+x & ctrl+o for suggestion
64G # go to line
K # look up a function name (cursor on fscanf p.e.)
Ctrl + p # auto complete
## text-align
:center [width]
:right [width]
:left
:set spell spelllang=en_us
Ctrl + ws - split window
Ctrl + wv - split window vertically
Ctrl + ww - switch windows
Ctrl + wW - switch windows opposite direction
Ctrl + wp - switch to last
Ctrl + wq - quit a window
Ctrl + wx - exchange current window with next one
Ctrl + w= - make all windows equal height & width
Ctrl + w- - make windows smaller
Ctrl + w+ - make windows bigger
Ctrl + wh - move cursor to the left window (vertical split)
Ctrl + wl - move cursor to the right window (vertical split)
Ctrl + wj - move cursor to the window below (horizontal split)
Ctrl + wk - move cursor to the window above (horizontal split)
Ctrl + wH - make current window full height at far left (leftmost vertical window)
Ctrl + wL - make current window full height at far right (rightmost vertical window)
Ctrl + wJ - make current window full width at the very bottom (bottommost horizontal window)
Ctrl + wK - make current window full width at the very top (topmost horizontal window)
Ctrl + wr - switch / rotate windows
#######################################
## nvim
https://github.com/nvim-lua/kickstart.nvim/blob/master/init.lua
#######################################
## vimb
* # copy to clipboard
zi # zoom in
zo # zoom out
f # select mode enter link
;y # select mode yank link
#######################################
## screen
#disconnect
EX="screen -d \"screen-$1\""
#connect
[ -n "$SSH_CON" ] &&
EX="screen -x \"screen-$1\"" ||
EX="screen -d -R \"screen-$1\""
#remove
EX="screen -d -R \"screen-$1\""
#create
NAME="$1"
shift 1
EX="screen -d -m -S \"screen-$NAME\" $@"
#list()
EX="screen -ls | sed '1,1d;$d;s/^\t//g'"
#######################################
## pip
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs
-n1 pip install -U # pip upgrade all
#######################################
## echo
# color echo output
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "I ${RED}love${NC} Stack Overflow"
echo -e "I \033[0;31mlove\033[0m Stack Overflow"
Black 0;30 Dark Gray 1;30
Red 0;31 Light Red 1;31
Green 0;32 Light Green 1;32
Brown/Orange 0;33 Yellow 1;33
Blue 0;34 Light Blue 1;34
Purple 0;35 Light Purple 1;35
Cyan 0;36 Light Cyan 1;36
Light Gray 0;37 White 1;37
printf "\e[48;5;XXXm\e[1;1fs\e[0m" # use 255 ANSI ansi codes as XXX https://www.ditig.com/256-colors-cheat-sheet
for i in {0..255}; do printf "$i\t\e[48;5;%dm \e[0m\n" $i; done # display all colors
#######################################
## arp-scan
sudo arp-scan -l # scan local net
#######################################
## sway connect socket
export SWAYSOCK=/run/user/$(id -u)/sway-ipc.$(id -u).$(pgrep -x sway).sock; export WAYLAND_DISPLAY=wayland-1; export DISPLAY=:0
# sway move to workspace
iceweasel & wmctrl -s 2
# get names
swaymsg -t get_tree | jq '.. | (.nodes? // empty)[] | {name}[]'
# sway apps of active workspace
swaymsg -t get_tree | jq '.. | (.nodes? // empty)[] | select(.focused==true) | {name, pid}'
swaymsg -t get_tree | jq '.. | (.nodes? // empty)[] | select(.focused==true) | {name}.name'
swaymsg -t get_tree | jq -r '..|try select(.focused == true)'
# active workspace
swaymsg -t get_workspaces | jq '.[] | select(.focused==true) | {num}'
swaymsg -t get_workspaces | jq '.[] | select(.focused==true) | {num} ' | sed -n 's/^.*"num": //p'
current_pid=$(swaymsg -t get_tree | jq 'recurse(.nodes[]) | select(.focused==true) | .pid')
pstree -p | grep $$ | cut -d '(' -f2 | cut -d ')' -f1 # get focused window from script
#######################################
## debug libinput keyboard key press
libinput debug-events # get keyboard key press
libinput list-devices
sudo libinput debug-events
sudo vim /usr/share/X11/xkb/symbols/pc
#######################################
## get key names of give input
evtest # oder:
evemu-record
device_id=$(ls -l /dev/input/by-id/ | grep usb-RAPOO_Rapoo_2.4G_Wireless_Touchpad_Keyboard-if02-event-kbd | tail -c 5 | sed 's/[^0-9]*//g')
device=/dev/input/event$device_id
function press {
evemu-event ${device} --type EV_KEY --code $1 --value 1 --sync
evemu-event ${device} --type EV_KEY --code $1 --value 0 --sync
sleep 0.2
}
#######################################
## git
git add --all . -- ':!.git' # git add all exept x
git branch -a # list branches
git branch -d <branch_name> # remove branch
git checkout "NAME" # switch branch
git checkout -b "NAME" # create new branch
git checkout tags/TAGNAME # checkout specific tag
git stash # if you want to change branch but have things you dont want commit in the current one
git diff # show diff of not added files
git stash apply # reapply the stash without removing after switching to the branch with uncommited changes
git stash pop # reapply stash and remove it
git status # view uncommitted changes
git log # view commits
git show HASH # show changes of commit
git merge --continue # finish merge conflict
git reset # undo git add
git checkout . # revert uncomitted changes
git checkout FILENAME # revert uncomitted changes
git clean -fdx # removes untracked files !! even whats in .gitignore !!
git reset --hard HEAD # reset to last commit
# fetch from upstream
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
$ git fetch upstream
#######################################
## nmap
nmap -p- $ID # scan ports
#######################################
## viw bin
xxd -b $file
## view hex
xxd $file
#######################################
## bash hide output
&> /dev/null
#######################################
## diff
diff -Naur standard_moodle my_moodle > patch.txt #Create diff file
#######################################
## sync folders
rsync -av $SRC $DEST
rsync --info=progress -auvzr /mnt/T14backup/mnt/base/home/n1831n/Music ~/Music/
#######################################
## unpack
tar zxvf fileNameHere.tgz
tar -xvf # unpack tar.xz file.tar.gz
gunzip -k file.img.gz
unxz # unpack img.xz
#######################################
## get blocksize
sudo blockdev --getbsz /dev/mmcblk0
#######################################
## backup img no free space
dd if=/dev/sdb | gzip > backup.img.gz #backup without free space
cat backup.img.gz | gunzip | dd of=/dev/sdb #write zipImg on drive
dd if=base.img.gz status=progress | gunzip | ssh root@piphone dd of=/dev/mmcblk2 status=progress
i thought i could summarize how i got sway to work on my pinephone,
i modified the sxmo scripts a bit to get a sms and dialer option via the vis-menu and some outher stuff
#######################################
## filesystem partition
df -T # display partition filesystem and usage
#######################################
## mount .img
sudo kpartx -va base.img
sudo mount /dev/mapper/loop0p1 ./IMG
sudo umount ./IMG
sudo kpartx -d -v base.img
# mount broken img
sudo fuse-ext2 -o ro -o allow_other t14.img /mnt
#######################################
## ssh access Log
journalctl -u sshd -n 100
# error logs
journalctl -b -p err
#######################################
## mmcli
mmcli -m 0 --messaging-list-sms
mmcli -m 0 --sms
mmcli -m 0 --messaging-delete-sms="$TEXTID"
#######################################
## find text over files
find / -name "*history*" 2> /dev/null # hide permission denied
find / -name "*history*" 2>&1 | grep -v 'Permission denied' # hide permission denied
find . -iname "*.php" | xargs grep -l "site-navigation"
find . -type f | xargs grep -l "site-navigation"
find . -type f -maxdepth 1 # list all files of dir
find -name "*.js" -not -path "./directory/*" # exclude dir
find / -not \( -path "/mnt/*" -o -path "/sources/*" -o -path "/home/*" -o -path "/var/lib/docker/*" -o -path "/usr/src/*" \) -name "stdlib.h"
find / -group groupX # find by groupname
grep -rnw 'Git/' -e 'icon_phx' # is grep, no need for * ...
#######################################
## global id
curl ifconfig.me
#######################################
## wireshark
tshark -f "host 192.168.2.XXX"
tshark -Y "not ip.addr == 192.168.2.xxx"
sudo tshark -i wlan0 -f "src port 53" -n -T fields -e dns.qry.name ### get DNS
sudo tshark -f "host 192.168.2.XXX" -T fields -e ip.addr ### get ip.addr
#######################################
## encrypt file
openssl enc -aes-256-cbc -salt -in file.txt -out file.txt.enc
openssl enc -aes-256-cbc -d -in file.txt.enc -out file.txt
#######################################
## if
# var starts with
[[ $var =~ ^B.* ]]
if [[ $input = B* ]]
# if val in array
printf '%s\n' "${myarray[@]}" | grep -P '^mypattern$'
# var is empty
[ -f "$var" ] && echo "File Exist?"
[ -z "$var" ] && echo "Empty"
[ -n "$var" ] && echo "not Empty"
[ -s "$FILE" ] || echo "Empty file"
# if dir is empty
if [ -z "$(ls -A /path/to/dir)" ]; then
#######################################
## rotate image with imagemagick
convert $file -rotate 90 rotated-$file
#######################################
## cut music
Trimmen
ffmpeg -ss 00:00:00 -t 00:02:48 -i helloSingle_fullLength.m4a -acodec copy helloSingle_start.m4a
Concatenation:
start="helloSingle_start.m4a"; end="helloSingle_end.m4a"; ffmpeg -i $start -c:a pcm_s16le -ac 2 -ar 48000 -f s16le file1.pcm && ffmpeg -i $end -c:a pcm_s16le -ac 2 -ar 48000 -f s16le file2.pcm && cat file2.pcm >> file1.pcm && ffmpeg -f s16le -ac 2 -ar 48000 -i file1.pcm -c:a aac -b:a 192K -ac 2 output.m4a
#######################################
## array
deviceName="Brother HL-110"; seperatedName=(${deviceName}) # string to array
#######################################
## loop
for i in ${array[@]}; do# for each in array
for line in $(cat $FILE) # for each line
for (( i=0; i<${#fuu}; i++ )); do echo "${fuu:$i:1}"; done # for each
character of string
#######################################
# for each file in dir
find . -type f ! -name '*get*' -exec ls -al {} +
sudo find . -type f ! -name '.*' -exec grep "gitstatusd" {} + > /tmp/find.log
#######################################
## resize images
!/bin/bash for i in *.JPG; do convert $i -resize 10% $(basename $i .JPG)-new.JPG; done
for i in *.JPG; do convert $i -define jpeg:extent=50KB $i; done
convert input.jpg -define jpeg:extent=50KB output.jpg
convert about.jpeg -resize 20% about1.jpeg # resize image
#######################################
## dreieck berechnen
http://www.arndt-bruenner.de/mathe/scripts/dreiecksberechnungrw.htm
#######################################
## last character of str
echo "${str: -1}"
printf "\e[37;40m\e[1;1f%$(tput cols)s\e[0m" |tr " " " " #reprint first line of terminal
printf "\e\e[1;${COL}f%1s\e[0m" | tr " " "$CHAR" #just one char
echo -en "\033[s\033[$(tput lines)B\033[1;34m 7 lines down violet \033[u\033[0m" #end of terminal in blue
echo -en "\033[s\033[$(tput lines)B Checking: $name \033[u" #no color
ardour musik recording midi
#######################################
## apache
sudo a2ensite kreativissimo.christianimmanuel.de.conf
#######################################
## certbot
# list certificates
sudo certbot certificates
# remove
sudo certbot delete
# add new cert
sudo certbot --apache # asks for new
#sudo certbot --apache -d bpkbingo.de -d www.bpkbingo.de
# new cert for subdomain
### ignore this ## sudo certbot -d christianimmanuel.de,bpkbingo.christianimmanuel.de,www.christianimmanuel.de --expand
# certbot renew cert
sudo certbot renew --dry-run
#######################################
## docker
systemctl start docker.socket
systemctl start docker.service
docker run -it archlinux
# implement mysql dump
docker ps # running containers
docker exec -i your_mysql_container mysql -u your_db_user -p'PASSWORD' your_db_name < /path/to/your/backup.sql
docker exec -it your_mysql_container mysql -u root -p # log into mysql database_old
# update docker
docker-compose down
docker-compose build
docker-compose up -d
docker exec -it your_wordpress_container_name chown -R www-data:www-data /var/www/html # needed for doing wp updates
#######################################
## virtual machine
qemu-img create -f qcow2 $VDISK_FILENAME $VDISK_SIZE
qemu-img create -f raw image_file 4G # baseimg
qemu-system-x86_64 -m 2048 -enable-kvm -cdrom iso_image -boot order=d -drive file=disk_image,format=raw # install -m=RAM
qemu-system-x86_64 -m 4096 -enable-kvm disk_image # run img
# -usbdevice host:4146:3257 (lsusb)
# parameter for shared dir:
-virtfs local,path=/path/to/host/folder,mount_tag=shared_folder,security_model=passthrough,id=fsdev0 \
-device virtio-9p-pci,fsdev=fsdev0,mount_tag=shared_folder \
# on host to mount shared:
mount -t 9p -o trans=virtio shared_folder /tmp/shared/ -oversion=9p2000.L,posixacl,msize=104857600
#######################################
## view img in terminal
catimg
#######################################
## echo output to new terminal window
dc="$(ls --color=never $logpts_dir)"; foot -a "logscript_fun" > /dev/null 2>&1 & disown; sleep 3; dn="$(ls --color=never $logpts_dir)"; npts="$(echo -e "$dc $dn" | sed "/ptmx.*/d" | sort -n | uniq -u | head -n2 | tail -n-1)"; echo -e "$dc $dn" | sed "/ptmx.*/d" | sort -n | uniq -u | head -n2 | tail -n-1
#######################################
## Read YN or anything el enter linkse input --> READ_CHECK = SUCCESFUL
readInputYn() {
I=$1; a="$(sed 's/./&|/g;s/|$//g' <<<"$I")"; unset READ_CHECK
echoHelp -n "Enter command: \033[1;32m[$a] " "$2" && read -n1 c;
if [[ "[${a,,}]" =~ "${c,}" ]]; then READ_CHECK="$(grep -oi "$c" <<< $I)"; else readInputYn $I ;fi
}
#######################################
## kill unwanted tty pts session
pkill -9 -t pts/1
#######################################
# mysql
mysqldump -u root -p database_name > database_name.sql
mysql -u root -p database_name < database_name.sql
#######################################
## compile c
gcc test.c -o test && ./test
#######################################
## Battery file
/sys/class/power_supply/BAT0/energy_now #energy used in
#######################################
#######################################
## LFS // BLFS
https://guix.gnu.org/en/manual/de/guix.de.html#Nach-der-Systeminstallation
https://gitlab.com/mbakke/guix-sway-example
https://www.linuxfromscratch.org/lfs/view/development/
https://www.linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-11.2-NOCHUNKS.html
https://www.linuxfromscratch.org/blfs/view/11.2/
https://www.linuxfromscratch.org/blfs/view/stable/general/wayland.html
https://www.linuxfromscratch.org/hints/downloads/files/more_control_and_pkg_man.txt
https://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/more_control_and_pkg_man/more_control_helpers.tar.bz2
https://www.linuxfromscratch.org/lfs/downloads/12.0/LFS-BOOK-12.0-NOCHUNKS.html#ch-materials-packages
https://www.linuxfromscratch.org/hints/downloads/files/time.txt # set clock
https://www.linuxfromscratch.org/blfs/view/12.0/ #BLFS
LFS=/mnt/lfs; chroot "$LFS" /usr/bin/env -i HOME=/root TERM="$TERM" PS1='(lfs chroot)\u:\w\$ ' PATH=/usr/bin:/usr/sbin /bin/bash --login
# chgrp install <dir> && chmod g+w,o+t <dir>
#######################################
#######################################
## Webcam
LEDS_CLASS_FLASH V4L2_FLASH_LED_CLASS
MEDIA_SUPPORT
USB_VIDEO_CLASS
VIDEO_DEV
#######################################
#######################################
## BUILD KERNEL
https://wiki.gentoo.org/wiki/Ryzen#Kernel
https://wiki.gentoo.org/wiki/NVMe
# config tutorial
https://www.youtube.com/watch?v=NVWVHiLx1sU&pp=ygUabGludXgga2VybmVsIGNvbmZpZ3VyYXRpb24%3D
https://www.youtube.com/watch?v=T5SZERvLriA&pp=ygUabGludXgga2VybmVsIGNvbmZpZ3VyYXRpb24%3D
## Kernel drivers in use
lspci -k | grep "Kernel driver"
lsusb
lsusb -v -d 04f2:b6d0
lspci
lspci -v -s 07:00.5
## kernel modules installed
find /lib/modules/$(uname -r)/kernel/ -type f -name '*.ko*'
## upgrade kernel
make oldconfig
## build
make mrproper
#cp /home/n76310/Pictures/logo_linux_clut224.ppm ./drivers/video/logo/logo_linux_clut224.ppm
cp /usr/src/linux/logo_linux_clut224.ppm ./drivers/video/logo/logo_linux_clut224.ppm
cat /proc/config.gz | gunzip > .config
make -j16
make modules_install
version="6.4.12"
version="6.7.6"
version="6.8.6"
cp -iv arch/x86/boot/bzImage /boot/efi/EFI/NimGnu_testing/vmlinuz
cp -iv System.map /boot/efi/EFI/NimGnu_testing/System.map-$version
cp -iv .config /boot/efi/EFI/NimGnu_testing/config-$version
cp -r Documentation -T /usr/share/doc/linux-$version
version="6.8.6"
cp -iv arch/x86/boot/bzImage /boot/efi/EFI/NimGnu/vmlinuz
cp -iv System.map /boot/efi/EFI/NimGnu/System.map-$version
cp -iv .config /boot/efi/EFI/NimGnu/config-$version
cp -r Documentation -T /usr/share/doc/linux-$version
#######################################
## Arduino
# https://wiki.archlinux.org/title/Arduino#Installation
# https://arduino.github.io/arduino-cli/0.33/getting-started/
# You may need to load the cdc_acm module.
sudo usermod -a -G uuc $USER
sudo usermod -a -G dialout $USER
sudo usermod -a -G tty $USER
arduino-cli core update-index # update index
arduino-cli board search # search for board
arduino-cli core install esp32:esp32 # install board
arduino-cli core list # list installed cores
arduino-cli board list # list attached boards
# if using a 3rd party board, add to yaml file
#board_manager:
# additional_urls:
# - https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
arduino-cli compile --fqbn esp32:esp32:esp32c3 MyFirstSketch # compite sketch
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32c3 MyFirstSketch # upload sketch
#serial monitor
stty -F /dev/ttyACM0 cs8 9600 ignbrk -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
cat /dev/ttyACM0
# "AnalogWrite_ESP32" install lib for servo motor support
arduino-cli lib search debouncer # search library debouncer
arduino-cli lib install FTDebouncer # install librarY