Shell Utills and not only

Arch

                  -`
                 .o+`
                `ooo/
               `+oooo:
              `+oooooo:
              -+oooooo+:
            `/:-:++oooo+:
           `/++++/+++++++:
          `/++++++++++++++:
         `/+++ooooooooooooo/`
        ./ooosssso++osssssso+`
       .oossssso-````/ossssss+`
      -osssssso.      :ssssssso.
     :osssssss/        osssso+++.
    /ossssssss/        +ssssooo/-
   `/ossssso+/:-        -:/+osssso+-
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
.`                                 `

➕Package install

    $ sudo pacman -S package_name

✔️ System update

    $ sudo pacman -Syu

✖️ Remove package

    $ sudo pacman -R package_name

📋 List installed packages sorted by size

    $pacman -Qi | awk -F: '$1~/^Name / { name=$2 } $1~/^Installed Size / { gsub(/ /, ""); size=$2; print size, name }' | sort -hr | column -t | less

Debian

         _,met$$$gg.
      ,g$$$$$$$$P.
    ,g$P""       """Y$.".
   ,$P'              `$$. 
 ',$P       ,ggs.     `$b:
 `d$'     ,$P"'   .    $$
  $P      d


     ,    $P
  $:      $.   -    ,d$'
  $;      Y$b._   _,d$P'
  Y$.    `.`"Y$$P"' 
  `$b      "-.__
   `Y$b
    `Y$.
      `$b.
        `Y$b.
          `"Y$b._
              `""""

➕App install

    $ sudo apt install app_name

✖️ App remove

    $ sudo apt remove app_name

✔️ System update

    $ sudo apt update && sudo apt upgrade -y

Redhat

           .MMM..:MMMMMMM                
          MMMMMMMMMMMMMMMMMM             
          MMMMMMMMMMMMMMMMMMMM.          
         MMMMMMMMMMMMMMMMMMMMMM          
        ,MMMMMMMMMMMMMMMMMMMMMM:         
        MMMMMMMMMMMMMMMMMMMMMMMM         
  .MMMM'  MMMMMMMMMMMMMMMMMMMMMM         
 MMMMMM    \`MMMMMMMMMMMMMMMMMMMM.       
MMMMMMMM      MMMMMMMMMMMMMMMMMM .       
MMMMMMMMM.       \`MMMMMMMMMMMMM' MM.    
MMMMMMMMMMM.                     MMMM    
\`MMMMMMMMMMMMM.                 ,MMMMM. 
 \`MMMMMMMMMMMMMMMMM.          ,MMMMMMMM.
    MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM: 
         MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM  
            \`MMMMMMMMMMMMMMMMMMMMMMMM:  
                \`\`MMMMMMMMMMMMMMMMM'   

➕App install

    $ sudo yum/dnf install app_name

✖️ App remove

    $ sudo yum/dnf remove app_name

✔️ System update

    $ sudo yum update

    $ dnf upgrade --refresh

App .rpmfiles install, remove

    $ sudo rpm -i/r app_name.rpm

Arch and not only things

💽 HDD poweroff

    $ udisksctl power-off -b /dev/sdx

🌐 Network manager cli, wifi connect

    $ nmcli device wifi connect “SSID” password "xxxxx"

📁 Copy, move, remove files/folders

    $ cp, mv, rm filename
    $ rm -r folder

🖊️ Change name

    $ mv filename newfilename

📋 Ip adress check

    $ ip a

💿 Create qcow2 image

    $ qemu-img create -f qcow2 disk1.img 10G

📱 Mount android phone as storage (download android-file-tranfer)

    $ aft-mtp-mount /mnt

💿 Mount iso like dvd or cd disk

    $ mount -o loop /path/to/image.iso /media/mountpoint

🗝️ Show windows product key

    $ sudo strings /sys/firmware/acpi/tables/MSDM

🏁 Show startup times by system.d

    $ systemd-analyze

🔓 tar.zst extract

    $ tar -I zstd -xf

🔑 Password secured zip

    $ zip -er outputfolder.zip Folder-to-zip/

📁 Show folder/file size

    $ du -sh foldername

📀 Make bootable GNU/Linux drive ( dont use partition )

    $ dd bs=4M if=path/to/input.iso of=/dev/sdX conv=fdatasync status=progress

📀 Make bootable windows or GNU/Linux drive, also gui available

gui

    $ sudo woeusb -v --device /windows/iso/path /dev/sdx

❌Format partition to FAT32 file system

    $ mkfs.fat -F 32 /dev/sdXY

❌Format partition to NTFS file system (add -f flag to fast format)

    $ mkfs.ntfs /dev/sdXY

❌Format partition to ext4 file system

    $ mkfs.ext4 /dev/sdXY          

🧠 Display free and used memory

    $ free -m

📖 Display systemd last boot journal

    $ journalctl -b

💿 Create iso from cd/dvd

Check sector size and sector
    $ isosize -x /dev/sr0

Create iso
    $ dd if=/dev/sr0 of=discmage.iso bs=sector_size count=sector_count status=progress

🔗 Create symbolic link

    $ ln -s /path/to/folder /path/to/place/symbolic/link

📂 Display path of current directory

    $ pwd

✖️ ❕"Hardreset" format drives to zero

    $ dd if=/dev/zero of=/dev/sdX bs=16M status=progress

📱 Mount iPhone

Download

ifuse

from AUR

Start usbmuxd.service

    $ systemctl start usbmuxd.service

Pair iPhone (Device must be unlocked)

    $ idevicepair pair

Mount iPhone

    $ ifuse -o allow_other /mountpoint

Probably you have to change config in /etc/fuse.conf and uncomment #user_allow_other

Umount iPhone

    $ fusermount -u /mountpoint 

🎧 Bluetooth Headphones

Needed packages pulseaudio-bluetooth and bluez-utils.

Start bluetooth service

    $ systemctl start bluetooth.service

Open bluetooth utility

    $ bluetoothctl

Bluetooth utility

    [bluetooth]# power on
    [bluetooth]# agent on
    [bluetooth]# default-agent

Scan for devices
    [bluetooth]# scan on

Pair device
    [bluetooth]# pair XX:XX:XX:XX:XX (MAC)

Connect to paired device
    [bluetooth]# connect XX:XX:XX:XX:XX

For automatically connect
    [bluetooth]# trust XX:XX:XX:XX:XX

    [bluetooth]# scan off
    [bluetooth]# exit

To switch PulseAudio switch on connected module you need to add this lines to /etc/pulse/default.pa

    $ load-module module-switch-on-connect

Also if you want, enable auto power on bluetooth edit /etc/bluetooth/main.conf

    $ AutoEnable=true

🌐 Share internet over Ethernet

Install dnsmasq and nm-connection-editor

🌐 Share internet over Wi-Fi

Install dnsmasq and nm-connection-editor

🧡 Git

New

    $ git init
    $ git add
    $ git commit -m "commit message"
    $ git remote add origin git@github.com:username/new_repo.git
    $ git push origin master

Exist repo

    $ git add .
    $ git commit -m "commit message"
    $ git push origin master

Rename last no pushed commit

    $ git commit --amend -m "commit message"

Rename last pushed commit

    $ git commit --amend -m "commit message"
    $ git push --force origin master