Compare commits

...

7 Commits

Author SHA1 Message Date
Luiza 09eb92df1d feat:dodaj opis narzędzia dstat 2 years ago
Luiza fb3e0217d3 fix: information about wallpaper 2 years ago
Luiza 042336131a feat:add log location for apt 2 years ago
Luiza 0067a887b9 fix[Linux]:add information about splitting display to 4 parts. 2 years ago
Luiza da42336446 fix[Linux]:add information about desktop background changer 2 years ago
Luiza 7f465943e3 fix[Linux]:remove obsolete, old parts 2 years ago
Luiza 5a80ca3e2b Add 'Linux.adoc' 2 years ago
  1. 668
      Linux.adoc

668
Linux.adoc

@ -0,0 +1,668 @@ @@ -0,0 +1,668 @@
= Linux at Roche
Luiza Kuźma <luiza.kuzma@roche.com>
:icons: font
:toc:
== Dell XPS 13
=== Others
jetbrains@ -> 3x (keyring)
keyring -> 3x (keyring)
wallet4kde -> 3x -> kde 4x
==== GitLab
https://docs.gitlab.com/ee/ssh/
* nie używaj hasła do certyfikatu bo będzie się Ciebie pytał po 3x przy każdym pushu....
----
cd
cd ./ssh
ssh-keygen -t ed25519 -C "<comment>"
ssh-keygen -t ed25519 -C "Dell_on_Gitlab"
----
== New Installation
* Copy
** your notes
** your pictures and folders
** bash history
** bookmarks!!!
** gvimrc
** snap list
** apt list
=== GNOME (ubuntu) 22
==== Programming installations
* Flyway 6.5.5
** https://code.roche.com/pdil/snowflake/snowflake/-/package_files/167350/download[Roche repo for Flyway]
** sudo cp -r flyway /usr/local/bin/flyway_6_5_5
** sudo ln -s /usr/local/bin/flyway_6_5_5/flyway /usr/local/bin/flyway
==== System Installations
* apt update
* apt upgrade
* IntelliJ
** Toolbox:
*** sudo tar -xzf jetbrains-toolbox-1.21.9712.tar.gz -C /opt
* openJDK 11
** sudo apt install default-jre
** sudo apt install default-jdk
** szukanie lokalizacji JDK
*** /usr/lib/jvm/java-11-openjdk-amd64
*** sudo update-alternatives --config java
*** Problem: IntelliJ nie bierze tego jdk - bierze z katalogu: default....
* Extensions - rozszerzenia gnome
** gnome-shell
*** sudo apt gnome-shell
** gnome-shell-extension
*** sudo apt install gnome-shell-extensions
** gnome-shell-extension-manager
*** sudo apt install gnome-shell-extenstion-manager
* pulpity
** sudo apt install gnome-tweaks
** pulpit dzielony na 4 -> extension do "gnome-tweaks"
*** sudo apt install gnome-shell-extensions
* Now you will need to restart the Gnome shell.
** Hit Alt+F2 keyboard shortcut and then type r and hit Enter to do so.
* Changing brightness in screen: XPS 9300 Ubuntu & Adaptive Brightness changing all the time
** I have a XPS 13 9300 shipped with Ubuntu 18.04 by Dell. The adaptive brightness can be disabled from:
*** Settings => Power => Automatic brightness
* to Make Your Photos as Wallpaper Slideshow in Ubuntu 22.04
** Wallpaper Changer Continued (former: Wallpaper Changer Extension but it is unsupported now)
** https://github.com/Ghostkeeper/gnome-wallpaper-changer
*** run "Extensions" -> Wallpaper Changer Continued -> Settings
*** the original path leads to: /usr/share/backgrounds/gnome
** sudo apt install chrome-gnome-shell
* Install "Extension Manager" from application installer (blue jigsaw)
* Podzał ekranu na 4: Quarter windows from installer
** * W Extension Manager wyszukaj Qaurter Windows i zainstaluj
* Michał Kalinowski Terminal: guake
https://overflow.roche.com/t/i-cannot-connect-to-wifi-on-my-dell-xps-9310-what-should-i-do/6739
* dstat
** połączenie: netstat, disc i paru innych "stat"
==== Multiple workspaces with many monitors
sudo apt install gnome-tweaks
* przełączanie
** Super + Pg Up / Pg Down
** OR
** Ctrl + Alt + Arrow Up / Arrow Down
* przenoszenie okna między workspace'ami
** Super + Schift + Page Up/Down
==== Podzał ekranu na 4 - opcje: winTile, gTile, ShellTile,
** WinTile
*** Super + strzałka (to przy podziale na 4 -> jak pod Windows)
*** icon:minus[] nie działa dla Ubuntu 22
** ShellTile
*** icon:minus[] nie działa dla Ubuntu 22
** Ubuntu 22
*** Tiling Assistant (GitHub)
**** https://askubuntu.com/questions/1460962/view-split-on-top-bottom-in-ubuntu-22-04[Instruction]
*** Quater Windows
*** Tactile
**** https://fostips.com/two-more-apps-side-by-side-ubuntu-22-04/[]
===== Quater Windows
https://github.com/troyready/quarterwindows[Shortcuts]
Overview
This extension adds shortcuts for window management.
Shortcuts
Move window to upper right ("northeast") corner: Ctrl + Win + i
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-corner-ne "['<Primary><Super>i']"
Move window to upper left ("northwest") corner: Ctrl + Win + u
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-corner-nw "['<Primary><Super>u']"
Move window to lower right ("southeast") corner: Ctrl + Win + k
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-corner-se "['<Primary><Super>k']"
Move window to lower left ("southwest") corner: Ctrl + Win + j
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-corner-sw "['<Primary><Super>j']"
Move window to upper half: Ctrl + Win + UpArrow
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-half-n "['<Primary><Super>Up']"
Move window to bottom half: Ctrl + Win + DownArrow
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-half-s "['<Primary><Super>Down']"
Move window to right half: Ctrl + Win + RightArrow
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-half-e "['<Primary><Super>Right']"
Move window to left half: Ctrl + Win + LeftArrow
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/put-to-half-w "['<Primary><Super>Left']"
Move window focus to the left ("west"): Shift + Win + h
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/move-focus-w "['<Shift><Super>h']"
Move window focus down ("south"): Shift + Win + j
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/move-focus-s "['<Shift><Super>j']"
Move window focus up ("north"): Shift + Win + k
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/move-focus-n "['<Shift><Super>k']"
Move window focus to the right ("east"): Shift + Win + l
Can be customized via: dconf write /org/gnome/shell/extensions/com-troyready-quarterwindows/move-focus-w "['<Shift><Super>l']"
Determining Shortcut Keys
An easy way to determine custom shortcut key values is to:
Watch for dconf changes by opening a terminal and running dconf watch /
Set a temporary custom GNOME shortcut (Settings -> Keyboard -> View and Customize Shortcuts -> Custom Shortcuts)
The dconf command will display the chosen shortcut keys. Delete the shortcut and use the displayed shortcut in the above customization commands.
=== GNOME (ubuntu) 20 - Problems on Dell
* WiFi + blutooth
** https://overflow.roche.com/t/i-cannot-connect-to-wifi-on-my-dell-xps-9310-what-should-i-do/6739/7
*** git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
*** sudo cp -r linux-firmware/ath11k /lib/firmware/
===== External Display is not visible
* gnome does not see external display
* trying to fix it
** sudo apt-get install kubuntu-desktop
** it didn't help
*** on my home computer I have KDE as a windows and external screen works with HP computer (also Ubuntu 20th)
* idea to check
** in the office with the external screen
===== No visible Blutooth
* at least in gnome
** and little ports to use
==== gnome-shell
* gnome-shell --version
* install extension manually from zip
** e.g. wintile
*** przykład na innym extension:
**** https://linuxconfig.org/install-gnome-shell-extensions-from-zip-file-using-command-line-on-ubuntu-20-04-linux
*** unzip -C wintilenowsci.com.v7.shell-extension.zip metadata.json | grep uuid | cut -d \" -f4 wintile@nowsci.com
*** mkdir -p ~/.local/share/gnome-shell/extensions/wintile@nowsci.com
*** unzip -q wintilenowsci.com.v7.shell-extension.zip -d ~/.local/share/gnome-shell/extensions/wintile@nowsci.com
*** gnome-extensions enable wintile@nowsci.com
*** In order for the changes to take effect, you’ll need to restart the GNOME shell. The quickest way of doing so is:
**** to press Alt+F2 on your keyboard, type r, and then press enter.
===== Paint pod Gnome
* pod gnome za maleńkie ikonki (i nie dało się tego poprawić)
** Pinta
** xpaint
** KolourPaint
* pod gnome działały (ikony do rozczytania) ale trudne i skomplikowane programy:
** Krita
** MyPaint
* rozwiązanie
** kUbuntu Plasma <=> KDE - KolourPaint ma normalne ikony
=== KDE - Ubuntu 20
* nie działał ekran startowy - doinstalowywałam
* języki - tutaj uwaga:
** System Settings -> Regional Settings
*** Language - MUSI zostać angielski inaczej CAŁY SYSTEM linux będzie po polsku
*** Formats
**** Region: Polska - ustawienia w KDE i komunikaty systemowe są po polsku
**** Region: MUSI zostać angielski inaczej CAŁY SYSTEM linux będzie po polsku
**** Detailded Settings: Jednakże ustawienia szczegółowe można przestawić na "Polska", nie wpływają na język systemu
***** Numbers, Time, Currency, Measurement Units, Collation and Sorting
* wylogowywanie przez Ctrl+Alt+Del
** Global Shortcuts
* dodanie sztywnych wirtualnych desktopów
** System Settings -> Virtual Desktops (moża podpisać i uzgodnić ułożenie - czy rząd czy tablica)
* gVim - doinstalowałam
** etc/vim/gvimrc
*** colorscheme desert
*** colorscheme slate
*** colorscheme torte
** these settings seems to be not necessary under Linux
*** set langmenu=en_US
*** set nocompatible
*** set nu
*** set guifont=Monospace:h13
* Zegar na pasku
** Event Calendar widget - skonfigurowany pode mnie
** wygląda dobrze tylko jeśli taskbar jest u dołu
* Restore previous session - jest domyślny w KDE
* System Settings -> Screen Edges
** aka hot corners
** podłączanie różnych przydatnych zachowań pod "gorące punkty"
** można też dodać dzielenie ekranu na 4 ale to działa nie dla "ekranu" ale dla całego workspace
* podział ekranu na 4 w rogach
** Global Shortcuts -> kWin użycie i podpięcie pod akcje skrótów (te się sprawdzają i są intuicyjne - z Windows???)
*** Quick Tile Window to the Bottom Left : Meta+Ctrl+Left
*** Quick Tile Window to the Bottom Right : Meta+Ctrl+Down
*** Quick Tile Window to the Top Left : Meta+Ctrl+Up
*** Quick Tile Window to the Top Right : Meta+Ctrl+Right
* inny sposób prezentacji menu
** oryginalnie jest: Application Launcher
** doinstaluj Widget: Applicatin Dashboard przypięty do taskbara
*** Application Dashboard <=> A fullscreen application launcher
* Mouse Whell - Scroll desktop (on desktop)
** you can redefine or remove this action in
*** Right click on desktop -> Configure Desktop -> Mouse Actions -> Vertical-Scroll -> minus button on the right
* Przemieszczanie okien między desktopami
** System Settings -> Workspace Behavior -> Screen Edges -> Switch desktop on edge: Only When Moving Windows
=== Java Developer
==== Błędy w IntelliJ z opisem
* po zainstalowaniu java + mvn przez sudo apt
** openJDK 11
*** sudo apt install default-jre
*** sudo apt install default-jdk
*** szukanie lokalizacji JDK
**** /usr/lib/jvm/java-11-openjdk-amd64
**** sudo update-alternatives --config java
***** możesz wybrać interakcyjnie wersję javy
**** Problem: IntelliJ nie bierze tego jdk - bierze z katalogu: default....
Czerwone w konsoli
----
/usr/lib/jvm/default-java/bin/java -Dmaven.multiModuleProjectDirectory=/home/users/kuzmal/IdeaProjects/roche-oauth2-spring -Dmaven.home=/usr/share/maven -Dclassworlds.conf=/usr/share/maven/bin/m2.conf -Dmaven.ext.class.path=/home/users/kuzmal/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/212.5457.46/plugins/maven/lib/maven-event-listener.jar -javaagent:/home/users/kuzmal/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/212.5457.46/lib/idea_rt.jar=46707:/home/users/kuzmal/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/212.5457.46/bin -Dfile.encoding=UTF-8 -classpath /usr/share/maven/boot/plexus-classworlds-2.x.jar org.codehaus.classworlds.Launcher -Didea.version=2021.2.3 clean
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
----
https://github.com/google/guice/issues/1216
@alan-hwp are you using Ubuntu's custom distribution of Maven? The official Maven distribution uses the "no-AOP" build of Guice which doesn't contain any CGLIB code. If you download an official distribution from https://maven.apache.org/ then you shouldn't see the warning.
==== Reinstalacja mavena
* Skonfiguruj java
** https://help.ubuntu.com/community/EnvironmentVariables
*** /etc/profile.d -> java-maven.sh
**** export JAVA_HOME=/usr/lib/jvm/default-java
**** export PATH=$PATH:$JAVA_HOME/bin
* Skonfiguruj maven
** https://maven.apache.org/install.html
** https://www.rosehosting.com/blog/how-to-install-apache-maven-on-ubuntu-20-04/
** ja umieściłam maven tam gdzie java: /usr/lib/jvm
*** i dodałam do /etc/profile.d -> java-maven.sh
**** export M2_HOME=/usr/lib/jvm/apache-maven-3.8.4
**** export MAVEN_HOME=/usr/lib/jvm/apache-maven-3.8.4
**** export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
Ostatecznie plik java-maven.sh wygląda
----
export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/usr/lib/jvm/apache-maven-3.8.4
export MAVEN_HOME=/usr/lib/jvm/apache-maven-3.8.4
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
----
* sudo chmod +x java-maven.sh
* wykonaj ten plik przez:
** source java-maven.sh
== Problems
=== Unblocking screen-saver or hanging log-in console
* it was displayed during the screen-saver collapsed
* "The screen locker is broken and unlocking is not possible anymore. In order to unlock"
** switch to a virtual terminal (e.g. Ctrl+Alt+F2)
** log in
** execute the command:
*** loginctl unlock-session 3
** switch back to the running session
*** Ctrl+Alt+F1
== Tools
=== Screen recorders
* simplescreenrecorder - czerwone rogi a w środku czerwona kropka
** nie łapie dźwięku z youtube - przypuszczam, że i ze spotkania
* vokoscreenNG
** albo rwie dźwięk
** albo ekran nieruchomo
** trudno wymusić mikrofon
=== Installers
* gem
** asciidoctor-diagram
** asciidoctor-pdf
* apt
* snap
=== Ciekawe - do rozważenia
* Zajętość dysku, rozmiary katalogów, wieloplatformowe, wizualne obrazowanie
** https://www.linuxlinks.com/k4dirstat/[K4DirStat]
=== Paint alternatives
* do sprawdzenia
** mtpaint
** Pinta
** xpaint
** KolourPaint
*** taki sobi
* trudne programy (działały też pod gnome - ikony do rozczytania):
** Krita
** MyPaint
** ale oba nie biorą prosto ze schowka
=== Doublecmd
sudo apt-get install doublecmd-gtk
=== ImageMagic - ubuntu picture conversions
* Carefully!!! - resize with keep aspect ratio - icon:exclamation-triangle[] but it substitute pictures
** do it on YOUR COPIES of pictures
** it does for ALL picture in the directory
# 4k
mogrify -resize '1920x1080^' *.JPG
# FullHD
mogrify -resize '1920x1080^' *.JPG
=== Profiles
==== Create env variables
----
# Global env variables
/etc/profile
/etc/profile.d -> put your own file
# Local env variables
/home/.../.profile -> or .bash_profile or .bash_login
----
https://www.baeldung.com/linux/environment-variables[Env variables]
With Bash, we declare global variables in /etc/profile. But, we recommend declaring them in their own script files and putting those in /etc/profile.d. Bash will automatically pick these up.
Global variables affect all users in the system. Each user can create a set of “global” environment variables for their own by creating ~/.profile in their home directory.
==== Load profile
source .profile
== System
=== Log location
* for apt
** sudo cat /var/log/apt/term.log | more
** sudo cat /var/log/apt/history.log | more
=== User Commands Installation
* Check flyway in Dell
== Commands
=== Counting string appearance
==== json
* directly in Postman
* vi counts only till 99 (so e.g. 7844 will not display, sth like this: >99)
* use with wc, wc -l -> counts number of lines
----
# counting the number of attributes on the given level
jq '.item | length' 2023_05_12_Substance_PROD_Active_and_Deleted.json
jq '.item[].hubStateInd' 2023_05_12_Substance_PROD_Active_and_Deleted_and_Pending.json | wc -l
----
----
grep -o -i hubStateInd\"\:1 2023_05_12_Substance_PROD_Active_and_Deleted_and_Pending.json | wc -l
----
* jq is more about structure of json
----
jq '.item[] | .hubStateInd' '2023_05_12_Substance_PROD_Active_and_Deleted_and_Pending.json' | wc -l
jq '.item[].hubStateInd' 2023_05_12_Substance_PROD_Active_and_Deleted_and_Pending.json | wc -l
----
* jq select element with hubStateInd=-1
----
jq '.item[] | select (.hubStateInd==-1)' 2023_05_12_Substance_PROD_Active_and_Deleted_and_Pending.json
----
* count all elements, which have on the 1st level of a table hubStateInd=1 or -1 (to avoid counting children)
----
jq '.item[] | select (.hubStateInd==-1)' 2023_05_12_Substance_PROD_Active_and_Deleted_and_Pending.json | jq '.hubStateInd' | wc -l
212
jq '.item[] | select (.hubStateInd==1)' 2023_05_12_Substance_PROD_Active_and_Deleted_and_Pending.json | jq '.hubStateInd' | wc -l
7787
----
* https://stedolan.github.io/jq/[jq documentation]
* https://gist.github.com/barbietunnie/e694d8a8b3f5fd895829e44e7b2c42eb[jq Tips]
=== Useful commands
* whereis
* Environment variables
** printenv
* port in use
** sudo lsof -i:22
** sudo lsof -i:8443
** https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/
=== Find / Grep
==== Sum-up of useful find:
[source,shell]
----
find . -type f -name *Mongo*
find / -name rlcaas-roche-luks-key-changer 2>/dev/null
find ./ -type f -name *.adoc -exec grep --include=\*.adoc -ilnw "Applause" {} \;
----
==== Description of problems
https://stackoverflow.com/questions/22552538/grep-warning-recursive-directory-loop[Problem and solution description]
grep --include=\*.adoc -irnw "devcopse" /
[source,log]
----
grep: warning: ./svn/pages/india/xhtml/abcd/dvorak/testing/ocean/monday: recursive directory loop
----
You have to exclude symbolic links from your grep, they are reason of this warning. You should try to use find firstly:
find ./ -type f -exec grep -il "blah_blah_text" {} \;
When you use find firstly you can omit -r in grep, because find is already recursive.
find ./ -type f -exec grep --include=\*.adoc -ilnw "security" {} \;
=== Grep
* https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux[grep]
** redirect warnings/errors to null:
*** 2>/dev/null
[source,shell]
----
grep --include=\*.adoc -irnw "devcopse" /home/users/kuzmal
fgrep --include=\*.adoc -irnw "security" /home/users/kuzmal
# with 2>/dev/null
grep --include=\*.adoc -irnw "devcopse" /home/users/kuzmal 2>/dev/null
fgrep --include=\*.adoc -irnw "security" /home/users/kuzmal 2>/dev/null
----
=== History
* history
* history | grep env
* !760 - execute command no 760
* history -d <line number> - remove command <line number> from history (e.g. sensitive data)
=== Info about user / profile /system
[source,bash]
----
cat << EOF
* Username: "${USER}"
* Hostname: "${HOST}"
* Site: $(grep 'site=' /etc/rlc-systeminfo | cut -d ' ' -f2)
* OS Version: (`cat /etc/os-release`)
* Kernel Version: (`uname -a`)
EOF
----
=== Od Tomasza Marciniaka
==== Ctrl+C, Ctrl+V
stty -a
stty intr ^J
==== Pictures - exiftool
exiftool img1.jpg
exiftool -all= img1.jpg
==== Pictures - ImageMagick
convert -resize 25% img1.jpg img2.jpg
identify -verbose m.jpg
==== Video
ffmpeg -i infile -vf "scale=iw/2:ih/2" outfile
ffmpeg -i infile -vf "scale=iw/2:ih/2" -b:v 150k outfile
ffmpeg -i infile -vf "scale=iw/4:ih/4" -b:v 140k -b:a 64k outfile
==== Memory
free -g / free -m
top -o %MEM
top -> f -> up/down -> s -> q (sort by something)
top -> e/E (units)
==== X
xdg-open https://github.com
xsel
==== pdf
pdfunite *.pdf 2018.pdf
==== TTS - festival
apt install festival festvox-en1 festvox-us1 festvox-us2 festvox-us3 festvox-us-slt-hts festvox-kdlpc16k
echo "Hello world" | festival --tts
echo '(SayText "Hello World")' | festival --pipe
festival --tts my-text.txt
stty intr ^C (go back to default ctrl+c handling, without this festival doesn't work properly)
festival
help
(voice.list)
(tts "text.txt" nil)
(voice_en1_mbrola)
(voice_cmu_us_slt_arctic_hts)
==== TTS - espeak-ng
apt install espeak-ng
espeak-ng --voices=en
espeak-ng -s 150 -f text.txt
espeak-ng -s 140 -f text.txt -v us-mbrola-1
espeak-ng "Hello world"
echo "Hello world" | espeak-ng
==== TTS - pico
apt install libttspico-utils
pico2wave -w a.wav "Hello world"
aplay a.wav
cat text.txt | pico2wave -w a.wav
aplay a.wav
=== Linux <R> servers
sudo /home/adm/bin/suroot
==== ssh
* .ssh
** cat/more id_rsa.pub
----
ssh xx@server
----
== Kubernetes
=== virtualbox-7.0
* Configuring Secure Boot
** 4Secure2Boot!
Loading…
Cancel
Save