TOC
chapter |
---|
OPTIONS |
ADD |
DEL |
System maintenance |
FIX |
UPDATE |
UPGRADE |
CACHE |
Querying information about packages |
INFO |
LIST |
SEARCH |
STATS |
DOT |
POLICY |
Repository maintenance |
INDEX |
FETCH |
VERIFY |
MANIFEST |
RC |
RC-STATUS |
RC-UPDATE |
RC-SERVICE |
OPTIONS
Global options
-h, --help # Show generic help or applet specific help
-p, --root DIR # Install packages to DIR
-X, --repository REPO # Use packages from REPO
-q, --quiet # Print less information
-v, --verbose # Print more information (can be doubled)
-i, --interactive # Ask confirmation for certain operations
-V, --version # Print program version and exit
-f, --force # Enable selected --force-* (deprecated)
--force-binary-stdout # Continue even if binary data is to be output
--force-broken-world # Continue even if 'world' cannot be satisfied
--force-non-repository # Continue even if packages may be lost on reboot
--force-old-apk # Continue even if packages use unsupported features
--force-overwrite # Overwrite files in other packages
--force-refresh # Do not use cached files (local or from proxy)
-U, --update-cache # Alias for --cache-max-age 1
--progress # Show a progress bar
--progress-fd FD # Write progress to fd
--no-progress # Disable progress bar even for TTYs
--purge # Delete also modified configuration files (pkg removal) and uninstalled packages from cache (cache clean)
--allow-untrusted # Install packages with untrusted signature or no signature
--wait TIME # Wait for TIME seconds to get an exclusive repository lock before failing
--keys-dir KEYSDIR # Override directory of trusted keys
--repositories-file # REPOFILE Override repositories file
--no-network # Do not use network (cache is still used)
--no-cache # Do not use any local cache path
--cache-dir CACHEDIR # Override cache directory
--cache-max-age AGE # Maximum AGE (in minutes) for index in cache before refresh
--arch ARCH # Use architecture with --root
--print-arch # Print default arch and exit
Commit options
-s, --simulate # Show what would be done without actually doing it
--clean-protected # Do not create .apk-new files in configuration dirs
--overlay-from-stdin # Read list of overlay files from stdin
--no-scripts # Do not execute any scripts
--no-commit-hooks # Skip pre/post hook scripts (but not other scripts)
--initramfs-diskless-boot # Enables options for diskless initramfs boot
ADD
Add PACKAGEs to 'world' and install (or upgrade) them, while ensuring that all dependencies are met
apk add [OPTIONS...] PACKAGE...
--initdb # Initialize database
-u, --upgrade # Prefer to upgrade package
-l, --latest # Select latest version of package (if it is not pinned), and print error if it cannot be installed due to other dependencies
-t, --virtual NAME # Instead of adding all the packages to 'world', create a new virtual package with the listed dependencies and add that to 'world'; the actions of the command are easily reverted by deleting the virtual package
examples
apk add $pkg=$version # install and fix package $pkg in version $version. ex: apk add bash=5.0.0-r0
apk add $pkg=~$major_version # install and fix package $pkg in major version $major_version. ex: apk add bash=~5.0
apk add $pkg=$version # install version $version of package $pkg & remove version holding. ex: apk add bash>5.0.0-r0
apk add --allow-untrusted $path/$pkg.apk # install untrusted package from file
DEL
Remove PACKAGEs from 'world' and uninstall them
apk del [OPTIONS...] PACKAGE...
-r, --rdepends # Recursively delete all top-level reverse dependencies too
FIX
Repair package or upgrade it without modifying main dependencies
apk fix [OPTIONS...] PACKAGE...
-d, --depends # Fix all dependencies too
-r, --reinstall # Reinstall the package (default)
-u, --upgrade # Prefer to upgrade package
-x, --xattr # Fix packages with broken xattrs
--directory-permissions # Reset all directory permissions
UPDATE
Update repository indexes from all remote repositories
apk update
UPGRADE
Upgrade currently installed packages to match repositories
apk fix [OPTIONS...]
-a, --available # Resets versioned world dependencies, and changes to prefer replacing or downgrading packages (instead of holding them) if the currently installed package is no longer available from any repository
-l, --latest # Select latest version of package (if it is not pinned), and print error if it cannot be installed due to other dependencies
--no-self-upgrade # Do not do early upgrade of 'apk-tools' package
--self-upgrade-only # Only do self-upgrade
CACHE
Download missing PACKAGEs to cache and/or delete unneeded files from cache
apk cache [OPTIONS...] sync | clean | download
-u, --upgrade # Prefer to upgrade package
-l, --latest # Select latest version of package (if it is not pinned), and print error if it cannot be installed due to other dependencies
examples
apk cache -v sync # clean cache & download missing packages
INFO
Give detailed information about PACKAGEs or repositories
apk info [OPTIONS...] PACKAGE...
-L, --contents # List contents of the PACKAGE
-e, --installed # Check if PACKAGE is installed
-W, --who-owns # Print the package owning the specified file
-R, --depends # List packages that the PACKAGE depends on
-P, --provides # List virtual packages provided by PACKAGE
-r, --rdepends # List all packages depending on PACKAGE
--replaces # List packages whom files PACKAGE might replace
-i, --install-if # List the PACKAGE's install_if rule
-I, --rinstall-if # List all packages having install_if referencing PACKAGE
-w, --webpage # Show URL for more information about PACKAGE
-s, --size # Show installed size of PACKAGE
-d, --description # Print description for PACKAGE
--license # Print license for PACKAGE
-t, --triggers # Print active triggers of PACKAGE
-a, --all # Print all information about PACKAGE
LIST
List packages by PATTERN and other criteria
apk list [OPTIONS...] PATTERN
-I, --installed # List installed packages only
-O, --orphaned # List orphaned packages only
-a, --available # List available packages only
-u, --upgradable # List upgradable packages only
-o, --origin # List packages by origin
-d, --depends # List packages by dependency
-P, --providers # List packages by provider
SEARCH
Search package by PATTERNs or by indexed dependencies
apk search [OPTIONS...] PATTERN
-a, --all # Show all package versions (instead of latest only)
-d, --description # Search package descriptions (implies -a)
-x, --exact # Require exact match (instead of substring match)
-e # Synonym for -x (deprecated)
-o, --origin # Print origin package name instead of the subpackage
-r, --rdepends # Print reverse dependencies of package
--has-origin # List packages that have the given origin
STATS
Show statistics about repositories and installations
apk stats
examples
apk stats # Show statistics about repositories and installations
DOT
Generate graphviz graphs
apk dot [OPTIONS...] PKGMASK...
--errors # Output only parts of the graph which are considered erroneous: e.g. cycles and missing packages
--installed # Consider only installed packages
POLICY
Show repository policy for packages
apk policy
INDEX
Create repository index file from FILEs
apk index [OPTIONS...] FILE...
-o, --output FILE # Write the generated index to FILE
-x, --index INDEX # Read INDEX to speed up new index creation by reusing the information from an old index
-d, --description TEXT # Embed TEXT as description and version information of the repository index
--rewrite-arch ARCH # Use ARCH as architecture for all packages
FETCH
Download PACKAGEs from global repositories to a local directory
apk fetch [OPTIONS...] PACKAGE...
-L, --link # Create hard links if possible
-R, --recursive # Fetch the PACKAGE and all its dependencies
--simulate # Show what would be done without actually doing it
-s, --stdout # Dump the .apk to stdout (incompatible with -o, -R, --progress)
-o, --output DIR # Directory to place the PACKAGEs to
VERIFY
Verify package integrity and signature
apk verify FILE...
MANIFEST
Show checksums of package contents
apk manifest PACKAGE...
RC-STATUS
run-level
- boot – Generally the only services you should add to the boot runlevel are those which deal with the mounting of filesystems, set the initial state of attached peripherals and logging. Hotplugged services are added to the boot runlevel by the system. All services in the boot and sysinit runlevels are automatically included in all other runlevels except for those listed here
- single – Stops all services except for those in the sysinit runlevel
- reboot – Changes to the shutdown runlevel and then reboots the host
- shutdown – Changes to the shutdown runlevel and then halts the host
- default – Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)
rc-status
rc-status # show services attached to actual run-level
rc-status boot # show services attached to run-level 'boot'
-l --list # Show list of run levels
-a --all # Show services from all run levels
-s --servicelist # Show service list
-m, --manual # show manually started services
-u, --unused # show services not assigned to any runlevel
-c, --crashed # show crashed services
-S, --supervised # show supervised services
RC-UPDATE
rc-update
rc-update show {run-level} # show services attached to a run-level
rc-update add {service} {run-level} # attach service to a run-level
rc-update del {service} {run-level} # dettach service to a run-level
rc
rc $runlevel # change run-level to $runlevel
RC-SERVICE
rc-service
rc-service {service} start # start service
rc-service {service} stop # stop service
rc-service {service} restart # restart service
-e, --exists <arg> # tests if the service exists or not
-c, --ifcrashed # if the service is crashed run the command
-i, --ifexists # if the service exists run the command
-I, --ifinactive # if the service is inactive run the command
-N, --ifnotstarted # if the service is not started run the command
-s, --ifstarted # if the service is started run the command
-S, --ifstopped # if the service is stopped run the command
-l, --list # list all available services
-r, --resolve <arg> # resolve the service name to an init script
-Z, --dry-run # dry run (show what would happen)
-q, --quiet # run quietly (repeat to suppress errors)
SSH
change identity of key in 'authorized_keys'
file="/root/.ssh/authorized_keys"
sudo sed '/manjaro@970g/ s|^.* \(ssh-.*\)$|\1|' $file
sudo systemctl restart sshd.service
APT SOURCES
add contrib to main backports
file="/etc/apt/sources.list"
sed -i '/backports/ s| main| main contrib|' $file
apt update
ZFS
install zfs
apt install zfs-dkms zfsutils-linux # install zfs tools
echo -e "# zfs utils\nzfs" >> /etc/modules
modprobe zfs # or reboot
lsmod | grep zfs # verify zfs module are correctly loaded
systemctl status zfs-* # verify all zfs services are correctkly started
format
fdisk $device # use 36 for FreeBSD type
https://wiki.manjaro.org/index.php?title=Pacman_Overview
https://wiki.archlinux.fr/pacman
https://community.chakralinux.org/t/how-to-use-pacman-to-search-for-install-upgrade-and-uninstall-packages
PACMAN CONF
all configurations for pacman are stored in:
/etc/pacman.conf
UPGRADE -U
yay -U /var/cache/pacman/pkg/python-3.9.3-1-x86_64.pkg.tar.zst # install a specific version
IGNORE
/etc/pacman.conf
sudo sed -i '/^#IgnorePkg/a IgnorePkg = libvirt' /etc/pacman.conf
sudo sed -i '/^#IgnorePkg/a Include = /etc/pacman.d/ignorepcks' /etc/pacman.conf
sudo sh -c "echo -e 'IgnorePkg = libvirt\nIgnorePkg = libvirt-python' > /etc/pacman.d/ignorepcks"
SYNC -S
pacman -Si $package # get informlation about package
pacman -Sl $repo # list all packages from repository
pacman -Sy # update local packages list
pacman -Syy # replace local packages list
pacman -Su # upgrade packages
pacman -Suu # upgrade & downgrade if needed
pacman -Syu # update & upgrade
pacman -Syyu
pacman -Syyuu
pacman -Syuc # update, upgrade, clean
pacman -S package # install package
pacman -S core/package_name # install a specified repo/core package
pacman -S plasma-{desktop,mediacenter,nm} # install tree name packages
pacman -Ss $regex # search packages
pacman -Ssq $regex # search packages with minimal print
pacman -S $pack... # install packages
pacman -S $repo/$pack # install package from specific repo
REMOVE -R
pacman -R $pack... # remove packages
pacman -Rs $pack... # remove packages and dependencies
pacman -Ru $pack... # remove unneeded packages
pacman -Qdt # list orphane packages
pacman -Rsn $(pacman -Qdtq) # remove orphan packages
QUERY -Q
pacman -Qqettn # List of Native installed packages
pacman -Qqettm # List of AUR installed packages
DOWNGRADE
pamac install downgrade # install downgrade
downgrade $package # interactive downgrade package
PACMAN-MIRRORS
pacman-mirrors --country-list # get list of countries for repositories
pacman-mirrors -c France # select a country for repositories
pacman-mirrors -i # generate an interactive mirrolist
pacman-mirrors -c all # reset custom mirrorlist
PACTREE
pactree package_name # list all the packages recursively depending on an installed package
pactree -r package_name # whoneeds package_name
AUR REPO & YAOURT
https://wiki.manjaro.org/index.php/D%C3%A9p%C3%B4t_AUR_%28Arch_User_Repository%29
POST-INSTALLATION
http://stephenmyall.com/manjaro/
https://dolys.fr/forums/topic/mon-installation-post-installation-manjaro/
AUDIO
For audio micro+headphone 08bb:2902
file=/lib/udev/rules.d/90-pulseaudio.rules
sudo cp -a ${file} ${file}.$(date +%s)
sudo sed -i '/08bb.*2902.*behringer-umc22/ s|^|#|' ${file}
LXD
cgroup v2 error messaging
file=/lib/udev/rules.d/90-pulseaudio.rules
part='systemd.unified_cgroup_hierarchy=0'
sudo cp -a ${file} ${file}.$(date +%s)
grep -q "^GRUB_CMDLINE_LINUX=.*${part}" ${file} || sudo sed -i '/^GRUB_CMDLINE_LINUX=/ s|"$| ${part}"|' ${file}
sudo update-grub
EFIVARFS
file=/etc/default/grub
part='efi=runtime'
sudo cp -a ${file} ${file}.$(date +%s)
grep -q "^GRUB_CMDLINE_LINUX=.*${part}" ${file} || sudo sed -i '/^GRUB_CMDLINE_LINUX=/ s|"$| ${part}"|' ${file}
sudo update-grub
&
file=/etc/mkinitcpio.conf
part='efivarfs'
sudo cp -a ${file} ${file}.$(date +%s)
grep -q "^MODULES=.*${part}" ${file} || sed -i '/^MODULES=/ s|)$| ${part})|' ${file}
sudo mkinitcpio -P
LOGIN-SCREEN
/etc/dconf/db/gdm.d/02-logo
[org/gnome/login-screen]
logo='/path/to/logo.png'
logo
gsettings set org.gnome.login-screen logo '/path/to/logo.png'
dconf # /org/gnome/login-screen/logo
https://wiki.archlinux.org/index.php/GDM
DEVICES
lsmod # show modules
lspci -k # show pci devices with used informations
inxi -Fxz # show details of device
VIDEO
inxi -G # show video informations
sudo mhwd -a pci nonfree 0300 # install non free driver
mhwd -li # show installed driver from mhwd
yay -S system-config-printer manjaro-printer
sudo usermod -a -G cups $USER
sudo gpasswd -a $USER sys
sudo systemctl enable --now org.cups.cupsd.service
RADIOTRAY
sudo ln -sv /usr/lib/libjsoncpp.so.24 /usr/lib/libjsoncpp.so.22
KVM QEMU Virt-Manager
https://computingforgeeks.com/install-kvm-qemu-virt-manager-arch-manjar/
GRUB COMMAND
press 'c' while launching to interrupt grub launching and entre in grub command
CHANGE GRUB DISPLAY RESOLUTION
vbeinfo # list available resolutions
modify in /etc/default/grub (ex: 800x600)
GRUB_GFXMODE=$resolution
CLEAR SECTOR 32
dd if=/dev/zero of=/dev/sda bs=512 count=1 seek=32
grub-install $device
USB3 MSI GAMING
add in /etc/default/grub
GRUB_CMDLINE_LINUX="iommu=soft"
LXD
/etc/default/grub
GRUB_CMDLINE_LINUX="... systemd.unified_cgroup_hierarchy=0
GRUB_TIMEOUT
Modify set timeout for choosed value in /boot/grub/grub.cfg
if [ "$recordfail_broken" = 1 ]; then
cat << EOF
if [ \$grub_platform = efi ]; then
set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
if [ x\$feature_timeout_style = xy ] ; then
set timeout_style=menu
fi
fi
EOF
fi
MANJARO
OS real name for btrfs
file="/etc/grub.d/30_os-prober"
file_keep="$file.keep$(date +%s)"
if ! grep -q 'LONGNAME="${LONGNAME} ${BTRFSsubvol/#subvol=/}"' "$file"; then
sudo cp -a "$file" "$file.keep$(date +%s)" && sudo chmod -x "$file_keep"
sudo sed -i "/LONGNAME=\"\${LABEL}\"/ a\ else\n LONGNAME=\"\${LONGNAME} \${BTRFSsubvol/#subvol=/}\"" "$file"
sudo update-grub
fi
UBUNTU 18.04
Remove error in startup log : systemd-backlight@backlight:acpi_video0.service, add in /etc/default/grub
acpi_osi='!Windows 2012'
acpi_backlight=vendor in GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub
BOOT ENTRY
https://linux.die.net/man/8/efibootmgr
efibootmgr
efibootmgr # list all boot entries
-v # list all boot entries with details
-B -b XXXX # delete boot entry number XXXX
example for 970g
efibootmgr -c -g -d /dev/sda1 -p 1 -w -L 'Manjaro' -l '\EFI\Manjaro\grubx64.efi'
efibootmgr -c -g -d /dev/sda1 -p 1 -w -L 'ubuntu' -l '\EFI\ubuntu\shimx64.efi'
efibootmgr -c -g -d /dev/sda1 -p 1 -w -L 'Windows Boot Manager' -l '\EFI\Microsoft/Boot\bootmgfw.efi'
>>
Timeout: 1 seconds
BootOrder: 0000,0001,0002
Boot0000* Manjaro HD(1,GPT,8e91a305-046d-4e90-8548-efca286325a7,0x800,0x32000)/File(\EFI\Manjaro\grubx64.efi)
Boot0001* ubuntu HD(1,GPT,8e91a305-046d-4e90-8548-efca286325a7,0x800,0x32000)/File(\EFI\ubuntu\shimx64.efi)
Boot0002* Windows Boot Manager HD(1,GPT,8e91a305-046d-4e90-8548-efca286325a7,0x800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)
256colors for nested tmux
20.04
export TERM=xterm-256color
turn off/disable bluetooth device startup
18.04
grep -n DEVICES_TO_DISABLE_ON_STARTUP /etc/default/tlp
auto login
sudo sh -c "echo '
# autologin
[Seat:*]
autologin-session=xubuntu
autologin-user=${USER}
autologin-user-timeout=0' >> /etc/lightdm/lightdm.conf
GENERAL
user
modify user
mv /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.keep # xubuntu autologin
# reboot / alt+f1 -> root
old=virt
new=foralyse
usermod -l $new $old -d /home/$new -m
#usermod -d /home/$new -m $new
#mv /home/$old /home/$new
groupmod -n $new $old
sed -i "/^$new/ s|$old|$new|" /etc/passwd
sed -i "/^$old/ s|$old|$new|" /etc/subuid
sed -i "/^$old/ s|$old|$new|" /etc/subgid
sed -i "s|/$old/|/$new/|" /home/$new/.config/gtk*/bookmarks
mv /etc/lightdm/lightdm.conf.keep /etc/lightdm/lightdm.conf # xubuntu autologin
sed -i "s|$old|$new|" /etc/lightdm/lightdm.conf # xubuntu autologin
grep $old /etc -r
reboot
color
echo $LS_COLORS # ls colors
~/.dir_colors # file define ls colors
gnome-terminal
Gnome-terminal: unbind F1 & F10, edit preferences
- prefertences tab : unselect F10
- shorcut tab : in last unselect F1
Launch fews tabs with command
gnome-terminal --tab --tab -e 'ssh-connect ns398616' --tab -e 'ssh-connect ns398616'
autostart
~/.config/autostart # home path
/etc/xdg/autostart # system path
sudo sed -i 's|^\(X-GNOME-Autostart-enabled=\).*$|\1false|' $path.desktop # desactivate system autostart
UPDATE-ALTERNATIVES
update-alternatives creates, removes, maintains and displays information about the symbolic links comprising the Debian alternatives system
update-alternatives [<option> ...] <command>
--get-selections # get all configuration
--display $NAME # display information about $NAME group
--install $LINK $NAME $PATH $PRIORITY # add an altyernative for a group
--config $NAME # define the alternative for a group by chosing defined alternatives
--set $NAME $PATH # set alternative $NAME for a group $PATH
example for sublime:
update-alternatives --get-selections
update-alternatives --display gnome-text-editor
sudo update-alternatives --install /usr/bin/gnome-text-editor gnome-text-editor /usr/bin/sublime-text 100
update-alternatives --display gnome-text-editor
sudo update-alternatives --config gnome-text-editor
MIME type
https://help.ubuntu.com/community/AddingMimeTypes
player
aplay / arecord
sound player & recorder for alsa soundcard driver
paplay
play sound from pulseaudio-utils
DPKG
package manager for Debian
dpkg [option...] action
-i # Installs a Debian package file
-c # Lists the contents of
-I # Extracts package information
-r # Removes an installed package
-P # Removes & Purges an installed package named
-L # Gives a listing of all the files installed by
-s # Shows information on the installed package
-S # Return package names & files find in package database
--get-selections # Get the current status of
example
echo `` hold'' | dpkg --set-selections # Put on hold
DPKG-RECONFIGURE
dpkg-reconfigure # Reconfigures an installed package (see -f --frontend options)
APT
add repository
apt-add-repository ppa:lubuntu-desktop/ppa
add-apt-repository 'deb http://extras.ubuntu.com/ubuntu quantal main'
add-apt-repository 'deb-src http://extras.ubuntu.com/ubuntu quantal main'
apt-get install $pkg # Install packages
apt-get source $pkg # Get source code of installed & cached package
apt-get remove $pkg # Remove packages
apt-cache depends $pkg # Find dependencies of a packages
apt-cache search $pkg # Search in names of packages
apt-cache show $pkg # Shows description of availables packages & versions
apt-cache showpkg $pkg # Shows full description of packages
apt-cache policy $pkg # Shows source url repository of packages
apt-cache madison $pkg # Shows all available versions of packages
APT-MARK
apt-mark auto $pkg # Mark the given packages as automatically installed
apt-mark manual $pkg # Mark the given packages as manually installed
apt-mark hold $pkg # Mark a package as held back
apt-mark unhold $pkg # Unset a package set as held back
apt-mark showauto $pkg # Print the list of automatically installed packages
apt-mark showmanual $pkg # Print the list of manually installed packages
apt-mark showhold $pkg # Print the list of package on hold
example
apt-mark hold php7.4* # hold install & update for all packages started with 'php7.4'
APT-FILE
apt-get install apt-file && apt-file update # install & update files
apt-file search paplay # search which packages contains 'paplay'
BACKPORTS
apt-get install -t trusty-backports $PACKAGE # use backports to install package