initial
This commit is contained in:
commit
74ae93a96e
57 changed files with 94691 additions and 0 deletions
|
|
@ -0,0 +1,242 @@
|
|||
Arch Installation in usb flash drive
|
||||
|
||||
Arch Installation for a removable USB flash drive:
|
||||
|
||||
|
||||
-> Installing on a 64-bit UEFI non-CSM system.
|
||||
-> using GPT partition style.
|
||||
|
||||
Requirements:
|
||||
|
||||
-> A USB flash drive with bootable arch linux installation media.
|
||||
-> Another USB where linux is going to be installed, recommended size: 32 GB.
|
||||
-> A desktop computer or laptop for installing arch which supports UEFI.
|
||||
|
||||
Pre-Installation:
|
||||
|
||||
1. Insert both of the USB flash drive.
|
||||
2. Boot from the USB with the arch installation media.
|
||||
|
||||
Follow along in the next unit for installing arch on the USB flash drive.
|
||||
|
||||
Installation:
|
||||
|
||||
1. Connect to the internet either by ethernet or wifi.
|
||||
|
||||
-> For wifi, use the iwctl utility.
|
||||
-> Open it using the 'iwctl' command.
|
||||
|
||||
root@archiso~# iwctl
|
||||
|
||||
-> inside it, get the list of all the network devices using the following command.
|
||||
|
||||
[iwd]# device list
|
||||
|
||||
-> Use the wireless adapter to get scan and get a list of all the available networks.
|
||||
|
||||
[iwd]# station <device> scan
|
||||
[iwd]# station <device> get-networks
|
||||
|
||||
-> Connecting to the wireless network.
|
||||
|
||||
[iwd]# station <device> connect <netowrk_name>
|
||||
|
||||
-> Enter the passphrase and check for connectivity using the following.
|
||||
|
||||
[iwd]# station <device> show
|
||||
|
||||
-> if connected, use the 'exit' command to exit the utility.
|
||||
|
||||
2. Check you internet connectivity using the following.
|
||||
|
||||
root@archiso~# ping <URL>
|
||||
|
||||
3. Update the system clock.
|
||||
|
||||
root@archiso~# timedatectl set-ntp true
|
||||
|
||||
4. List all the disks.
|
||||
|
||||
root@archiso~# lsblk
|
||||
|
||||
-> disks are in the format of /dev/sd<x>.
|
||||
-> Here, recognise the USB drive disk where arch has to be installed.
|
||||
|
||||
5. Partition the disks.
|
||||
|
||||
-> Use the gdisk/ fdisk/ cfdisk command for partitioning the disk.
|
||||
eg. gdisk /dev/sd<x>
|
||||
|
||||
-> In this tutorial, I am using 3 partitions for the Linux EFI system, swap and the root.
|
||||
-> Here, <x> denotes the disk letter.
|
||||
|
||||
-> Recommended sizes for partitions:
|
||||
|
||||
(i) /dev/sd<x>1 -> EFI Partition: 550M
|
||||
(ii) /dev/sd<x>2 -> Swap Partition: 2G
|
||||
(iii) /dev/sd<x>3 -> Root partition: Any of the left space.
|
||||
|
||||
6. Format the disks.
|
||||
|
||||
-> Format the disks using the following commands.
|
||||
-> Taking into conideration that the number of paritions is 3 and same as of the above.
|
||||
|
||||
-> Formating the EFI partition.
|
||||
root@archiso~# mkfs.fat -F32 /dev/sd<x>1
|
||||
|
||||
-> Formating the swap partition.
|
||||
root@archiso~# mkswap /dev/sd<x>2
|
||||
|
||||
-> Formatting the root partition.
|
||||
-> Turning off Journaling.
|
||||
root@archiso~# mkfs.ext4 -o "^has_journal" /dev/sd<x>3
|
||||
|
||||
7. Mounting the partitions.
|
||||
|
||||
-> Mounting swap partition.
|
||||
root@archiso~# swapon /dev/sda2
|
||||
|
||||
-> Mounting the root partition.
|
||||
root@archiso~# mount /dev/sd<x>3 /mnt
|
||||
|
||||
-> Mounting the EFI partition.
|
||||
root@archiso~# mkdir -p /mnt/boot/efi
|
||||
root@archiso~# mount /dev/sd<x>1 /mnt/boot/efi
|
||||
|
||||
8. Installing the required packages.
|
||||
|
||||
-> I am using the vim editor in this tutorial.
|
||||
|
||||
root@archiso~# pacstrap /mnt base linux linux-firmware vim
|
||||
|
||||
9. Generating the format style table.
|
||||
|
||||
root@archiso~# genfstab -U /mnt >> /mnt/etc/fstab
|
||||
|
||||
-> -U option for using the UUIDs.
|
||||
|
||||
10. Change root to the mount directory using the 'arch-chroot /mnt' command.
|
||||
|
||||
11. Set your timezone and sync the harware clock.
|
||||
|
||||
[root@archiso /]# ln -sf /usr/share/zoneinfo/<region>/<city> /etc/localtime
|
||||
|
||||
-> Replace <region> and <city> with your region and city.
|
||||
eg: ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
|
||||
|
||||
-> Syncing the harware clock.
|
||||
[root@acrhiso /]# hwclock --systohc
|
||||
|
||||
12. Set your locale.
|
||||
|
||||
[root@archiso /]# vim /etc/locale.gen
|
||||
|
||||
-> The above command will open the locale.gen in vim. Here locate your locale, un-comment it and save the file.
|
||||
-> I will be using the 'en_US.UTF8' locale throught the tutorial.
|
||||
|
||||
13. Generate the locale using the 'locale-gen' command.
|
||||
|
||||
14. Add locale to the locale.conf file.
|
||||
|
||||
[root@archiso /]# echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
||||
|
||||
14. Set the host name.
|
||||
|
||||
[root@archiso /]# echo "ArchUSB" > /etc/hostname
|
||||
|
||||
-> Replace ArchUSB with your hostname.
|
||||
|
||||
15. Edit the hosts file.
|
||||
|
||||
[root@archiso /]# vim /etc/hosts
|
||||
|
||||
-> The above command will open the hosts file in vim. Here, add the following text (replace the hostname)
|
||||
below the comments in the file.
|
||||
|
||||
"""
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
127.0.1.1 ArchUSB.localdomain ArchUSB
|
||||
"""
|
||||
|
||||
-> Save the file and quit.
|
||||
|
||||
16. Edit the mkinitcpio.conf file.
|
||||
|
||||
-> As this is a USB flash drive and is going to plugged in more than a single PC, some of the hooks in the
|
||||
mkinitcpio.conf file have to be moved ahead in the order for excepting a normal boot on multiple systems.
|
||||
|
||||
[root@archiso /]# vim /etc/mkinitcpio.conf
|
||||
|
||||
-> In the file that opens, find the HOOKS variable and move block and keyboard ahead of autodetect as shown below.
|
||||
|
||||
-> before
|
||||
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck)
|
||||
|
||||
-> after
|
||||
HOOKS=(base udev block keyboardautodetect modconf kms keymap consolefont filesystems fsck)
|
||||
|
||||
17. Generate Initramfs using the 'mkinitcpio -P linux' command.
|
||||
|
||||
18. Add a user and create a password.
|
||||
|
||||
[root@archiso /]# useradd -mG wheel <user>
|
||||
|
||||
-> Replace <user> with your username.
|
||||
|
||||
[root@archiso /]# passwd <user>
|
||||
|
||||
18. Set a password for root.
|
||||
|
||||
[root@archiso /]# passwd root
|
||||
|
||||
19. Install the required packages.
|
||||
|
||||
[root@archiso /]# pacman -S grub base-devel efibootmgr linux-headers mtools dosfstools reflector networkmanager linux-headers git os-prober nm-connection-editor
|
||||
|
||||
20. Install grub.
|
||||
|
||||
[root@archiso /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --removable --recheck
|
||||
|
||||
21. Generate grub configuration file.
|
||||
|
||||
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
22. Update sudo privileges.
|
||||
|
||||
[root@archiso /]# editor=vim visudo
|
||||
|
||||
-> The above command will open the visudo file. Here, un-comment the line matching the one below.
|
||||
|
||||
"%wheel ALL=(ALL) ALL"
|
||||
|
||||
-> Save it and exit the file.
|
||||
|
||||
23. Exit to the archiso using the 'exit' command.
|
||||
24. Unmount all the partitions using the 'unmount -a' command.
|
||||
25. Reboot the system using the 'reboot' command.
|
||||
|
||||
26. After rebooting, boot from the USB where arch was installed.
|
||||
27. Login into the used which was added in the installation.
|
||||
|
||||
28. Edit the system journal file.
|
||||
|
||||
-> This is necessary to make the system know that the journal has to be stored in the RAM instead.
|
||||
-> Follow the below command to create and update the journal file.
|
||||
|
||||
# mkdir /etc/systemd/journal.conf.d
|
||||
# vim /etc/systemd/journal.conf.d/usbstick.conf
|
||||
|
||||
-> In the file that opens, save the text below.
|
||||
|
||||
"""
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
MaxRuntimeUse=30M
|
||||
"""
|
||||
|
||||
-> MaxRuntimeUse set to 30M as recommended by the ArchWiki.
|
||||
|
||||
29. So, Arch is now successfully installed on your system.
|
||||
|
||||
Reached a new milestone: "BTW, I use Arch!"
|
||||
351
joplin notion extension/linux/Arch/Installation.md
Normal file
351
joplin notion extension/linux/Arch/Installation.md
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
Installation
|
||||
|
||||
https://wiki.archlinux.org/title/installation_guide
|
||||
offline installation : https://medium.com/@elohash/how-to-install-arch-linux-without-internet-no-pacman-9314836949de
|
||||
|
||||
https://docs345.surge.sh/arch_installation/
|
||||
|
||||
|
||||
This video is used for the following steps: https://www.youtube.com/watch?v=DPLnBPM4DhI
|
||||
https://files.catbox.moe/u3tkye.mp4
|
||||
|
||||
- `iwctl`
|
||||
- https://m.youtube.com/watch?v=3czrHtFHteY
|
||||
`device list`
|
||||
`station wlan0 scan` then `station wlan0 get-networks`
|
||||
then connect to internet using
|
||||
`station <device_name> connect <ssid>`
|
||||
Eg: `station wlan0 connect Comcast-50`
|
||||
and `quit`. then ping it by to check if internet is working
|
||||
`ping x.org`.
|
||||
- Update time with `timedatectl`
|
||||
- Partitioning disk
|
||||
- Check partition using `fdisk -l` or `lsblk` or `cfdisk`
|
||||
- Then `fdisk <partition>`
|
||||
eg: `fdisk /dev/sda`
|
||||
- Type these commands in sequence:
|
||||
`p` to print information
|
||||
`o` to create new label
|
||||
`n` to add new partition. So many prompts will come just press enter to select default.
|
||||
|
||||
- Press `t` and Choose lvm by typing `8E` then type `a` to make partition active.
|
||||
- Finalize change type `w` then enter
|
||||
- Then create physical volume using
|
||||
`pvcreate --dataalignment 1m /dev/sda1`
|
||||
- Now create volume group
|
||||
`vgcreate volgroup0 /dev/sda1` . Here `volgroup0` is a group name.
|
||||
- Now create 2 logical volumes ie lv_root and lv_home
|
||||
`lvcreate -L 30GB volgroup0 -n lv_root`
|
||||
and
|
||||
`lvcreate -l 100%FREE volgroup0 -n lv_home`
|
||||
- Load new volume group into memory
|
||||
`modprobe dm_mod`
|
||||
- Scan system for volume groups
|
||||
`vgscan` and activate it
|
||||
`vgchange -ay`
|
||||
- Formatting volumes
|
||||
- Now format these parttions. For root one , format it with ext4 and for swap one format with swap
|
||||
Ext4 formatting
|
||||
`mkfs.ext4 /dev/volgroup0/lv_root`
|
||||
Mounting
|
||||
`mount /dev/volgroup0/lv_root /mnt`
|
||||
|
||||
Now format 2nd logical volume and mount it
|
||||
`mkfs.ext4 /dev/volgroup0/lv_home`
|
||||
Mounting
|
||||
`mkdir /mnt/home`
|
||||
`mount /dev/volgroup0/lv_home /mnt/home`
|
||||
|
||||
If there r swap partitions then
|
||||
Format the Swap Partition (if created): If you created a swap partition, format it as swap:
|
||||
`mkswap /dev/sdX2` # Replace /dev/sdX2 with your swap partition
|
||||
`swapon /dev/sdX2` # Activate the swap partition
|
||||
|
||||
`mkdir /mnt/etc`
|
||||
Saving partition layout by:
|
||||
`genfstab -U -p /mnt >> /mnt/etc/fstab`
|
||||
|
||||
|
||||
- For UEFI
|
||||
Difference here is that we need to create efi partition
|
||||
After typing `fdisk /dev/sda` type these commands:
|
||||
`p` and `g`(for new GPT) , `n` then
|
||||
- Partition number and First sector is default but for last sector we need to change it So type `+500M` as 500mb is enough for efi
|
||||
|
||||
Now type `t` and and partition type is `1` which means efi
|
||||
- Now one more partition for rest
|
||||
So type `n` and just select defaults and set the type with `t` and set to lvm
|
||||
- Partition number would be 2 which is default
|
||||
- Type `30` for lvm
|
||||
- Finally verify it by `p` and type `w` to make changes
|
||||
|
||||
For parttion 1 ie efi , it have to be formatted with fat32
|
||||
`mkfs.fat -F32 /dev/sda1`
|
||||
Here `-F32` represents fat32
|
||||
Now instead of creating and volume and setting other steps for lvm use sda2 instead of sda1 .
|
||||
|
||||
- For UEFI with encryption
|
||||
|
||||
|
||||

|
||||
this should be. 1st to efi,2nd to linux filesystem and 3rd to linux lvm
|
||||
|
||||
Do same for efi and set ext4 for partition 2 but before formatting 4rd we need to encrypt it
|
||||
- Setting encryption
|
||||
`cryptsetup luksFormat /dev/sda3`
|
||||
Now u need to type passphrase. This passphrase should be available else all data will remain encrypted and inaccessible. After typing passphrase it will get locked so type
|
||||
`cryptsetup open --type luks /dev/sda3 lvm`
|
||||
|
||||
Now just create volume , format and mount
|
||||
`pvcreate --dataalignment 1m /dev/mapper/lvm`
|
||||
|
||||
- Installing components
|
||||
- Using pacstrap command
|
||||
`pacstrap -i /mnt base`
|
||||
There mey be a error related to keyring hell so to fix it use
|
||||
https://wiki.archlinux.org/title/Pacman/Package_signing#Resetting_all_the_keys
|
||||
In `/etc/pacman.conf`
|
||||
```text
|
||||
SigLevel = Never
|
||||
#LocalFileSigLevel = Optional
|
||||
#RemoteFileSigLevel = Required
|
||||
```
|
||||
|
||||
- Configure our installation
|
||||
`arch-chroot /mnt` Using in chroot environment. arch-chroot is like a fake-root which change to new directory so that u can make changes af if they r live but all those changes will take place in future.
|
||||
- Inside chroot, install 4 packages ie linux, linux-headers and linux-lts, linux-lts-headers. 2 versions bcz if one dont work then other may work. lts means here 'long term support' hence stable. Use
|
||||
`pacman -S linux linux-headers linux-lts linux-lts-headers linux-firmware`
|
||||
Then few more packages like nano, base-devel(basic development tools), openssh(remote access)
|
||||
To use openssh make sure to enable sshd
|
||||
`systemctl enable sshd`
|
||||
|
||||
Install packages for network working
|
||||
`pacman -S networkmanager wpa_supplicant wireless_tools netctl`
|
||||
|
||||
installing dialog if gui network interface not working
|
||||
`pacman -S dialog`
|
||||
Then finally enable NetworkManager so it will be started when booted
|
||||
`systemctl enable NetworkManager`
|
||||
|
||||
Installing lvm support
|
||||
`pacman -S lvm2`
|
||||
|
||||
To ensure boot process support our configuration, we have to modify a config file
|
||||
`nano /etc/mkinitcpio.conf`
|
||||
now using Ctrl+W find the `HOOKS` which is not commented. Between block and filesystems word,
|
||||
add `lvm2` . if used encryption then add `encrypt lvm2`.
|
||||
|
||||
|
||||
- Resizing partition
|
||||
`lvdisplay` and `vgdisplay`
|
||||
|
||||
Shrink LV
|
||||
If something goes wrong with length of partition then u need to resize it
|
||||
`umount /dev/VG_NAME/lv_home` # Unmount the LV (replace VG_NAME with your volume group)
|
||||
`e2fsck -f /dev/volgroup0/lv_home` # to check file system consistency and check for errors,bad block.
|
||||
`resize2fs /dev/VG_NAME/lv_home NEW_SIZE` # Shrink the filesystem
|
||||
`lvreduce -L NEW_SIZE /dev/VG_NAME/lv_home` # Shrink the logical volume
|
||||
|
||||
Extend LV
|
||||
`lvextend -L +NEW_SIZE /dev/VG_NAME/lv_root` # Extend the logical volume
|
||||
or
|
||||
`lvextend -l +100%FREE /dev/VG_NAME/lv_root`
|
||||
`e2fsck -f /dev/volgroup0/lv_root`
|
||||
`resize2fs /dev/VG_NAME/lv_root` # Resize the filesystem to use the new space
|
||||
|
||||
- Initramfs
|
||||
To take all these setups and option take effect use this
|
||||
`mkinitcpio -p linux`
|
||||
`mkinitcpio -p linux-lts`(As this was also installed)
|
||||
Then set the locale by
|
||||
`nano /etc/locale.gen`
|
||||
Then choose en us and uncomment it
|
||||
`locale-gen`
|
||||
|
||||
Updating password
|
||||
`passwd` then type password to set it
|
||||
|
||||
Creating standard user
|
||||
`useradd -m -g users -G wheel hvm`
|
||||
`-m` means creating home directory for the user, `-g` represents initial login group, `-G` are other supplementary groups. `hvm` is user name.
|
||||
Then set password for this user
|
||||
`passwd hvm` and set password.
|
||||
After this we dont have to use root account always, instead we can use sudo
|
||||
|
||||
Now we need to associate wheel group with sudo
|
||||
`EDITOR=nano visudo`
|
||||
`visudo` is a dedicated command to modify sudo priviledges
|
||||
Scroll down and search for `%wheel ALL=(ALL:ALL) ALL` and uncomment it and save the file.
|
||||
Now user can use sudo to run administrative task.
|
||||
|
||||
- Installing GRUB
|
||||
Its purpose is to boot the OS without bootable media like USB or CD.
|
||||
- For non-UEFI(BIOS)
|
||||
Install this:
|
||||
`pacman -S grub dosfstools os-prober mtools`
|
||||
and finally
|
||||
`grub-install --target=i386-pc --recheck /dev/sda`
|
||||
|
||||
- For UEFI install these
|
||||
`pacman -S grub efibootmgr dosfstools os-prober mtools`
|
||||
|
||||
`mkdir /boot/EFI`
|
||||
`mount /dev/sda1 /boot/EFI`
|
||||
and finally
|
||||
`grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck`
|
||||
|
||||
Check if grub exists by this:
|
||||
`ls -l /boot/grub`
|
||||
|
||||
- Others
|
||||
`cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo`
|
||||
- With encryption
|
||||
`nano /etc.default/grub` then uncomment `GRUB_ENABLE_CRYPTODISK=y`
|
||||
and edit the line
|
||||
#add this GRUB_CMDLINE_LINUX_DEFAULT="cryptodevice=/dev/sda3:volgroup0:allow-discards loglevel=3 quiet"
|
||||
|
||||
- Generate grub config file
|
||||
`grub-mkconfig -o /boot/grub/grub.cfg`
|
||||
Finally
|
||||
`exit` and `umount -a` (to unmount everything)
|
||||
Finally `reboot`
|
||||
|
||||
### Post install tweeks
|
||||
- Creating swap file(not partition)
|
||||
`su`
|
||||
`cd /root`
|
||||
The dd command in Linux is a versatile utility used for copying and converting files, including data from files, devices, partitions, or even raw disk images. The command's name, "dd," stands for "data duplicator."
|
||||
`dd if=/dev/zero of=/swapfile bs=1M count=1024 status=progress`
|
||||
Changing permissions of swapfile
|
||||
`chmod 600 /swapfile`
|
||||
Formatting it to swap
|
||||
`mkswap /swapfile`
|
||||
Backing up copy of fstab file as we going to edit it
|
||||
`cp /etc/fstab /etc/fstab.bak`
|
||||
Editing it
|
||||
`echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab`
|
||||
It will add the line
|
||||
|
||||
`free -m` to check is swap is there
|
||||
`mount -a`(if it runs means no error)
|
||||
|
||||
To activate swap
|
||||
`swapon -a` and check it with `free -m`
|
||||
|
||||
- Setting time zone
|
||||
Listing it
|
||||
`timedatectl list-timezones`
|
||||
Setting it
|
||||
`timedatectl set-timezone <from_list>`
|
||||
Enabling it
|
||||
`systemctl enable systemd-timesyncd`
|
||||
|
||||
Setting host name
|
||||
`hostnamectl set-hostname archhost` here 'archhost' is host name
|
||||
Editing hosts file
|
||||
`nano /etc/hosts`
|
||||
and add
|
||||
```
|
||||
127.0.0.1 localhost
|
||||
127.0.1.1 archhost
|
||||
```
|
||||
and save it
|
||||
To check it
|
||||
`hostnamectl`
|
||||
This image will be the output
|
||||
|
||||
|
||||

|
||||
|
||||
**Installing micro code for CPU**(optional)
|
||||
AMD CPU
|
||||
`pacman -S amd-ucode`
|
||||
or
|
||||
Intel CPU
|
||||
`pacman -S intel-ucode`
|
||||
|
||||
- **GUI**
|
||||
- Installing xorg
|
||||
`pacman -S xorg-server`
|
||||
- Installing video driver
|
||||
For Intel or AMD GPU
|
||||
`pacman -S mesa`
|
||||
For NVIDIA GPU
|
||||
`pacman -S nvidia-lts nvidia`
|
||||
For VBox
|
||||
`pacman -S virtualbox-guest-utils xf86-video-vmware`
|
||||
and enable vbox extension
|
||||
`systemctl enable vboxservice`
|
||||
For QEMU, this might improve performance
|
||||
`sudo pacman -S xf86-video-qxl
|
||||
`
|
||||
And configure it too
|
||||
`sudo mkdir -p /etc/X11/xorg.conf.d`
|
||||
`sudo nano /etc/X11/xorg.conf.d/20-qxl.conf
|
||||
`
|
||||
Type this
|
||||
```
|
||||
Section "Device"
|
||||
Identifier "qxl"
|
||||
Driver "qxl"
|
||||
Option "AccelMethod" "glamor"
|
||||
EndSection
|
||||
|
||||
```
|
||||
and save it
|
||||
|
||||
|
||||
- Installing Desktop Environment
|
||||
- GNOME
|
||||
`pacman -S GNOME`
|
||||
it will store many dependencies as its a package group
|
||||
Some other optional
|
||||
`pacman -S gnome-tweaks` this will give more control over the environment
|
||||
|
||||
Enable display manager
|
||||
`systemctl enable gdm`
|
||||
This will enable login screen
|
||||
Specify the language in Region and Language section else terminal wont open
|
||||
- Plasma
|
||||
`pacman -S plasma-meta kde-applications`
|
||||
Enable display manager
|
||||
`systemctl enable sddm`
|
||||
- Xfce
|
||||
`pacman -S xfce4 xfce4-goodies`
|
||||
Install display manager
|
||||
`pacman -S lightdm lightdm-gtk-greeter`
|
||||
Enabling it
|
||||
`systemctl enable lightdm`
|
||||
- Packages in xfce
|
||||
: There are 15 members in group xfce4:
|
||||
:: Repository extra
|
||||
```
|
||||
1) exo 2) garcon 3) thunar 4) thunar-volman 5) tumbler
|
||||
6) xfce4-appfinder 7) xfce4-panel 8) xfce4-power-manager 9) xfce4-session
|
||||
10) xfce4-settings 11) xfce4-terminal 12) xfconf 13) xfdesktop 14) xfwm4
|
||||
15) xfwm4-themes
|
||||
Enter a selection (default=all):
|
||||
:: There are 36 members in group xfce4-goodies:
|
||||
:: Repository extra
|
||||
|
||||
1) mousepad 2) parole 3) ristretto 4) thunar-archive-plugin
|
||||
5) thunar-media-tags-plugin 6) xfburn 7) xfce4-artwork
|
||||
8) xfce4-battery-plugin 9) xfce4-clipman-plugin 10) xfce4-cpufreq-plugin
|
||||
11) xfce4-cpugraph-plugin 12) xfce4-dict 13) xfce4-diskperf-plugin
|
||||
14) xfce4-eyes-plugin 15) xfce4-fsguard-plugin 16) xfce4-genmon-plugin
|
||||
17) xfce4-mailwatch-plugin 18) xfce4-mount-plugin 19) xfce4-mpc-plugin
|
||||
20) xfce4-netload-plugin 21) xfce4-notes-plugin 22) xfce4-notifyd
|
||||
23) xfce4-pulseaudio-plugin 24) xfce4-screensaver 25) xfce4-screenshooter
|
||||
26) xfce4-sensors-plugin 27) xfce4-smartbookmark-plugin
|
||||
28) xfce4-systemload-plugin 29) xfce4-taskmanager
|
||||
30) xfce4-time-out-plugin 31) xfce4-timer-plugin 32) xfce4-verve-plugin
|
||||
33) xfce4-wavelan-plugin 34) xfce4-weather-plugin
|
||||
35) xfce4-whiskermenu-plugin 36) xfce4-xkb-plugin
|
||||
```
|
||||
|
||||
as
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
35
joplin notion extension/linux/Arch/Issues and VM.md
Normal file
35
joplin notion extension/linux/Arch/Issues and VM.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
Issues and VM
|
||||
|
||||
- GUI not working and get stuck
|
||||
go to other tty using `Ctrl+alt+F2` or `Ctrl+alt+F3`.... and access the shell and undo changes which caused such issue
|
||||
- Stuck with low resolution
|
||||
With virtio as graphic driver, change resolution is display settings of guest os itself
|
||||
- Screen tearing
|
||||
Try 3 cases
|
||||
1. Enable 3d acceleration in 'video virtio' section which can be found in view and change console to details
|
||||
2. Enable opengl which in 'display splice'
|
||||
3. Do both
|
||||
|
||||
- Enable Clipboard sharing
|
||||
1. Make sure splice protocol is enabled
|
||||
2. Install `splice-vdagent` via pacman.
|
||||
3. Reboot it
|
||||
|
||||
- Enable File sharing
|
||||
https://www.debugpoint.com/share-folder-virt-manager/
|
||||
1. In Details section of current VM go to 'Add Hardware' and add filesystem with source path like `home/user/shared` and target path `shared`. Here shared is random name to be used later for mount. Make sure `vitiofs` is there as driver
|
||||
2. Then restart VM and make any specific directory like `home/user/shared` and make it as mount point by following command
|
||||
`sudo mount -t virtiofs shared /home/hvm/shared`
|
||||
|
||||
- video driver not working
|
||||
it may be possible that we forget to install linux firmware or video driver is missing so we can use `nomodeset` to atleast have access to cli. When in grub navigate to arch linux, dont click enter, type `e` there and at end of line starting with linux add `nomodeset` after word `quiet`.
|
||||
- Wifi Manager not available
|
||||
`sudo pacman -Sy network-manager-applet`
|
||||
- package repo out of date
|
||||
Neither
|
||||
Your database is outdated and has a link to an old version
|
||||
the mirror doesn't cache every old version
|
||||
if you want to do that you can set up your own mirror that just doesn't delete any packages lol
|
||||

|
||||
u can use this
|
||||
https://archive.archlinux.org to download old packages
|
||||
28
joplin notion extension/linux/Arch/connect wifi.md
Normal file
28
joplin notion extension/linux/Arch/connect wifi.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
connect wifi
|
||||
|
||||
https://www.makeuseof.com/connect-to-wifi-with-nmcli/
|
||||
https://wiki.archlinux.org/title/Network_configuration/Wireless
|
||||
|
||||
- Check network status by
|
||||
`nmcli dev status`
|
||||
- Also make sure that services NetworkManager,wpa_supplicant is started and enabled
|
||||
`sudo systemctl enable --now NetworkManager`
|
||||
- Check if wifi is enabled or not by
|
||||
`nmcli radio wifi`. if not enabled then type `nmcli radio wifi on` .
|
||||
- Check available wifi networks using
|
||||
`nmcli dev wifi list`
|
||||
- Connecting to specific network
|
||||
To connect with no password
|
||||
`sudo nmcli dev wifi connect network-ssid`
|
||||
Eg: `sudo nmcli dev wifi connect fiber-2`
|
||||
To connect with password
|
||||
`sudo nmcli dev wifi connect network-ssid password <password>`
|
||||
Eg : if password is pass then
|
||||
`sudo nmcli dev wifi connect network-ssid password pass`
|
||||
For interactive password typing ie taking input in order to hide it
|
||||
`sudo nmcli --ask dev wifi connect network-ssid`
|
||||
|
||||
- View saved connections
|
||||
`nmcli con show`
|
||||
- Connect another saved connection
|
||||
`nmcli con up ssid/uuid`
|
||||
60
joplin notion extension/linux/Arch/grub.md
Normal file
60
joplin notion extension/linux/Arch/grub.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
grub
|
||||
|
||||
old hp
|
||||
Partition name: archcraft │
|
||||
│ Partition UUID: 29EF9697-4189-48F2-830A-2A4DCC8AEE40 │
|
||||
│ Partition type: Linux filesystem (0FC63DAF-8483-4772-8E79-3
|
||||
|
||||
Partition UUID: 67570847-3D7F-421F-9C04-13BBE306F866 │
|
||||
│ Partition type: Linux swap (0657FD6D-A4AB-43C4-84E5-0933C84B4F4F) │
|
||||
│Filesystem UUID: 0c9b4784-84b0-437a-b50a-8544cc569e18 │
|
||||
└─────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Ubuntu
|
||||
Partition UUID: 945D0C81-1B6A-42F7-B517-6FD37E8EA9DA │
|
||||
│ Partition type: Linux filesystem (0FC63DAF-8483-4772-8E79-3D69D8477DE4) │
|
||||
│Filesystem UUID: eee3ebe8-2bcc-43c1-b8db-5e627635417b
|
||||
|
||||
|
||||
Arch
|
||||
Partition UUID: C604A90F-30C0-4C55-933C-FF51320B83EC │
|
||||
│ Partition type: Linux root (x86) (44479540-F297-41B2-9AF7-D131D5F0458A) │
|
||||
│Filesystem UUID: b0425c17-5b5e-49cf-bbbc-f2d959fac780
|
||||
|
||||
|
||||
|
||||
Learning:
|
||||
|
||||
- add distro to grub
|
||||
https://www.youtube.com/watch?v=okYxL7f1VYs
|
||||
make sure that os-prober is enabled in `/etc/default/grub`
|
||||
uncomment following line yo enable it
|
||||
`GRUB_DISABLE_OS_PROBER=false`
|
||||
Now run `sudo os-prober`
|
||||
it will list other distro but not the current one. Make sire that other distros are mounted
|
||||
finally use
|
||||
`sudo grub-mkconfig -o /boot/grub/grub/cfg` to update grub menu
|
||||
|
||||
|
||||
|
||||
- remove systemd-boot
|
||||
`bootctl remove`
|
||||
|
||||
|
||||
- `lsblk -o name,type,uuid`
|
||||
https://www.reddit.com/r/archlinux/comments/tqzodn/other_distros_not_detect_after_fresh_installation/
|
||||
manual way
|
||||
```
|
||||
menuentry "Ubuntu" {
|
||||
# assuming that UUID is 763A-9CB6
|
||||
search --no-floppy --set=root --fs-uuid eee3ebe8-2bcc-43c1-b8db-5e627635417b
|
||||
|
||||
# search by label OTHER_LINUX (make sure that partition label is unambiguous)
|
||||
#search --no-floppy --set=root --label OTHER_LINUX
|
||||
|
||||
linux /boot/vmlinuz root=UUID=eee3ebe8-2bcc-43c1-b8db-5e627635417b
|
||||
#initrd /boot/initrd.img (if the other kernel uses/needs one)
|
||||
initrd /boot/amd-ucode.img /boot/initramfs-linux-lts.img
|
||||
}
|
||||
```
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
offline installation of arch
|
||||
To bundle packages in an Arch ISO file, modify pacstrap to install packages from the bundled version of the ISO rather than the Arch repositories, and to run a script that is also bundled in the ISO, you'll need to follow several steps. This process involves creating a custom Arch Linux ISO that includes your desired packages and scripts, then modifying the installation scripts to use these bundled resources. Below is an outline of how you can achieve this. Keep in mind, this is a high-level overview and certain steps might require deeper knowledge of Arch Linux, bash scripting, and the inner workings of the Arch ISO.
|
||||
|
||||
### Step 1: Download the Arch ISO
|
||||
|
||||
Download the latest Arch ISO from the official Arch Linux website.
|
||||
|
||||
### Step 2: Extract the ISO
|
||||
|
||||
Mount the ISO to a directory or extract its contents using tools like `7z` or `bsdtar` to a working directory.
|
||||
|
||||
```bash
|
||||
mkdir archiso
|
||||
bsdtar -xpf archlinux.iso -C archiso
|
||||
```
|
||||
|
||||
### Step 3: Customize the AIROOTFS (Arch ISO Root File System)
|
||||
|
||||
This section includes adding your packages and scripts.
|
||||
|
||||
#### Adding Packages:
|
||||
1. Custom packages that are not in the official repositories (or any AUR packages) should be built into `.pkg.tar.zst` files.
|
||||
2. Copy these package files into the `archiso/airootfs/root/` directory (or a subdirectory). This way, they will be available on the live filesystem.
|
||||
|
||||
#### Adding Scripts:
|
||||
1. Write your custom script that performs the desired tasks (e.g., post-installation setup).
|
||||
2. Add this script to the `archiso/airootfs/root/` directory so that you can run it after booting into your custom ISO.
|
||||
|
||||
### Step 4: Modify Pacstrap (Optional)
|
||||
|
||||
Modifying `pacstrap` itself might not be necessary. Instead, consider using a script to manually install the packages using `pacman -U` command from your bundled packages:
|
||||
|
||||
1. Inside your custom script added in the previous step, navigate to where you've stored your packages (e.g., `/root/your_packages/`).
|
||||
2. Install them using `pacman -U /path/to/package.pkg.tar.zst`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Customizing an Arch Linux ISO to include additional packages and modify the `pacstrap` script can be quite involved but entirely feasible. To add packages directly into your ISO and change how `pacstrap` operates to install these packages, you'll need to work with the Arch ISO build system and the `airootfs` (Arch ISO root filesystem) environment. Moreover, to run a custom script bundled in the ISO, you'll need to modify the system's startup process.
|
||||
|
||||
Here are the broad steps you'd follow to achieve your goals:
|
||||
|
||||
### 1. Prepare the Environment
|
||||
|
||||
First, ensure you have all the necessary tools and dependencies. You'll need the `archiso` package, which gives you the tools to create custom live CDs.
|
||||
|
||||
```bash
|
||||
sudo pacman -S archiso
|
||||
```
|
||||
|
||||
### 2. Create Your Working Directory
|
||||
|
||||
Copy the `archiso` profile to create your own customizable profile.
|
||||
|
||||
```bash
|
||||
cp -r /usr/share/archiso/configs/releng/ ~/customiso
|
||||
cd ~/customiso
|
||||
```
|
||||
|
||||
### 3. Bundle Packages
|
||||
|
||||
To add packages directly to the ISO, modify the `packages.x86_64` file located in your custom ISO directory. Just add the names of the packages you wish to include. Note that these packages must be available in the regular Arch repositories or on your custom repository.
|
||||
|
||||
### 4. Modify the Pacstrap Script
|
||||
|
||||
The `pacstrap` script is part of the `arch-install-scripts` package, and it's not directly included in your ISO. `pacstrap` pulls packages from the official repositories during system installation. To change this functionality, you have several options:
|
||||
|
||||
- **Pre-install Packages**: Instead of modifying `pacstrap`, you could pre-install your desired packages into the `airootfs` root file system using the `mkarchiso` command. You can do this by specifying additional packages in the `packages.x86_64` file, as mentioned before, and they'll be installed when you build your ISO.
|
||||
|
||||
- If you insist on modifying `pacstrap` behavior, consider this: When `pacstrap` is run in the Arch ISO environment, it's actually pulling from the live environment (including any modifications you've made). If you want `pacstrap` to pull packages from a specific source, such as packages bundled within the ISO, you would likely need to create a local repository within your ISO and modify the `pacstrap` script (or a custom script called from `airootfs/root/.automated_script.sh`) to prioritize or exclusively use this repository.
|
||||
|
||||
### 5. Include and Run a Custom Script
|
||||
|
||||
To run a custom script from the ISO:
|
||||
|
||||
1. **Place Your Script**: Put your custom script in the `airootfs/root/` directory of your custom ISO project. This ensures it is part of the filesystem that is built into the ISO.
|
||||
|
||||
2. **Autostart Your Script**: Modify the `airootfs/root/customize_airootfs.sh` file to call your script upon boot. This script runs as the last step of the ISO customization process.
|
||||
|
||||
```bash
|
||||
echo "/root/mycustomscript.sh" >> airootfs/root/.zlogin
|
||||
```
|
||||
|
||||
Or, directly invoke your script from `airootfs/root/.automated_script.sh` if you are aiming for an automated installation.
|
||||
|
||||
### 6. Build Your ISO
|
||||
|
||||
Follow the `archiso` instructions to build your ISO. This typically involves running the `mkarchiso` command in your custom ISO directory.
|
||||
|
||||
```bash
|
||||
sudo mkarchiso -v ~/customiso
|
||||
```
|
||||
|
||||
### Final Notes
|
||||
|
||||
- **Handling Repositories**: Bundling packages inside the ISO for `pacstrap` to use is unconventional. Instead, consider either pre-installing packages or setting up a local repository within your ISO and having `pacstrap` use it. Handling dependencies correctly is crucial here.
|
||||
- **Testing**: Always test your custom ISO in a safe environment (like a VM) before using it in a production context.
|
||||
- **Custom `pacstrap` Logic**: If you modify how `pacstrap` operates (e.g., to use a local repository), you might need to also ensure that the mirrorlist or `pacman` configuration used respects this customization.
|
||||
- **Resolution**: Depending on your precise use case (specific packages or scripts execution), there might be simpler or more straightforward approaches to achieving your goals, such as scripting post-install actions instead of deeply customizing the install process.
|
||||
|
||||
Customizing Arch Linux and automating installations can be a powerful way to create a tailored environment, but it requires careful planning and testing to ensure system stability and security.
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
# 1. Prepare your packages
|
||||
# Download packages or use pacman to download them along with dependencies
|
||||
|
||||
# 2. Create a custom repository
|
||||
# Create a directory to store your packages
|
||||
mkdir custom_repo
|
||||
# Add packages to your custom repository
|
||||
repo-add custom_repo/custom.db.tar.gz <package1>.pkg.tar.zst <package2>.pkg.tar.zst ...
|
||||
|
||||
# 3. Modify the Arch Linux ISO
|
||||
# Extract the Arch Linux ISO
|
||||
mkdir arch_iso
|
||||
bsdtar -xf archlinux.iso -C arch_iso
|
||||
# Add your custom repository to the Arch Linux ISO
|
||||
cp -r custom_repo arch_iso
|
||||
|
||||
# 4. Modify pacstrap
|
||||
# Edit the pacstrap script in the arch_iso directory to use your custom repository
|
||||
|
||||
# 5. Create a script
|
||||
# Create your script and make it executable
|
||||
chmod +x your_script.sh
|
||||
|
||||
# 6. Bundle everything into a new ISO
|
||||
# Create a new ISO with your modifications
|
||||
xorriso -as mkisofs -iso-level 3 -full-iso9660-filenames -volid "Custom Arch Linux" -o custom_archlinux.iso arch_iso
|
||||
|
||||
# Clean up temporary files if necessary
|
||||
|
||||
```
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
sway compositor installation
|
||||
https://wiki.garudalinux.org/en/sway-cheatsheet
|
||||
|
||||
Make sure to have these list of tools that are alternative of x11 ones
|
||||
https://soyuka.me/make-screen-sharing-wayland-sway-work/
|
||||
|
||||
todo
|
||||
- network stats on waybar
|
||||
- sleep/power button
|
||||
- wifi manager
|
||||
|
||||
|
||||
- Installing packages
|
||||
sudo pacman -S sway swaybg foot polkit
|
||||
- Type `sway` after opening it with `Super + Enter`
|
||||
- Fixing resolution
|
||||
First copy the config of sway to config of user directroy
|
||||
```bash
|
||||
mkdir -p ~/.config/sway
|
||||
cp /etc/sway/config ~/.config/sway/
|
||||
$EDITOR ~/.config/sway/config
|
||||
```
|
||||
In order to get device name and other availableresolutions and info type
|
||||
`swaymsg -t get_outputs`
|
||||
Then enabling it with
|
||||
`output HDMI-A-1 mode 1920x1080@60Hz`
|
||||
|
||||
|
||||
### more shotcuts
|
||||
for tabbed mode : mod+D
|
||||
launcher : mod + d
|
||||
to escape tabbed mode : mod + e
|
||||
for fullscreen : mod+f
|
||||
closing focused wndow : mod+shift+q
|
||||
|
||||
to make current window appear on top of others : mod+shift+space
|
||||
and then switch between floating and tiling window : mod + space
|
||||
to change size of floating window : mod + drag with right click (resize mode need to be enabled with win + r to move or resize)
|
||||
- config files
|
||||
main config file is in `/etc/sway` which can be copied to `~/.config` for customization
|
||||
and to load this changed config
|
||||
`swaymsg reload`
|
||||
- to kill kde session use
|
||||
`qdbus org.kde.ksmserver /KSMServer logout 0 0 0`
|
||||
`loginctl terminate-session`
|
||||
`qdbus org.kde.KWin /Session org.kde.KWin.Session.quit `
|
||||
- about audio
|
||||
`pavucontrol` is important for audio output and configuration
|
||||
```sh
|
||||
systemctl --user status pipewire
|
||||
systemctl --user status pipewire-pulse
|
||||
# Sometimes, you may also need:
|
||||
systemctl --user status wireplumber
|
||||
```
|
||||
These are necessary for audio
|
||||
for inspecting
|
||||
```sh
|
||||
pactl list short sinks
|
||||
pactl list short sources
|
||||
```
|
||||
- configuting volume
|
||||
```txt
|
||||
# in config file
|
||||
# Increase volume
|
||||
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
|
||||
# Decrease volume
|
||||
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
|
||||
# Mute/unmute volume
|
||||
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
```
|
||||
if using alsa then
|
||||
```txt
|
||||
# Increase volume
|
||||
bindsym XF86AudioRaiseVolume exec amixer set Master 5%+
|
||||
|
||||
# Decrease volume
|
||||
bindsym XF86AudioLowerVolume exec amixer set Master 5%-
|
||||
|
||||
# Mute/unmute volume
|
||||
bindsym XF86AudioMute exec amixer set Master toggle
|
||||
```
|
||||
- waybar
|
||||
it a tray at top which display stats like ram used, volume, brightness and all
|
||||
download it with `yay -S waybar` and start waybar in terminal
|
||||
Also install `ttf-font-awesome` for icons
|
||||
- brighness(2 ways)
|
||||
- install `light` then
|
||||
```yaml
|
||||
# Increase brightness
|
||||
bindsym XF86MonBrightnessUp exec light -A 10
|
||||
|
||||
# Decrease brightness
|
||||
bindsym XF86MonBrightnessDown exec light -U 10
|
||||
```
|
||||
or
|
||||
- install `brightnessctl` then
|
||||
```yaml
|
||||
# Increase brightness
|
||||
bindsym XF86MonBrightnessUp exec brightnessctl set +10%
|
||||
|
||||
# Decrease brightness
|
||||
bindsym XF86MonBrightnessDown exec brightnessctl set 10%-
|
||||
```
|
||||
|
||||
- Touchpad configurations
|
||||
- Make sure `libinput` is installed
|
||||
- list devices too see device name and find device name of touchpad
|
||||
`libinput list-devices` eg : `1267:12448:ELAN0708:00_04F3:30A0_Touchpad`
|
||||
if identifier property isnt there then use
|
||||
`swaymsg -rt get_inputs`
|
||||
- type this in config
|
||||
```yaml
|
||||
# input "your-device-name"
|
||||
input "1267:12448:ELAN0708:00_04F3:30A0_Touchpad" {
|
||||
# Enable natural (reverse) scrolling
|
||||
natural_scroll enabled
|
||||
|
||||
# Enable tap to click
|
||||
tap enabled
|
||||
}
|
||||
```
|
||||
Instead of `input <DEVICE_IDENTIFIER>` this can can be used to `input type:touchpad`
|
||||
|
||||
|
||||
**Clipboard manager**
|
||||
- make sure wofi is installed and so is wl-clipboard is installed
|
||||
- Create this script
|
||||
```bash
|
||||
#!/bin/bash
|
||||
HISTFILE=~/.clipboard_history
|
||||
|
||||
# Check and create history file if it doesn't exist
|
||||
if [ ! -f $HISTFILE ]; then
|
||||
touch $HISTFILE
|
||||
fi
|
||||
|
||||
# Append new clipboard items to the history
|
||||
wl-paste -n | tee -a $HISTFILE
|
||||
|
||||
# Display history using wofi and copy the selection back
|
||||
selection=$(sort -u $HISTFILE | wofi --show=dmenu)
|
||||
[[ -n "$selection" ]] && echo -n "$selection" | wl-copy
|
||||
```
|
||||
- Bind this with key mod+d
|
||||
`chmod +x ~/scripts/clipboard_history.sh`
|
||||
- Alternatively use copyq
|
||||
|
||||
|
||||
Screenshot
|
||||
- Make sure grimshot and swappy is installed. This command is used to take screenshot
|
||||
`grimshot save area - | swappy -f -`
|
||||
or
|
||||
`grim -g "$(slurp)" - | swappy -f -`
|
||||
- Then add this in config
|
||||
`bindsym $mod+p exec grimshot save area - | swappy -f -`
|
||||
|
||||
|
||||
Network stats
|
||||
- we need to setup a toolkit it involvfes making changes into config so copy its default config from `/etc/xdg/wayland` to `~/.config/wayland`
|
||||
- In `config.jsonc`, make sure to have following in network module
|
||||
```json
|
||||
"network": {
|
||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||
"format-wifi": "{essid} ({signalStrength}%) ",
|
||||
"format-ethernet": "{ipaddr}/{cidr} ",
|
||||
"tooltip-format": "{ifname} via {gwaddr} ",
|
||||
"format-linked": "{ifname} (No IP) ",
|
||||
"format-disconnected": "Disconnected ⚠",
|
||||
"format-alt": "{ifname}: {ipaddr}/{cidr}",
|
||||
//"format-alt": "{icon} {ifname}: {ipaddr}/{cidr}", // overridden by on-click below (click also toggles format/format-alt)
|
||||
"tooltip-format": "{ifname}\t{ipaddr}/{cidr}\ngateway\t{gwaddr}",
|
||||
"tooltip-format": "{ifname}\t{ipaddr}/{cidr}\ngateway\t{gwaddr}\n\t{essid}\n{icon} ⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}",
|
||||
"interval" : 2
|
||||
|
||||
},
|
||||
```
|
||||
- then restart waybar
|
||||
|
||||
|
||||
Automatic sleep
|
||||
- main command for sleep is `systemctl suspend`
|
||||
https://askubuntu.com/questions/885936/how-to-properly-suspend-via-command
|
||||
- command for automatic sleep after interval of time
|
||||
`swayidle -w timeout 10 'systemctl suspend'` this will start a daemon
|
||||
means if left idle for 10s system will sleep
|
||||
|
||||
|
||||
obs studio (screen recording)
|
||||
https://www.reddit.com/r/swaywm/comments/w6gca6/comment/ihh86vj/
|
||||
- install `v4l2loopback` and restart your system
|
||||
- wf-recorder can also do screen recording
|
||||
for specific section of screen use this?
|
||||
`wf-recorder -a -g "$(slurp)" -f filename.mp4`
|
||||
`-a` : audio flag
|
||||
also use this to bind with any command for recording
|
||||
`bindsym $mod+o exec wf-recorder -g "$(slurp)" -f ~/Downloads/wfRecorder/$(date +%Y-%m-%d_%H:%M:%S).mp4`
|
||||
and to stop this use
|
||||
`bindsym $mod+ctrl+o exec pkill -SIGINT wf-recorder`
|
||||
or for not including mic and computer audio use this
|
||||
`wf-recorder -g "$(slurp)" --audio=alsa_output.pci-0000_04_00.6.analog-stereo.monitor -f ~/Downloads/wfRecorder/$(date +%Y-%m-%d_%H:%M:%S).mp4`
|
||||
audio sources can be listed by
|
||||
`pactl list short sources`
|
||||
|
||||
- some portals like `xdg-desktop-portal-gtk` and `xdg-desktop-portal-wlr` is recommended to be installed
|
||||
- with obs-studio in order to record potion of screen use alt too when resizing.
|
||||
|
||||
|
||||
wifi applet
|
||||
- install network-manager-applet for arch and use command `nm-applet` to start it in waybar
|
||||
|
||||
|
||||
bluetooth setup
|
||||
- first make sure to enable bluetooth service with `systemctl enable --now bluetooth.service`
|
||||
- Then install blueman which is a gui took which needs to be open through launcher
|
||||
|
||||
|
||||
**Complex keybinding support**
|
||||
In Sway, you can define complex keybindings using the bindsym directive to combine multiple key presses, but creating a "chained" key sequence directly (like keya+keyb followed by keyc) requires a workaround because sway does not natively support multi-key sequences that wait for a subsequent keypress.
|
||||
|
||||
However, you can achieve similar functionality using the bindsym directives along with exec commands that track the state of a key press. Here's a basic approach:
|
||||
|
||||
Define a variable to keep track of your sequence. You can use swaymsg to set environment variables (though this gets tricky and might require additional scripting if you want to create a more complex state machine).
|
||||
|
||||
Use combinations of bindsym. Here’s an example of how you could set up your keybindings in Sway config:
|
||||
```
|
||||
# Reset sequence variable
|
||||
set $sequence ""
|
||||
|
||||
# First key combination
|
||||
bindsym --release $mod+a exec swaymsg set-option persistent_layout "set $sequence a"
|
||||
bindsym --release $mod+b exec swaymsg set-option persistent_layout "set $sequence $sequence b"
|
||||
bindsym --release $mod+c exec swaymsg set-option persistent_layout "set $sequence $sequence c"
|
||||
|
||||
# Action on sequence completion
|
||||
bindsym --released $mod+c exec sh -c 'if [ "$$sequence" = "ab" ]; then <your-action>; fi; set $sequence ""'
|
||||
```
|
||||
This is a simplified illustration; you would need to adapt it to your environment and ensure that you have the proper way to reset the variable after executing your desired action.
|
||||
|
||||
Use a separate script for multi-key functionality (if necessary): Sometimes, handling this with a more robust solution such as a script might be easier. You could use a shell script to read key input and execute an action once a specific sequence is detected.
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
# Sample script that waits for a sequence
|
||||
case $1 in
|
||||
"ab")
|
||||
# Run your command here for keya + keyb
|
||||
echo "Action triggered for a + b"
|
||||
;;
|
||||
"c")
|
||||
if [ "$PREV_KEYS" == "ab" ]; then
|
||||
# Run your command for a + b + c
|
||||
echo "Action triggered for a + b + c"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
```
|
||||
Make sure to include this script in your keybinding:
|
||||
|
||||
`bindsym --release $mod+a exec /path/to/your/script.sh "ab"`
|
||||
`bindsym --release $mod+c exec /path/to/your/script.sh "c"`
|
||||
|
||||
Make sure to modify these samples to fit your specific needs. Managing sequences of keys can be complex, so a thorough understanding of how Sway handles input and executing external commands will help you create the solution that works best for you.
|
||||
|
||||
For the best practices and limitations, be sure to check the Sway documentation and community resources as well.
|
||||
27
joplin notion extension/linux/Arch/waydroid.md
Normal file
27
joplin notion extension/linux/Arch/waydroid.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
waydroid
|
||||
https://github.com/n1lby73/waydroid-installer
|
||||
https://wiki.archlinux.org/title/Waydroid
|
||||
|
||||
- Installation
|
||||
`yay -S waydroid` (AUR package)
|
||||
- Prerequisite
|
||||
As arch linux default kernel arent supported by waydroid so install another one ie `linux-zen` and its headers
|
||||
`yay -Ss linux-zen linux-zen-headers`
|
||||
Now create initrd by (in arch it is mkinitcpio)
|
||||
`mkinitcpio -p linux-zen`
|
||||
Then finally include it in grub file by
|
||||
`grub-mkconfig -o /boot/grub/grub.cfg` and `reboot`
|
||||
and in `Advanced options for arch linux` select `linux-zen` kernel
|
||||
- Initialization
|
||||
Run `sudo waydroid init`
|
||||
It will check in the directory `/usr/images/waydroid-extra/images` if image and vendors are installed or not. If not installed then it will install them of lineageOS in the directory `var/lib/waydroid/images`
|
||||
Make sure that `waydroid-container.service` is started
|
||||
`sudo systemctl enable --now waydroid-container`
|
||||
- Usage
|
||||
Starting waydroid session
|
||||
`waydroid session start`
|
||||
Then in another terminal type
|
||||
`waydroid show-full-ui`
|
||||
|
||||
|
||||
|
||||
58
joplin notion extension/linux/Archiving.md
Normal file
58
joplin notion extension/linux/Archiving.md
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
Archiving
|
||||
|
||||
- zip and unzip
|
||||
- Add files/directories to a specific archive:
|
||||
`zip -r path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...`
|
||||
- Archive files/directories with a specific compression level (`0` - the lowest, `9` - the highest):
|
||||
`zip -r -0..9 path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...`
|
||||
|
||||
- Create an encrypted archive with a specific password:
|
||||
`zip -r --encrypt path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...`
|
||||
- Archive files/directories to a multi-part [s]plit Zip archive (e.g. 3 GB parts):
|
||||
`zip -r -s 3g path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ...`
|
||||
|
||||
- Print a specific archive contents:
|
||||
`zip -sf path/to/compressed.zip`
|
||||
- Excluding directories or files
|
||||
`zip -r myarchive.zip target -x "target/exclude1/*" "target/exclude2/*"`
|
||||
Exclude all directories within target of particular name(can be nested deep too)
|
||||
`zip -r archive_name.zip /path/to/source -x "*/exclude_dir/*"`
|
||||
- Include hidden directories in zip file
|
||||
`find . -mindepth 1 -print | zip archive_name.zip -@`
|
||||
- `find .` starts the search in the current directory.
|
||||
- `mindepth 1` ensures the search does not include the current directory itself (.) in the results.
|
||||
- `print` outputs the found items.
|
||||
|
||||
|
||||
|
||||
- Extract all files/directories from specific archives into the current directory:
|
||||
`unzip path/to/archive1.zip path/to/archive2.zip ...`
|
||||
- Extract files/directories from archives to a specific path:
|
||||
`unzip path/to/archive1.zip path/to/archive2.zip ... -d path/to/output`
|
||||
|
||||
|
||||
- 7zip
|
||||
- [a]dd a file or directory to a new or existing archive:
|
||||
`7z a path/to/archive.7z path/to/file_or_directory`
|
||||
- Encrypt an existing archive (including filenames):
|
||||
`7z a path/to/encrypted.7z -ppassword -mhe=on path/to/archive.7z`
|
||||
|
||||
- E[x]tract an archive preserving the original directory structure:
|
||||
`7z x path/to/archive.7z`
|
||||
|
||||
- E[x]tract an archive to a specific directory:
|
||||
`7z x path/to/archive.7z -opath/to/output`
|
||||
|
||||
- E[x]tract an archive to `stdout`:
|
||||
`7z x path/to/archive.7z -so`
|
||||
|
||||
- [a]rchive using a specific archive type:
|
||||
`7z a -t7z|bzip2|gzip|lzip|tar|zip path/to/archive path/to/file_or_directory`
|
||||
|
||||
- [l]ist the contents of an archive:
|
||||
`7z l path/to/archive.7z`
|
||||
|
||||
- Set the level of compression (higher means more compression, but slower):
|
||||
`7z a path/to/archive.7z -mx=0|1|3|5|7|9 path/to/file_or_directory`
|
||||
|
||||
|
||||
342
joplin notion extension/linux/Bash Basics.md
Normal file
342
joplin notion extension/linux/Bash Basics.md
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
Bash Basics
|
||||
https://devhints.io/bash
|
||||
|
||||
**Note**
|
||||
- for executing commands if uses single quotes then it will pass literal text , double quotes allows commands and variables to be execured
|
||||
|
||||
|
||||
- for loop
|
||||
```bash
|
||||
for arg in "$@"; do
|
||||
echo "$arg"
|
||||
done
|
||||
|
||||
for (( i=0;i<$filesCount;i++)); do
|
||||
singleFile="${filesArray[$i]}"
|
||||
#here I replace ALL the spaces in the file's name, by underscores.
|
||||
trimmed=${singleFile// /\_}
|
||||
mv "${singleFile}" "${trimmed}"
|
||||
echo "renamed ${singleFile} as ${trimmed} !"
|
||||
done
|
||||
```
|
||||
- if elif else
|
||||
set of if else statements are terminated with fi
|
||||
```bash
|
||||
# String
|
||||
if [[ -z "$string" ]]; then
|
||||
echo "String is empty"
|
||||
elif [[ -n "$string" ]]; then
|
||||
echo "String is not empty"
|
||||
else
|
||||
echo "This never happens"
|
||||
fi
|
||||
|
||||
```
|
||||
- Logical operators
|
||||
```bash
|
||||
# Logical AND and OR
|
||||
if [[ $varA == 1 && ($varB == "t1" || $varC == "t2") ]]; then
|
||||
|
||||
# NOT
|
||||
if ! [[ $var == 2 || $var == 30 || $var == 50 ]] ; then
|
||||
do something
|
||||
fi
|
||||
if [[ ! ($var == 2 || $var == 30 || $var == 50) ]] ; then
|
||||
do something
|
||||
fi
|
||||
|
||||
|
||||
```
|
||||
- Functions
|
||||
```bash
|
||||
myfunc() {
|
||||
echo "hello $1"
|
||||
}
|
||||
|
||||
# Same as above (alternate syntax)
|
||||
function myfunc {
|
||||
echo "hello $1"
|
||||
}
|
||||
|
||||
myfunc "John"
|
||||
|
||||
|
||||
# Returning values
|
||||
myfunc() {
|
||||
local myresult='some value'
|
||||
echo "$myresult"
|
||||
}
|
||||
|
||||
result=$(myfunc)
|
||||
|
||||
|
||||
|
||||
```
|
||||
- Geting filename and extemsion
|
||||
```bash
|
||||
# First, get file name without the path:
|
||||
|
||||
filename=$(basename -- "$fullfile")
|
||||
# or
|
||||
filename="${FILEPATH##*/}"
|
||||
extension_only="${filename##*.}"
|
||||
filename_with_noext="${filename%.*}"
|
||||
|
||||
```
|
||||
- array
|
||||
```bash
|
||||
# Declaring an array
|
||||
arr=()
|
||||
arr1=("hey" "there" "how")
|
||||
arr2=("er" "yu")
|
||||
declare -a arr3=()
|
||||
|
||||
# Declare associative array to be able to have keys rather than index
|
||||
declare -A asscoArr
|
||||
|
||||
# array elements is "${arr1[@]}"
|
||||
for ele in "${arr1[@]}";do
|
||||
echo $ele
|
||||
done
|
||||
|
||||
# Output
|
||||
hey
|
||||
there
|
||||
how
|
||||
|
||||
# array index/keys is "${!arr1[@]}"
|
||||
for i in "${!arr1[@]}";do
|
||||
echo $i
|
||||
done
|
||||
|
||||
# Accessing elements through index
|
||||
"${arr1[2]}"
|
||||
|
||||
# getting length of array
|
||||
${#arr1[@]}
|
||||
|
||||
```
|
||||
- shift
|
||||
To shift arguments to left so that first argument is lost
|
||||
- C like switch case in bash
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Loop through all the arguments
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-a|--optionA)
|
||||
echo "Option A detected!"
|
||||
# handle option A
|
||||
;;
|
||||
-b|--optionB)
|
||||
echo "Option B detected!"
|
||||
# handle option B
|
||||
;;
|
||||
*)
|
||||
# Handle positional arguments or invalid flags
|
||||
;;
|
||||
esac
|
||||
done
|
||||
```
|
||||
- pasing variable arguments
|
||||
```bash
|
||||
# Define your arguments in an array
|
||||
passargs=(-x '*/node_modules/*')
|
||||
|
||||
# Use the array with the command
|
||||
zip -r archive.zip . "${passargs[@]}"
|
||||
|
||||
|
||||
# following method wont work
|
||||
|
||||
passargs="'-x */node_modules/*'"
|
||||
zip -r $ARCHIVE_NAME $FILES_TO_ARCHIVE $passargs
|
||||
```
|
||||
- convert string which r separted by spaces to array
|
||||
using declare will resolve some bugs related to delimiters
|
||||
```bash
|
||||
# arrow looks like following
|
||||
arr1=('hey' 'there')
|
||||
# if
|
||||
str="hey there"
|
||||
declare -a arr=($str)
|
||||
# now
|
||||
# arr is ('hey' 'there')
|
||||
```
|
||||
- extract parent directory
|
||||
```bash
|
||||
// Output : /home/username
|
||||
echo "$PWD"
|
||||
|
||||
// Output : /home
|
||||
echo "${dirname $PWD}"
|
||||
|
||||
|
||||
```
|
||||
### Examples
|
||||
|
||||
- Find non common elements from 2 array
|
||||
```bash
|
||||
distinctive_files(){
|
||||
|
||||
# dir1=$1
|
||||
# dir2=$2
|
||||
|
||||
# arr1=( $( ls $dir1 ) )
|
||||
# arr2=( $( ls $dir2 ) )
|
||||
|
||||
declare -a arr1=("er" "rt")
|
||||
declare -a arr2=("er" "rt" "ty")
|
||||
|
||||
# echo "arr1: ${arr1[@]}"
|
||||
# echo "arr2: ${arr2[@]}"
|
||||
|
||||
declare -A all_Elements
|
||||
common_Files=()
|
||||
distinct_Files=()
|
||||
|
||||
for elem in "${arr1[@]}";do
|
||||
# echo "elem arr1: $elem"
|
||||
((all_Elements[$elem]++))
|
||||
# echo "arr1 all_Elements: ${all_Elements[$elem]}"
|
||||
done
|
||||
|
||||
for elem in "${arr2[@]}";do
|
||||
# echo "elem arr2: $elem"
|
||||
((all_Elements[$elem]++))
|
||||
# echo "arr2 all_Elements: ${all_Elements[$elem]}"
|
||||
done
|
||||
|
||||
# echo "Non common elements:"
|
||||
for key in "${!all_Elements[@]}" ; do
|
||||
if [ ${all_Elements[$key]} -eq 1 ]; then
|
||||
|
||||
distinct_Files+=($key)
|
||||
fi
|
||||
# echo "key: $key"
|
||||
done
|
||||
|
||||
echo "${distinct_Files[@]}"
|
||||
|
||||
# Calling function
|
||||
disti=$(distinctive_files)
|
||||
|
||||
```
|
||||
- Pass 2 arrays as arguments in bash
|
||||
```bash
|
||||
# by passing number of elements of each array
|
||||
myFunc(){
|
||||
local n1=$1
|
||||
local n2=$2
|
||||
shift 2
|
||||
local arr=("$@")
|
||||
arr1=()
|
||||
arr2=()
|
||||
i=0
|
||||
for ele in "${arr[@]}"; do
|
||||
echo "ele: $ele"
|
||||
if [[ i -ge $n1 ]]; then
|
||||
arr2+=($ele)
|
||||
else
|
||||
arr1+=($ele)
|
||||
fi
|
||||
((i++))
|
||||
done
|
||||
|
||||
echo "arr1 ${arr1[@]}"
|
||||
echo "arr2 ${arr2[@]}"
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare -a arr1=("er" "rt")
|
||||
declare -a arr2=("er" "rt" "ty")
|
||||
|
||||
(added_zipped_files ${#arr1[@]} ${#arr2[@]} ${arr1[@]} ${arr2[@]})
|
||||
|
||||
|
||||
|
||||
# by passing reference(from bash 4.3 released in year 2016)
|
||||
demo_multiple_arrays() {
|
||||
local -n _array_one=$1
|
||||
local -n _array_two=$2
|
||||
printf '1: %q\n' "${_array_one[@]}"
|
||||
printf '2: %q\n' "${_array_two[@]}"
|
||||
}
|
||||
|
||||
array_one=( "one argument" "another argument" )
|
||||
array_two=( "array two part one" "array two part two" )
|
||||
|
||||
demo_multiple_arrays array_one array_two
|
||||
|
||||
```
|
||||
- Append certain character
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a file name is provided as an argument
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <filename>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the file exists
|
||||
if [ ! -f "$1" ]; then
|
||||
echo "File '$1' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Append semicolon to each line in the file
|
||||
while IFS= read -r line; do
|
||||
echo "$line;"
|
||||
done < "$1" > "$1.tmp"
|
||||
|
||||
# Replace the original file with the modified one
|
||||
mv "$1.tmp" "$1"
|
||||
|
||||
echo "Semicolons appended to each line in '$1'."
|
||||
|
||||
```
|
||||
- to display ram of top processes based on ram
|
||||
```sh
|
||||
#!/bin/zsh
|
||||
|
||||
echo "Command PSS (MB)"
|
||||
echo "================================================="
|
||||
|
||||
smem -c "command pss" |
|
||||
awk '{
|
||||
cmd=$1; pss=$2; uss=$3; rss=$4;
|
||||
pssTotal[cmd]+=pss; ussTotal[cmd]+=uss; rssTotal[cmd]+=rss;
|
||||
} END {
|
||||
for (cmd in pssTotal) {
|
||||
# Convert from KB to MB
|
||||
pssMB = pssTotal[cmd] / 1024;
|
||||
printf "%-35s %10.2f MB\n", cmd, pssMB;
|
||||
}
|
||||
}' | sort -k 2 -nr | head -n 10
|
||||
```
|
||||
- random string generation
|
||||
random 16 character alphanumeric string
|
||||
`tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 16; echo ''`
|
||||
pure bash
|
||||
```sh
|
||||
# Define allowed character set
|
||||
chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
|
||||
length=16
|
||||
result=''
|
||||
|
||||
for ((i=0; i<length; i++)); do
|
||||
result+="${chars:RANDOM%${#chars}:1}"
|
||||
done
|
||||
|
||||
echo "$result"
|
||||
|
||||
```
|
||||
|
||||
|
||||
for have single quotes in literal in bash
|
||||
```bash
|
||||
ffmpeg -i 'The Witcher 3 In the Eternal Fire'\''s Shadow p1.mp4' -o ...
|
||||
```
|
||||
416
joplin notion extension/linux/Basics.md
Normal file
416
joplin notion extension/linux/Basics.md
Normal file
|
|
@ -0,0 +1,416 @@
|
|||
Basics
|
||||
https://linuxcommandlibrary.com/
|
||||
|
||||
- https://www.howtogeek.com/269509/how-to-run-two-or-more-terminal-commands-at-once-in-linux/
|
||||
|
||||
Option One: The Semicolon (;) Operator
|
||||
The semicolon (;) operator allows you to execute multiple commands in succession, regardless of whether each previous command succeeds. For example, open a Terminal window (Ctrl+Alt+T in Ubuntu and Linux Mint). Then, type the following three commands on one line, separated by semicolons, and press Enter. This will give you a listing of the current directory
|
||||
|
||||
Option Two: The Logical AND Operator (&&)
|
||||
If you want the second command to only run if the first command is successful, separate the commands with the logical AND operator, which is two ampersands ( && ). For example, we want to make a directory called MyFolder and then change to that directory--provided it was successfully created. So, we type the following on the command line and press Enter.
|
||||
|
||||
Option Three: The Logical OR Operator (||)
|
||||
Sometimes you might want to execute a second command only if the first command does not succeed. To do this, we use the logical OR operator, or two vertical bars ( || ). For example, we want to check to see if the MyFolder directory exists ( \[ -d ~/MyFolder \] ) and create it if it doesn't ( mkdir ~/MyFolder ). So, we type the following command at the prompt and press Enter.
|
||||
|
||||
|
||||
- bash cheatsheet
|
||||
```bash
|
||||
A; B # Run A and then B, regardless of success of A
|
||||
A && B # Run B if and only if A succeeded
|
||||
A || B # Run B if and only if A failed
|
||||
A & # Run A in background.
|
||||
A & B & : # Run A in background, then run B in background (regardless of success) and return control to the shell
|
||||
```
|
||||
|
||||
- locating commands or bin files
|
||||
`which -a gdb`
|
||||
|
||||
```
|
||||
which: no gdb in (/home/hpm/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin)
|
||||
|
||||
```
|
||||
|
||||
rt
|
||||
`locate -eb '\gdb'`
|
||||
|
||||
ed
|
||||
|
||||
```bash
|
||||
/usr/share/gdb
|
||||
/usr/share/bash-completion/completions/gdb
|
||||
/usr/share/glib-2.0/gdb
|
||||
/usr/share/gstreamer-1.0/gdb
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
- sed commands usage
|
||||
https://www.tecmint.com/linux-sed-command-tips-tricks/
|
||||
https://www.geeksforgeeks.org/sed-command-in-linux-unix-with-examples/
|
||||
|
||||
|
||||
[Sed Command in Linux_Unix with examples - GeeksforGeeks.pdf](../../_resources/Sed%20Command%20in%20Linux_Unix%20with%20examples%20-%20Geeksfor.pdf)
|
||||
|
||||
|
||||
|
||||
- List files with full path with ls
|
||||
`ls -lrt -d -1 "$PWD"/{*,.*}`
|
||||
or if u want regular expression then
|
||||
`find /path/to/start/directory -type f | awk -F/ '{print "<a href=\""$0"\">"$NF"</a>"}'`
|
||||
here path to directory is path where those files are stored
|
||||
`type -f` means to list only files
|
||||
`find /path/to/start/directory -maxdepth 1 -type f -exec sh -c 'echo "<a href=\"{}\">$(basename {})</a>"' \;` : this maxdepth flag can be used to list files only in current directroy and not go any deeper in those subdirectories
|
||||
- cp command
|
||||
to copy folder contents along with hidden files use the period(.) symbol too
|
||||
`cp -ar assets/. backup/` a is for archive means preserving metadata
|
||||
to copy files while excluding a file or directory
|
||||
`rsync -av --progress sourcefolder /destinationfolder --exclude thefoldertoexclude --exclude anotherFolderToExclude`
|
||||
Note : files to be excluded should be relative to source directory not the current directory from where this command is executed.
|
||||
|
||||
- Changing file name based on pattern
|
||||
|
||||
```bash
|
||||
for file in tomp3.cc*; do mv "$file" "${file/tomp3.cc - /}"
|
||||
done
|
||||
```
|
||||
- replacing names through like removing spaces
|
||||
`for f in *\ *; do mv "$f" "${f// /_}"; done`
|
||||
Though it's not recursive, it's quite fast and simple. I'm sure someone here could update it to be recursive.
|
||||
The `${f// /_}` part utilizes bash's parameter expansion mechanism to replace a pattern within a parameter with supplied string. The relevant syntax is `${parameter/pattern/string}`. See: https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html or http://wiki.bash-hackers.org/syntax/pe .
|
||||
- sort file names
|
||||
on basis of names
|
||||
- ascending order
|
||||
`ls *.jpg | sort -n`
|
||||
- descending order
|
||||
`ls *.jpg | sort -nr`
|
||||
|
||||
|
||||
- get ip address
|
||||
`ip addr` or `ifconfig`
|
||||
|
||||
- cat command
|
||||
1. `cat notes.txt` : to show contents of notes,txt
|
||||
2. `>` this will represent the transfer of data from left to right. If left side is empty then transfer from stdin to the file. All content of file will be replaced with stdin or whatever file on left.
|
||||
```bash
|
||||
cat > notes.txt
|
||||
> hey there
|
||||
>^C
|
||||
> cat notes.txt
|
||||
> hey there
|
||||
```
|
||||
3. `>>` will append data from left to right instead of truncaing it
|
||||
```bash
|
||||
cat >> notes.txt
|
||||
> hey there
|
||||
>^C
|
||||
> cat >> notes.txt
|
||||
> how r you
|
||||
>^C
|
||||
> cat notes.txt
|
||||
> hey there
|
||||
> how r you
|
||||
```
|
||||
|
||||
- aliases and function
|
||||
1. Functions
|
||||
```
|
||||
function packagelist {
|
||||
dpkg -l | grep "$1" | awk '{print $2}' | tr "\n" " "
|
||||
}
|
||||
packagelist gcc
|
||||
```
|
||||
Output:
|
||||
|
||||
|
||||

|
||||
|
||||
- Docs
|
||||
Install tldr package to get nicer docs. or tealdeer which is rust based
|
||||
|
||||
- Some utilties info
|
||||
tty is the terminal device a process is connected to
|
||||
it can be a physical terminal or a pseudo terminal
|
||||
`ps` is a command that displays process information
|
||||
and `tail` prints to output the last contents of a file
|
||||
by default the last 10 lines
|
||||
|
||||
`ps -eo user= | sort | uniq -c`
|
||||
one-liner counts the number of processes per user on the system
|
||||
ps -eo user= extracts only usernames with no header line (the '=' clears the custom header, which suppresses the header line entirely), sort arranges them, uniq -c counts processes per user. Without '=', the header row 'USER' itself would be counted as one entry.
|
||||
|
||||
- Check memory info
|
||||
`free -m`
|
||||
|
||||
- Check battery status
|
||||
To list devices
|
||||
`upower -e`
|
||||
Find battery one and get the result
|
||||
`upower -i /org/freedesktop/UPower/devices/battery_BAT0`
|
||||
|
||||
- Check desktop manager
|
||||
`systemctl list-units | grep dm.service`
|
||||
|
||||
- Check whether xorg or wayland display server
|
||||
`echo $XDG_SESSION_TYPE`
|
||||
|
||||
- last argument access
|
||||
For eg if u have used
|
||||
`mkdir test`
|
||||
Then `$_` will represent `test`
|
||||
So
|
||||
`cd $_` = `cd test`
|
||||
|
||||
- for checking CPU architecture use
|
||||
`uname -m`
|
||||
|
||||
- zswap
|
||||
compresses ram istead of using storage space
|
||||
- search for packages : pinned
|
||||
`find /usr -name '*mingw*'`
|
||||
- script for mounting multiple partitions
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
name1="mint"
|
||||
name2="manjaro"
|
||||
name3="hdd"
|
||||
name4="ssd"
|
||||
|
||||
|
||||
# Define partitions and mount points
|
||||
partition1="/dev/sda5" # mint
|
||||
partition2="/dev/sda6" # manjaro
|
||||
partition3="/dev/sda3" # hdd
|
||||
partition4="/dev/nvme0n1p3" # ssd
|
||||
mount_point1="/mnt/$name1"
|
||||
mount_point2="/mnt/$name2"
|
||||
mount_point3="/mnt/$name3"
|
||||
mount_point4="/mnt/$name4"
|
||||
|
||||
# Check if partitions are not mounted
|
||||
if ! mountpoint -q "$mount_point1"; then
|
||||
mkdir -p /mnt/$name1
|
||||
# Mount partition1
|
||||
sudo mount "$partition1" "$mount_point1"
|
||||
echo "Mounted $partition1 at $mount_point1"
|
||||
fi
|
||||
|
||||
if ! mountpoint -q "$mount_point2"; then
|
||||
mkdir -p /mnt/$name2
|
||||
# Mount partition2
|
||||
sudo mount "$partition2" "$mount_point2"
|
||||
echo "Mounted $partition2 at $mount_point2"
|
||||
fi
|
||||
|
||||
if ! mountpoint -q "$mount_point3"; then
|
||||
mkdir -p /mnt/$name3
|
||||
# Mount partition3
|
||||
sudo mount "$partition3" "$mount_point3"
|
||||
echo "Mounted $partition3 at $mount_point3"
|
||||
fi
|
||||
|
||||
if ! mountpoint -q "$mount_point4"; then
|
||||
mkdir -p /mnt/$name4
|
||||
# Mount partition4
|
||||
sudo mount "$partition4" "$mount_point4"
|
||||
echo "Mounted $partition4 at $mount_point4"
|
||||
fi
|
||||
|
||||
```
|
||||
|
||||
- size of folders and files
|
||||
The `du` command in Linux is a powerful utility that allows users to analyze and report on disk usage within directories and files.
|
||||
The basic syntax of the du command is as follows:
|
||||
|
||||
`du [options] [directory/file]`
|
||||
eg : `du -sh dir_name`
|
||||
- copy all files to next folder with exlcuding some directories say `src`
|
||||
`rsync -av --exclude='src' . ~/cache_bkp`
|
||||
`.` here is source and `~/cache_bkp` is destination
|
||||
- to prepend text
|
||||
// this way is working
|
||||
`echo -e "your text to prepend\n$(cat sample.txt)" > sample.txt`
|
||||
for large files
|
||||
```bash
|
||||
echo "your text to prepend" > temp.txt
|
||||
cat sample.txt >> temp.txt
|
||||
mv temp.txt sample.txt
|
||||
```
|
||||
// below way isnt working
|
||||
`cat - stringToBePrepended | tee -a sample.txt.`
|
||||
cat - reads from standard input (in this case, the stringToBePrepended).
|
||||
Step 2:
|
||||
Pipes the output of cat - text.txt to the next command.
|
||||
Step 3: tee -a sample.txt
|
||||
tee -a appends the input to the sample.txt file.
|
||||
The -a option tells tee to append to the file instead of overwriting it.
|
||||
Overall effect:
|
||||
The cat - text.txt | tee -a sample.txt command reads the contents of text.txt, appends them to sample.txt, and also outputs them to the terminal. This effectively prepends the contents of text.txt to sample.txt.
|
||||
Harsh Truth
|
||||
—
|
||||
Today at 12:20 AM
|
||||
|
||||
- Looping thorugh all arguments in bash
|
||||
```bash
|
||||
for arg in "$@"; do
|
||||
echo "arg: $arg"
|
||||
done
|
||||
```
|
||||
- Detecting flags in bash
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Loop through all the arguments
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-a|--optionA)
|
||||
echo "Option A detected!"
|
||||
# handle option A
|
||||
;;
|
||||
-b|--optionB)
|
||||
echo "Option B detected!"
|
||||
# handle option B
|
||||
;;
|
||||
*)
|
||||
# Handle positional arguments or invalid flags
|
||||
;;
|
||||
esac
|
||||
done
|
||||
```
|
||||
- sed
|
||||
`sed -i 's/\(<string>\)\.md/\1/' your_file.txt`
|
||||
This command captures the `<string>` before .md using parentheses and then replaces the entire match (including .md) with just `<string>`, effectively removing the .md extension when it follows `<string>`.
|
||||
- Copy multiple files to a directory
|
||||
`cp -t path/to/destination_directory path/to/file1 path/to/file2 ...`
|
||||
- Copy multiple directories to a directory(copy `dir1` `dir2` to `targetDir`)
|
||||
`cp -r dir1 dir2 targetDir/`
|
||||
- Move multiple directories to directory
|
||||
`mv -t path/to/destination_directory path/to/file1 path/to/file2 ...`
|
||||
- Login to different user
|
||||
`sudo su - <user_name>` and `exit` to exit
|
||||
- User management
|
||||
https://www.freecodecamp.org/news/how-to-manage-users-in-linux/
|
||||
- Adding user
|
||||
`useradd -u 1002 -d /home/john -s /bin/bash john`
|
||||
or
|
||||
`useradd -u 1002 -d /home/john -s /bin/bash john -g johnGroup -c comments`
|
||||
- Getting user names
|
||||
Users and their other informatio separated by colons can be accessed by
|
||||
`cat /etc/passwd`
|
||||
To get only users
|
||||
`awk -F: '{ print $1}' /etc/passwd`
|
||||
Get users which can be logined
|
||||
`getent passwd {1000..60000}`
|
||||
1000 is min UID and 60000 is max UID. They may be different so find them using
|
||||
`grep -E '^UID_MIN|^UID_MAX' /etc/login.defs`
|
||||
following for users with uid and gid
|
||||
`cut -d: -f1-4 /etc/passwd`
|
||||
- Getting group names
|
||||
`cat /etc/group`
|
||||
or
|
||||
`cut -d: -f1 /etc/group | sort` (for readable form)
|
||||
- get group names for a user
|
||||
`groups $USER`
|
||||
`id $USER`
|
||||
- Password setup
|
||||
After creatiing user before login in we can setup password by
|
||||
`sudo passwd john`
|
||||
- Adding permissions
|
||||
By default when user is created he dont have permission to write anything there so he cant create any directory or file too in his own home directory. Before login in type this
|
||||
`sudo chown test:test /home/test`
|
||||
|
||||
- Adding user to group
|
||||
https://serverfault.com/questions/688685/usermod-ag-vs-gpasswd-a-as-a-best-practice
|
||||
`sudo gpasswd -a $USER groupname`
|
||||
or
|
||||
`sudo usermod -aG groupname username`
|
||||
or for adding user to multiple groups
|
||||
`sudo usermod -aG additional_groups username`
|
||||
`additional_groups` : comma separated list of groups
|
||||
- Ensure group changes to take effect
|
||||
`newgrp group_name`
|
||||
- Allowing user to use sudo
|
||||
Uncomment the line starring `$ sudo ...` then
|
||||
`sudo usermod -aG sudo username` so add user to sudo group
|
||||
`-aG` means adding user to group
|
||||
or use
|
||||
`sudo usermod -aG wheel username` if u dont wanna uncomment sudo and use wheel instead
|
||||
wheel will grant user priviledge to use sudo command
|
||||
To remove users from group 'wheel'
|
||||
`sudo gpasswd -d username wheel`
|
||||
- Changing ownership
|
||||
`chown -c john file.txt` (for users)
|
||||
or
|
||||
`chown -c :johnGroup file.txt` (for groups)
|
||||
`-c` for reporting
|
||||
for directories use
|
||||
`chown -R -c john file.txt` (for users)
|
||||
- Running command as different user without login
|
||||
`su - username -c 'command'`
|
||||
or
|
||||
`sudo -u username command`
|
||||
- Granting permissions
|
||||
to all root access priviledges to the user then
|
||||
add this to sudoers file (location : /etc/sudoers)
|
||||
`username ALL=(ALL:ALL) ALL` (very dangerous config so avoid it as much as possible as it will grant nlimited access too)
|
||||
when installing distro first user can use cd or ls command in directories without use of sudo so do this
|
||||
`sudo usermod -aG autologin $USER` to add ability as same of first user
|
||||
if it doesnt work then check permissions and using chmod change
|
||||
- Extended partition. access grant of directory can be `drwxr-x--x+` here `+` at end stands for extended permissions means other user cant access its directories even if is set `x` permission in others. Extended permissions is honored by fish shell but not bash shell may not honor it. to change it use `setfactl` and to get its detail use `getfactl`
|
||||
To add extended permissions use
|
||||
`setfacl -R u:user2:wrx /tmp`
|
||||
to remove
|
||||
`setfacl -bn /tmp`
|
||||
- to check permissions of directory simply instead of all files in it use `ls -ld <dirpath>`
|
||||
- For searching files
|
||||
`find /home/user/ | grep filenamehere`
|
||||
- launch other user files with this
|
||||
`sudo -e /path/to/other/users/binary`
|
||||
`-e` preserves your current user's environment variables etc. so audio should work
|
||||
- change to new user
|
||||
`sudo su - test`
|
||||
- for searching files with particular extension also listing their meta data
|
||||
`find . -type f -name "*.ess" -exec ls -l {} +`
|
||||
- for searching with min length 1 mb
|
||||
`find -size +1M`
|
||||
- scrolling in terminal
|
||||
TIL that u can scroll in terminal with `SHIFT+PGUP/PGDOWN`
|
||||
- useful commands
|
||||
to count number of files in current directory
|
||||
```sh
|
||||
ls | wc -l
|
||||
```
|
||||
- tar and cpio
|
||||
cpio
|
||||
```bash
|
||||
# creating archive of text files to archive.cpio
|
||||
find *.txt | cpio -o > archive.cpio
|
||||
|
||||
# extracting content to current directory
|
||||
cpio -i < ../archive.cpio
|
||||
```
|
||||
- to search for content recurseively across all files in a directory
|
||||
`grep -r hello <directory_path>`
|
||||
- resources, basic command video
|
||||
https://youtu.be/QhvDvpyvPSE
|
||||
```txt
|
||||
Nick, tell the beginners use 'trash' instead of 'delete, to retain file availability.
|
||||
Nick, tell the beginners that 'pwd' is NOT password.
|
||||
Nick, tell the beginners that 'cd -' takes them between recent directories.
|
||||
Nick, tell the beginners that Windows says 'folders', but Linux says 'directories'.
|
||||
Nick, tell the beginners that uppercase and lowercase letters denote DIFFERENT things in Linux.
|
||||
```
|
||||
- `arp -a` to get list of all otheer ip address of systems connected to same network
|
||||
- find number of files and directories recursively in given directory
|
||||
`find . -type f | wc -l` for files
|
||||
`find . -type d | wc -l` for directories
|
||||
|
||||
- to identify distro u r using
|
||||
`cat /etc/os-release `
|
||||
- to see disk space left for each partitions
|
||||
`df -h`
|
||||
|
||||
|
||||
for resumable downloads use `-c` in wget
|
||||
`wget -c https://example.com`
|
||||
225
joplin notion extension/linux/Configuring bash autocomplete.md
Normal file
225
joplin notion extension/linux/Configuring bash autocomplete.md
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
Configuring bash autocomplete
|
||||
|
||||
- Syntax highlighting in bash
|
||||
https://superuser.com/questions/304211/is-there-any-way-to-get-bash-to-have-syntax-highlighting-like-fish
|
||||
|
||||
https://github.com/akinomyoga/ble.sh
|
||||
[blesh bakup.7z](../../_resources/blesh%20bakup.7z)
|
||||
|
||||
|
||||
Run these commands
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/akinomyoga/ble.sh.git
|
||||
$ cd ble.sh
|
||||
$ make
|
||||
$ make INSDIR="$HOME/.local/share/blesh" install
|
||||
```
|
||||
Then type in this `~/.bashrc`
|
||||
```
|
||||
# bashrc
|
||||
|
||||
# Add the following line at the beginning of bashrc
|
||||
[[ $- == *i* ]] &&
|
||||
source "$HOME/.local/share/blesh/ble.sh" --attach=none
|
||||
|
||||
# ... other bashrc settings ...
|
||||
|
||||
# Add the following line at the end of bashrc
|
||||
[[ ${BLE_VERSION-} ]] && ble-attach
|
||||
|
||||
```
|
||||
|
||||
new method
|
||||
```
|
||||
# TRIAL without installation
|
||||
|
||||
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
|
||||
make -C ble.sh
|
||||
source ble.sh/out/ble.sh
|
||||
|
||||
# Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3)
|
||||
|
||||
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
|
||||
make -C ble.sh install PREFIX=~/.local
|
||||
echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc
|
||||
```
|
||||
|
||||
|
||||
Output:
|
||||
|
||||
```text
|
||||
bash make_command.sh install "out/ble.sh" "/home/hpes/.local/share/blesh/ble.sh"
|
||||
bash make_command.sh install "out/lib/keymap.emacs.sh" "/home/hpes/.local/share/blesh/lib/keymap.emacs.sh"
|
||||
bash make_command.sh install "out/lib/keymap.vi.sh" "/home/hpes/.local/share/blesh/lib/keymap.vi.sh"
|
||||
bash make_command.sh install "out/lib/keymap.vi_digraph.sh" "/home/hpes/.local/share/blesh/lib/keymap.vi_digraph.sh"
|
||||
bash make_command.sh install "out/lib/keymap.vi_digraph.txt" "/home/hpes/.local/share/blesh/lib/keymap.vi_digraph.txt"
|
||||
bash make_command.sh install "out/lib/init-term.sh" "/home/hpes/.local/share/blesh/lib/init-term.sh"
|
||||
bash make_command.sh install "out/lib/init-bind.sh" "/home/hpes/.local/share/blesh/lib/init-bind.sh"
|
||||
bash make_command.sh install "out/lib/init-cmap.sh" "/home/hpes/.local/share/blesh/lib/init-cmap.sh"
|
||||
bash make_command.sh install "out/lib/init-msys1.sh" "/home/hpes/.local/share/blesh/lib/init-msys1.sh"
|
||||
bash make_command.sh install "out/lib/core-complete.sh" "/home/hpes/.local/share/blesh/lib/core-complete.sh"
|
||||
bash make_command.sh install "out/lib/core-syntax.sh" "/home/hpes/.local/share/blesh/lib/core-syntax.sh"
|
||||
bash make_command.sh install "out/lib/core-test.sh" "/home/hpes/.local/share/blesh/lib/core-test.sh"
|
||||
bash make_command.sh install "out/lib/core-cmdspec.sh" "/home/hpes/.local/share/blesh/lib/core-cmdspec.sh"
|
||||
bash make_command.sh install "out/lib/core-debug.sh" "/home/hpes/.local/share/blesh/lib/core-debug.sh"
|
||||
bash make_command.sh install "out/lib/core-edit.ignoreeof-messages.txt" "/home/hpes/.local/share/blesh/lib/core-edit.ignoreeof-messages.txt"
|
||||
bash make_command.sh install "out/lib/core-decode.emacs-rlfunc.txt" "/home/hpes/.local/share/blesh/lib/core-decode.emacs-rlfunc.txt"
|
||||
bash make_command.sh install "out/lib/core-decode.vi_imap-rlfunc.txt" "/home/hpes/.local/share/blesh/lib/core-decode.vi_imap-rlfunc.txt"
|
||||
bash make_command.sh install "out/lib/core-decode.vi_nmap-rlfunc.txt" "/home/hpes/.local/share/blesh/lib/core-decode.vi_nmap-rlfunc.txt"
|
||||
bash make_command.sh install "out/lib/vim-surround.sh" "/home/hpes/.local/share/blesh/lib/vim-surround.sh"
|
||||
bash make_command.sh install "out/lib/vim-arpeggio.sh" "/home/hpes/.local/share/blesh/lib/vim-arpeggio.sh"
|
||||
bash make_command.sh install "out/lib/vim-airline.sh" "/home/hpes/.local/share/blesh/lib/vim-airline.sh"
|
||||
bash make_command.sh install "out/lib/test-bash.sh" "/home/hpes/.local/share/blesh/lib/test-bash.sh"
|
||||
bash make_command.sh install "out/lib/test-main.sh" "/home/hpes/.local/share/blesh/lib/test-main.sh"
|
||||
bash make_command.sh install "out/lib/test-util.sh" "/home/hpes/.local/share/blesh/lib/test-util.sh"
|
||||
bash make_command.sh install "out/lib/test-canvas.sh" "/home/hpes/.local/share/blesh/lib/test-canvas.sh"
|
||||
bash make_command.sh install "out/lib/test-decode.sh" "/home/hpes/.local/share/blesh/lib/test-decode.sh"
|
||||
bash make_command.sh install "out/lib/test-edit.sh" "/home/hpes/.local/share/blesh/lib/test-edit.sh"
|
||||
bash make_command.sh install "out/lib/test-syntax.sh" "/home/hpes/.local/share/blesh/lib/test-syntax.sh"
|
||||
bash make_command.sh install "out/lib/test-complete.sh" "/home/hpes/.local/share/blesh/lib/test-complete.sh"
|
||||
bash make_command.sh install "out/lib/test-keymap.vi.sh" "/home/hpes/.local/share/blesh/lib/test-keymap.vi.sh"
|
||||
bash make_command.sh install "out/lib/util.bgproc.sh" "/home/hpes/.local/share/blesh/lib/util.bgproc.sh"
|
||||
bash make_command.sh install "out/lib/benchmark.ksh" "/home/hpes/.local/share/blesh/lib/benchmark.ksh"
|
||||
bash make_command.sh install "out/contrib/colorglass.bash" "/home/hpes/.local/share/blesh/contrib/colorglass.bash"
|
||||
bash make_command.sh install "out/contrib/histdb.bash" "/home/hpes/.local/share/blesh/contrib/histdb.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-defer.bash" "/home/hpes/.local/share/blesh/contrib/prompt-defer.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-elapsed.bash" "/home/hpes/.local/share/blesh/contrib/prompt-elapsed.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-git.bash" "/home/hpes/.local/share/blesh/contrib/prompt-git.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-vim-mode.bash" "/home/hpes/.local/share/blesh/contrib/prompt-vim-mode.bash"
|
||||
bash make_command.sh install "out/contrib/airline/atomic.bash" "/home/hpes/.local/share/blesh/contrib/airline/atomic.bash"
|
||||
bash make_command.sh install "out/contrib/airline/dark.bash" "/home/hpes/.local/share/blesh/contrib/airline/dark.bash"
|
||||
bash make_command.sh install "out/contrib/airline/dark_minimal.bash" "/home/hpes/.local/share/blesh/contrib/airline/dark_minimal.bash"
|
||||
bash make_command.sh install "out/contrib/airline/google_dark.bash" "/home/hpes/.local/share/blesh/contrib/airline/google_dark.bash"
|
||||
bash make_command.sh install "out/contrib/airline/google_light.bash" "/home/hpes/.local/share/blesh/contrib/airline/google_light.bash"
|
||||
bash make_command.sh install "out/contrib/airline/landscape.bash" "/home/hpes/.local/share/blesh/contrib/airline/landscape.bash"
|
||||
bash make_command.sh install "out/contrib/airline/light.bash" "/home/hpes/.local/share/blesh/contrib/airline/light.bash"
|
||||
bash make_command.sh install "out/contrib/airline/minimalist.bash" "/home/hpes/.local/share/blesh/contrib/airline/minimalist.bash"
|
||||
bash make_command.sh install "out/contrib/airline/monochrome.bash" "/home/hpes/.local/share/blesh/contrib/airline/monochrome.bash"
|
||||
bash make_command.sh install "out/contrib/airline/solarized.bash" "/home/hpes/.local/share/blesh/contrib/airline/solarized.bash"
|
||||
bash make_command.sh install "out/contrib/airline/solarized_flood.bash" "/home/hpes/.local/share/blesh/contrib/airline/solarized_flood.bash"
|
||||
bash make_command.sh install "out/contrib/airline/term.bash" "/home/hpes/.local/share/blesh/contrib/airline/term.bash"
|
||||
bash make_command.sh install "out/contrib/airline/term_light.bash" "/home/hpes/.local/share/blesh/contrib/airline/term_light.bash"
|
||||
bash make_command.sh install "out/contrib/airline/transparent.bash" "/home/hpes/.local/share/blesh/contrib/airline/transparent.bash"
|
||||
bash make_command.sh install "out/contrib/airline/xtermlight.bash" "/home/hpes/.local/share/blesh/contrib/airline/xtermlight.bash"
|
||||
bash make_command.sh install "out/contrib/config/execmark.bash" "/home/hpes/.local/share/blesh/contrib/config/execmark.bash"
|
||||
bash make_command.sh install "out/contrib/config/github265-prompt-path-level-colors.bash" "/home/hpes/.local/share/blesh/contrib/config/github265-prompt-path-level-colors.bash"
|
||||
bash make_command.sh install "out/contrib/config/github288-filter-sabbrev-completion.bash" "/home/hpes/.local/share/blesh/contrib/config/github288-filter-sabbrev-completion.bash"
|
||||
bash make_command.sh install "out/contrib/config/github296-named-execmark.bash" "/home/hpes/.local/share/blesh/contrib/config/github296-named-execmark.bash"
|
||||
bash make_command.sh install "out/contrib/config/github302-perlre-server.bash" "/home/hpes/.local/share/blesh/contrib/config/github302-perlre-server.bash"
|
||||
bash make_command.sh install "out/contrib/integration/bash-preexec.bash" "/home/hpes/.local/share/blesh/contrib/integration/bash-preexec.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-completion.bash" "/home/hpes/.local/share/blesh/contrib/integration/fzf-completion.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-git.bash" "/home/hpes/.local/share/blesh/contrib/integration/fzf-git.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-initialize.bash" "/home/hpes/.local/share/blesh/contrib/integration/fzf-initialize.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-key-bindings.bash" "/home/hpes/.local/share/blesh/contrib/integration/fzf-key-bindings.bash"
|
||||
bash make_command.sh install "out/contrib/integration/nix-completion.bash" "/home/hpes/.local/share/blesh/contrib/integration/nix-completion.bash"
|
||||
bash make_command.sh install "out/contrib/integration/zoxide.bash" "/home/hpes/.local/share/blesh/contrib/integration/zoxide.bash"
|
||||
bash make_command.sh install "out/contrib/layer/pattern.bash" "/home/hpes/.local/share/blesh/contrib/layer/pattern.bash"
|
||||
bash make_command.sh install "out/contrib/layer/sample.adapter.bash" "/home/hpes/.local/share/blesh/contrib/layer/sample.adapter.bash"
|
||||
bash make_command.sh install "out/contrib/layer/sample.RandomColor2.bash" "/home/hpes/.local/share/blesh/contrib/layer/sample.RandomColor2.bash"
|
||||
bash make_command.sh install "out/contrib/layer/sample.RandomColor.bash" "/home/hpes/.local/share/blesh/contrib/layer/sample.RandomColor.bash"
|
||||
bash make_command.sh install "out/contrib/bash-preexec.bash" "/home/hpes/.local/share/blesh/contrib/bash-preexec.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-completion.bash" "/home/hpes/.local/share/blesh/contrib/fzf-completion.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-git.bash" "/home/hpes/.local/share/blesh/contrib/fzf-git.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-initialize.bash" "/home/hpes/.local/share/blesh/contrib/fzf-initialize.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-key-bindings.bash" "/home/hpes/.local/share/blesh/contrib/fzf-key-bindings.bash"
|
||||
bash make_command.sh install "out/doc/README.md" "/home/hpes/.local/share/doc/blesh/README.md"
|
||||
bash make_command.sh install "out/doc/README-ja_JP.md" "/home/hpes/.local/share/doc/blesh/README-ja_JP.md"
|
||||
bash make_command.sh install "out/doc/CONTRIBUTING.md" "/home/hpes/.local/share/doc/blesh/CONTRIBUTING.md"
|
||||
bash make_command.sh install "out/doc/ChangeLog.md" "/home/hpes/.local/share/doc/blesh/ChangeLog.md"
|
||||
bash make_command.sh install "out/doc/Release.md" "/home/hpes/.local/share/doc/blesh/Release.md"
|
||||
bash make_command.sh install "out/doc/contrib/README-ja.md" "/home/hpes/.local/share/doc/blesh/contrib/README-ja.md"
|
||||
bash make_command.sh install "out/doc/contrib/README.md" "/home/hpes/.local/share/doc/blesh/contrib/README.md"
|
||||
bash make_command.sh install "out/doc/LICENSE.md" "/home/hpes/.local/share/doc/blesh/LICENSE.md"
|
||||
bash make_command.sh install "out/doc/contrib/LICENSE" "/home/hpes/.local/share/doc/blesh/contrib/LICENSE"
|
||||
mkdir -p /home/hpes/.local/share/blesh/cache.d && chmod a+rwxt /home/hpes/.local/share/blesh/cache.d
|
||||
mkdir -p /home/hpes/.local/share/blesh/run && chmod a+rwxt /home/hpes/.local/share/blesh/run
|
||||
```
|
||||
when using insdir flag
|
||||
```
|
||||
bash make_command.sh install "out/ble.sh" "/home/snappy/.local/share/blesh/ble.sh"
|
||||
bash make_command.sh install "out/lib/keymap.emacs.sh" "/home/snappy/.local/share/blesh/lib/keymap.emacs.sh"
|
||||
bash make_command.sh install "out/lib/keymap.vi.sh" "/home/snappy/.local/share/blesh/lib/keymap.vi.sh"
|
||||
bash make_command.sh install "out/lib/keymap.vi_digraph.sh" "/home/snappy/.local/share/blesh/lib/keymap.vi_digraph.sh"
|
||||
bash make_command.sh install "out/lib/keymap.vi_digraph.txt" "/home/snappy/.local/share/blesh/lib/keymap.vi_digraph.txt"
|
||||
bash make_command.sh install "out/lib/init-term.sh" "/home/snappy/.local/share/blesh/lib/init-term.sh"
|
||||
bash make_command.sh install "out/lib/init-bind.sh" "/home/snappy/.local/share/blesh/lib/init-bind.sh"
|
||||
bash make_command.sh install "out/lib/init-cmap.sh" "/home/snappy/.local/share/blesh/lib/init-cmap.sh"
|
||||
bash make_command.sh install "out/lib/init-msys1.sh" "/home/snappy/.local/share/blesh/lib/init-msys1.sh"
|
||||
bash make_command.sh install "out/lib/core-complete.sh" "/home/snappy/.local/share/blesh/lib/core-complete.sh"
|
||||
bash make_command.sh install "out/lib/core-syntax.sh" "/home/snappy/.local/share/blesh/lib/core-syntax.sh"
|
||||
bash make_command.sh install "out/lib/core-test.sh" "/home/snappy/.local/share/blesh/lib/core-test.sh"
|
||||
bash make_command.sh install "out/lib/core-cmdspec.sh" "/home/snappy/.local/share/blesh/lib/core-cmdspec.sh"
|
||||
bash make_command.sh install "out/lib/core-debug.sh" "/home/snappy/.local/share/blesh/lib/core-debug.sh"
|
||||
bash make_command.sh install "out/lib/core-edit.ignoreeof-messages.txt" "/home/snappy/.local/share/blesh/lib/core-edit.ignoreeof-messages.txt"
|
||||
bash make_command.sh install "out/lib/core-decode.emacs-rlfunc.txt" "/home/snappy/.local/share/blesh/lib/core-decode.emacs-rlfunc.txt"
|
||||
bash make_command.sh install "out/lib/core-decode.vi_imap-rlfunc.txt" "/home/snappy/.local/share/blesh/lib/core-decode.vi_imap-rlfunc.txt"
|
||||
bash make_command.sh install "out/lib/core-decode.vi_nmap-rlfunc.txt" "/home/snappy/.local/share/blesh/lib/core-decode.vi_nmap-rlfunc.txt"
|
||||
bash make_command.sh install "out/lib/vim-surround.sh" "/home/snappy/.local/share/blesh/lib/vim-surround.sh"
|
||||
bash make_command.sh install "out/lib/vim-arpeggio.sh" "/home/snappy/.local/share/blesh/lib/vim-arpeggio.sh"
|
||||
bash make_command.sh install "out/lib/vim-airline.sh" "/home/snappy/.local/share/blesh/lib/vim-airline.sh"
|
||||
bash make_command.sh install "out/lib/test-bash.sh" "/home/snappy/.local/share/blesh/lib/test-bash.sh"
|
||||
bash make_command.sh install "out/lib/test-main.sh" "/home/snappy/.local/share/blesh/lib/test-main.sh"
|
||||
bash make_command.sh install "out/lib/test-util.sh" "/home/snappy/.local/share/blesh/lib/test-util.sh"
|
||||
bash make_command.sh install "out/lib/test-canvas.sh" "/home/snappy/.local/share/blesh/lib/test-canvas.sh"
|
||||
bash make_command.sh install "out/lib/test-decode.sh" "/home/snappy/.local/share/blesh/lib/test-decode.sh"
|
||||
bash make_command.sh install "out/lib/test-edit.sh" "/home/snappy/.local/share/blesh/lib/test-edit.sh"
|
||||
bash make_command.sh install "out/lib/test-syntax.sh" "/home/snappy/.local/share/blesh/lib/test-syntax.sh"
|
||||
bash make_command.sh install "out/lib/test-complete.sh" "/home/snappy/.local/share/blesh/lib/test-complete.sh"
|
||||
bash make_command.sh install "out/lib/test-keymap.vi.sh" "/home/snappy/.local/share/blesh/lib/test-keymap.vi.sh"
|
||||
bash make_command.sh install "out/lib/util.bgproc.sh" "/home/snappy/.local/share/blesh/lib/util.bgproc.sh"
|
||||
bash make_command.sh install "out/lib/benchmark.ksh" "/home/snappy/.local/share/blesh/lib/benchmark.ksh"
|
||||
bash make_command.sh install "out/contrib/colorglass.bash" "/home/snappy/.local/share/blesh/contrib/colorglass.bash"
|
||||
bash make_command.sh install "out/contrib/histdb.bash" "/home/snappy/.local/share/blesh/contrib/histdb.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-defer.bash" "/home/snappy/.local/share/blesh/contrib/prompt-defer.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-elapsed.bash" "/home/snappy/.local/share/blesh/contrib/prompt-elapsed.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-git.bash" "/home/snappy/.local/share/blesh/contrib/prompt-git.bash"
|
||||
bash make_command.sh install "out/contrib/prompt-vim-mode.bash" "/home/snappy/.local/share/blesh/contrib/prompt-vim-mode.bash"
|
||||
bash make_command.sh install "out/contrib/airline/atomic.bash" "/home/snappy/.local/share/blesh/contrib/airline/atomic.bash"
|
||||
bash make_command.sh install "out/contrib/airline/dark.bash" "/home/snappy/.local/share/blesh/contrib/airline/dark.bash"
|
||||
bash make_command.sh install "out/contrib/airline/dark_minimal.bash" "/home/snappy/.local/share/blesh/contrib/airline/dark_minimal.bash"
|
||||
bash make_command.sh install "out/contrib/airline/google_dark.bash" "/home/snappy/.local/share/blesh/contrib/airline/google_dark.bash"
|
||||
bash make_command.sh install "out/contrib/airline/google_light.bash" "/home/snappy/.local/share/blesh/contrib/airline/google_light.bash"
|
||||
bash make_command.sh install "out/contrib/airline/landscape.bash" "/home/snappy/.local/share/blesh/contrib/airline/landscape.bash"
|
||||
bash make_command.sh install "out/contrib/airline/light.bash" "/home/snappy/.local/share/blesh/contrib/airline/light.bash"
|
||||
bash make_command.sh install "out/contrib/airline/minimalist.bash" "/home/snappy/.local/share/blesh/contrib/airline/minimalist.bash"
|
||||
bash make_command.sh install "out/contrib/airline/monochrome.bash" "/home/snappy/.local/share/blesh/contrib/airline/monochrome.bash"
|
||||
bash make_command.sh install "out/contrib/airline/solarized.bash" "/home/snappy/.local/share/blesh/contrib/airline/solarized.bash"
|
||||
bash make_command.sh install "out/contrib/airline/solarized_flood.bash" "/home/snappy/.local/share/blesh/contrib/airline/solarized_flood.bash"
|
||||
bash make_command.sh install "out/contrib/airline/term.bash" "/home/snappy/.local/share/blesh/contrib/airline/term.bash"
|
||||
bash make_command.sh install "out/contrib/airline/term_light.bash" "/home/snappy/.local/share/blesh/contrib/airline/term_light.bash"
|
||||
bash make_command.sh install "out/contrib/airline/transparent.bash" "/home/snappy/.local/share/blesh/contrib/airline/transparent.bash"
|
||||
bash make_command.sh install "out/contrib/airline/xtermlight.bash" "/home/snappy/.local/share/blesh/contrib/airline/xtermlight.bash"
|
||||
bash make_command.sh install "out/contrib/config/execmark.bash" "/home/snappy/.local/share/blesh/contrib/config/execmark.bash"
|
||||
bash make_command.sh install "out/contrib/config/github265-prompt-path-level-colors.bash" "/home/snappy/.local/share/blesh/contrib/config/github265-prompt-path-level-colors.bash"
|
||||
bash make_command.sh install "out/contrib/config/github288-filter-sabbrev-completion.bash" "/home/snappy/.local/share/blesh/contrib/config/github288-filter-sabbrev-completion.bash"
|
||||
bash make_command.sh install "out/contrib/config/github296-named-execmark.bash" "/home/snappy/.local/share/blesh/contrib/config/github296-named-execmark.bash"
|
||||
bash make_command.sh install "out/contrib/config/github302-perlre-server.bash" "/home/snappy/.local/share/blesh/contrib/config/github302-perlre-server.bash"
|
||||
bash make_command.sh install "out/contrib/integration/bash-preexec.bash" "/home/snappy/.local/share/blesh/contrib/integration/bash-preexec.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-completion.bash" "/home/snappy/.local/share/blesh/contrib/integration/fzf-completion.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-git.bash" "/home/snappy/.local/share/blesh/contrib/integration/fzf-git.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-initialize.bash" "/home/snappy/.local/share/blesh/contrib/integration/fzf-initialize.bash"
|
||||
bash make_command.sh install "out/contrib/integration/fzf-key-bindings.bash" "/home/snappy/.local/share/blesh/contrib/integration/fzf-key-bindings.bash"
|
||||
bash make_command.sh install "out/contrib/integration/nix-completion.bash" "/home/snappy/.local/share/blesh/contrib/integration/nix-completion.bash"
|
||||
bash make_command.sh install "out/contrib/integration/zoxide.bash" "/home/snappy/.local/share/blesh/contrib/integration/zoxide.bash"
|
||||
bash make_command.sh install "out/contrib/layer/pattern.bash" "/home/snappy/.local/share/blesh/contrib/layer/pattern.bash"
|
||||
bash make_command.sh install "out/contrib/layer/sample.adapter.bash" "/home/snappy/.local/share/blesh/contrib/layer/sample.adapter.bash"
|
||||
bash make_command.sh install "out/contrib/layer/sample.RandomColor2.bash" "/home/snappy/.local/share/blesh/contrib/layer/sample.RandomColor2.bash"
|
||||
bash make_command.sh install "out/contrib/layer/sample.RandomColor.bash" "/home/snappy/.local/share/blesh/contrib/layer/sample.RandomColor.bash"
|
||||
bash make_command.sh install "out/contrib/bash-preexec.bash" "/home/snappy/.local/share/blesh/contrib/bash-preexec.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-completion.bash" "/home/snappy/.local/share/blesh/contrib/fzf-completion.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-git.bash" "/home/snappy/.local/share/blesh/contrib/fzf-git.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-initialize.bash" "/home/snappy/.local/share/blesh/contrib/fzf-initialize.bash"
|
||||
bash make_command.sh install "out/contrib/fzf-key-bindings.bash" "/home/snappy/.local/share/blesh/contrib/fzf-key-bindings.bash"
|
||||
bash make_command.sh install "out/doc/README.md" "/home/snappy/.local/share/blesh/doc/README.md"
|
||||
bash make_command.sh install "out/doc/README-ja_JP.md" "/home/snappy/.local/share/blesh/doc/README-ja_JP.md"
|
||||
bash make_command.sh install "out/doc/CONTRIBUTING.md" "/home/snappy/.local/share/blesh/doc/CONTRIBUTING.md"
|
||||
bash make_command.sh install "out/doc/ChangeLog.md" "/home/snappy/.local/share/blesh/doc/ChangeLog.md"
|
||||
bash make_command.sh install "out/doc/Release.md" "/home/snappy/.local/share/blesh/doc/Release.md"
|
||||
bash make_command.sh install "out/doc/contrib/README-ja.md" "/home/snappy/.local/share/blesh/doc/contrib/README-ja.md"
|
||||
bash make_command.sh install "out/doc/contrib/README.md" "/home/snappy/.local/share/blesh/doc/contrib/README.md"
|
||||
bash make_command.sh install "out/doc/LICENSE.md" "/home/snappy/.local/share/blesh/doc/LICENSE.md"
|
||||
bash make_command.sh install "out/doc/contrib/LICENSE" "/home/snappy/.local/share/blesh/doc/contrib/LICENSE"
|
||||
mkdir -p /home/snappy/.local/share/blesh/cache.d && chmod a+rwxt /home/snappy/.local/share/blesh/cache.d
|
||||
mkdir -p /home/snappy/.local/share/blesh/run && chmod a+rwxt /home/snappy/.local/share/blesh/run
|
||||
```
|
||||
24
joplin notion extension/linux/Cons.md
Normal file
24
joplin notion extension/linux/Cons.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Cons
|
||||
|
||||
- wine issues
|
||||
Some applications like winrar dont run. spytify even after installing dotnet has this issue
|
||||

|
||||
|
||||
For autohotkey this error
|
||||

|
||||
|
||||
Some applications r getting this error after being installed or during install
|
||||

|
||||
|
||||
|
||||
proton doesnt fare well with mid or low end gpus though (when it comes to games like elden ring or counter strike)
|
||||
|
||||
i have an i7 with a 1060 and i cant even get counterstrike or elden ring to run without lowering the resolution to 180p and still getting stutters and low fps (while on windows they ran just fine on low-mid graphics)
|
||||
|
||||
and yes i tried options like gamemoderun, gamescope, and even got protonGE and nothing really changed sadly lmao
|
||||
Windows relies on directx while Linux relies on vulkan
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
21
joplin notion extension/linux/Distros.md
Normal file
21
joplin notion extension/linux/Distros.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Distros
|
||||
https://distrowatch.com/search-mobile.php?ostype=All&category=All&origin=All&basedon=Independent¬basedon=None&desktop=All&architecture=All&package=All&rolling=All&isosize=All&netinstall=All&language=All&defaultinit=All&status=Active#simple
|
||||
|
||||
1. Debian, Red Hat/Fedora, SuSE, Arch, Gentoo, Slackware : main
|
||||
2. All
|
||||
[DistroWatch.com_ Put the fun back into computing. Use Linux, BSD. (23_10_2023 2_46_50 am).html](../../_resources/DistroWatch.com_%20Put%20the%20fun%20back%20into%20computing.%20.html)
|
||||
|
||||
|
||||
1. **Alpine** : Used in dockers. Alpine Linux is a Linux distribution designed to be small, simple, and secure. It uses musl, BusyBox, and OpenRC instead of the more commonly used glibc, GNU Core Utilities, and systemd. For security, Alpine compiles all user-space binaries as position-independent executables with stack-smashing protection
|
||||
2. **Android** : MobileOS
|
||||
3. **Arch linux**: It is an independently developed, x86_64-optimised Linux distribution targeted at competent Linux users. It uses 'pacman', its home-grown package manager, to provide updates to the latest software applications with full dependency tracking. Operating on a rolling release system, Arch can be installed from a CD image or via an FTP server. The default install provides a solid base that enables users to create a custom installation. In addition, the Arch Build System (ABS) provides a way to easily build new packages, modify the configuration of stock packages, and share these packages with other users via the Arch Linux user repository.
|
||||
4. **Fedora:** Fedora Linux (formerly Fedora, formerly Fedora Core) is a Linux distribution developed by the community-supported Fedora Project and owned by Red Hat. Fedora Linux contains software distributed under a free and open-source license and aims to be on the leading edge of such technologies. Fedora has a reputation for focusing on innovation, integrating new technologies early on and working closely with upstream Linux communities.
|
||||
5. **Nix OS**: NixOS is an independently developed GNU/Linux distribution that aims to improve the state of the art in system configuration management. In NixOS, the entire operating system, including the kernel, applications, system packages and configuration files, are built by the Nix package manager. Nix stores all packages in isolation from each other; as a result there are no /bin, /sbin, /lib or /usr directories and all packages are kept in /nix/store instead. Other innovative features of NixOS include reliable upgrades, rollbacks, reproducible system configurations, source-based model with binaries, and multi-user package management. Although NixOS started as a research project, it is now a functional and usable operating system that includes hardware detection, KDE as the default desktop, and systemd for managing system services.
|
||||
6. **Slackware Linux** (43)
|
||||
The Official Release of Slackware Linux by Patrick Volkerding is an advanced Linux operating system, designed with the twin goals of ease of use and stability as top priorities. Including the latest popular software while retaining a sense of tradition, providing simplicity and ease of use alongside flexibility and power, Slackware brings the best of all worlds to the table. Originally developed by Linus Torvalds in 1991, the UNIX-like Linux operating system now benefits from the contributions of millions of users and developers around the world. Slackware Linux provides new and experienced users alike with a fully-featured system, equipped to serve in any capacity from desktop workstation to machine-room server. Web, ftp, and email servers are ready to go out of the box, as are a wide selection of popular desktop environments. A full range of development tools, editors, and current libraries is included for users who wish to develop or compile additional software.
|
||||
7. **Gentoo Linux** (59)
|
||||
Gentoo Linux is a versatile and fast, completely free Linux distribution geared towards developers and network professionals. Unlike other distros, Gentoo Linux has an advanced package management system called Portage. Portage is a true ports system in the tradition of BSD ports, but is Python-based and sports a number of advanced features including dependencies, fine-grained package management, "fake" (OpenBSD-style) installs, safe unmerging, system profiles, virtual packages, config file management, and more.
|
||||
6. Void (71)
|
||||
Void is an independently-developed, general-purpose operating system based on the monolithic Linux kernel. It features a hybrid binary/source package management system which allows users to quickly install, update and remove software, or to build software directly from sources with the help of the XBPS source packages collection. Other features of the distribution include support for Raspberry Pi single-board computers (both armv6 and armv7), rolling-release development model with daily updates, and native init system called "runit".
|
||||
|
||||
|
||||
784
joplin notion extension/linux/Extras.md
Normal file
784
joplin notion extension/linux/Extras.md
Normal file
|
|
@ -0,0 +1,784 @@
|
|||
Extras
|
||||
|
||||
- aptitude
|
||||
better than `apt get`
|
||||
aptitude is a command-line package manager Basically it helps with everything related to packages like removal installation ecc...
|
||||
https://wiki.debian.org/Aptitude
|
||||
- Binary blobs in linux
|
||||
https://www.reddit.com/r/linux/comments/ui4wal/so_where_are_the_closedsource_binary_blobs_in/
|
||||
- sftp, scp
|
||||
https://superuser.com/questions/326211/best-way-to-transfer-files-over-a-lan-between-two-linux-computers
|
||||
scp tldrs
|
||||
single file
|
||||
`scp myfile.txt user@192.168.1.5:/home/user/`
|
||||
entire directory
|
||||
`scp -r my_folder/ user@192.168.1.5:/home/user/`
|
||||
flags
|
||||
`-p` : for preserving metadata
|
||||
`-P` : custom port
|
||||
`-C` : compression for saving bandwidth
|
||||
- To run .sh file as a command
|
||||
Make it executable by `chmod +x script`. also remove `.sh` extension too so it will be `script` and not `script.sh` Either add in `/usr/bin` as `$PATH` variable contain that directory or add your directory where the script is there by editing `~/.bashrc` file
|
||||
```text
|
||||
export PATH=$PATH:$HOME/<script_folder>
|
||||
```
|
||||
`$HOME` contains `home/<username>` as directory
|
||||
- ssh issue
|
||||
If u get error when trying to connect with ssh like this
|
||||
```text
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
|
||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
|
||||
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
|
||||
It is also possible that a host key has just been changed.
|
||||
The fingerprint for the RSA key sent by the remote host is
|
||||
6e:45:f9:a8:af:38:3d:a1:a5:c7:76:1d:02:f8:77:00.
|
||||
Please contact your system administrator.
|
||||
Add correct host key in /home/hostname /.ssh/known_hosts to get rid of this message.
|
||||
Offending RSA key in /var/lib/sss/pubconf/known_hosts:4
|
||||
RSA host key for pong has changed and you have requested strict checking.
|
||||
Host key verification failed.
|
||||
```
|
||||
Then use the command
|
||||
`ssh-keygen -R <host>`
|
||||
Eg : `ssh-keygen -R 192.168.3.10`
|
||||
- MFT error
|
||||
When disk is of ntfs and it is unplugged unsafely then when reconnected error can be MFTmirror do not match MFT so correct it with
|
||||
`sudo ntfsfix /dev/sdb1`
|
||||
Make sure `ntfs-3g` must be installed
|
||||
- to get ip address
|
||||
`ipinfo.io`
|
||||
`ip.im`
|
||||
`ip.me`
|
||||
`curl ifconfig.co`
|
||||
`curl ifconfig.me`
|
||||
`curl icanhazip.com`
|
||||
- For getting cname use this
|
||||
`nslookup -Q=cname www.youtube.com`
|
||||
- Change DNS
|
||||
Changing the DNS server to 1.1.1.1 (Cloudflare's DNS service) in Arch Linux can provide you with faster and more private internet browsing. The specific steps to change your DNS settings can depend on whether you are using NetworkManager, systemd-resolved, or another network management tool on your Arch Linux setup. Below are methods for the two most common tools, NetworkManager and systemd-networkd with systemd-resolved:
|
||||
### For NetworkManager users:
|
||||
|
||||
1. **Using the GUI:**
|
||||
|
||||
If you're using a graphical environment, you can change the DNS settings through the NetworkManager applet.
|
||||
|
||||
- Right-click on the NetworkManager icon in the system tray and select `Edit Connections`.
|
||||
- Select the connection you want to edit and click on the `Gear` icon or `Edit` button.
|
||||
- Go to the `IPv4 Settings` or `IPv6 Settings` tab.
|
||||
- Change the `Method` to `Automatic (DHCP) addresses only` or `Manual` if you set your IP address statically.
|
||||
- Enter `1.1.1.1, 1.0.0.1` in the `DNS servers` field. For IPv6, use `2606:4700:4700::1111, 2606:4700:4700::1001`.
|
||||
- Click `Save` and close the Network Connections window.
|
||||
- Finally, disable and re-enable the network connection for the changes to take effect.
|
||||
|
||||
2. **Using the terminal:**
|
||||
|
||||
- You can also edit the NetworkManager configuration file directly for the connection. Connection profiles are stored in `/etc/NetworkManager/system-connections/`. Find the profile you wish to edit and open it with a text editor (as root). You may need to install `nano` or use another available editor.
|
||||
```bash
|
||||
sudo nano /etc/NetworkManager/system-connections/YourConnectionName.nmconnection
|
||||
```
|
||||
- Add the following lines under the `[ipv4]` or `[ipv6]` sections:
|
||||
```
|
||||
dns=1.1.1.1;1.0.0.1;
|
||||
```
|
||||
For IPv6:
|
||||
```
|
||||
dns=2606:4700:4700::1111;2606:4700:4700::1001;
|
||||
```
|
||||
- Save the changes and restart NetworkManager:
|
||||
```bash
|
||||
sudo systemctl restart NetworkManager
|
||||
```
|
||||
### For systemd-networkd with systemd-resolved users:
|
||||
|
||||
1. **Edit or Create a network file:**
|
||||
|
||||
Your network configuration files are located in `/etc/systemd/network/`. If you're using systemd-networkd for managing the network, edit the corresponding `.network` file for your connection.
|
||||
|
||||
- Open the relevant `.network` file in a text editor (as root):
|
||||
```bash
|
||||
sudo nano /etc/systemd/network/your_network_file.network
|
||||
```
|
||||
- Add or modify the following section to set Cloudflare's DNS servers:
|
||||
```
|
||||
[DHCP]
|
||||
UseDNS=false
|
||||
[Network]
|
||||
DNS=1.1.1.1
|
||||
DNS=1.0.0.1
|
||||
# For IPv6
|
||||
DNS=2606:4700:4700::1111
|
||||
DNS=2606:4700:4700::1001
|
||||
```
|
||||
- Save the file and exit the editor.
|
||||
|
||||
2. **Restart systemd-networkd and systemd-resolved:**
|
||||
|
||||
- Apply the changes by restarting the services:
|
||||
```bash
|
||||
sudo systemctl restart systemd-networkd
|
||||
sudo systemctl restart systemd-resolved
|
||||
```
|
||||
|
||||
3. **Ensure systemd-resolved is used for DNS resolution:**
|
||||
|
||||
- Create a symlink to use systemd-resolved's stub resolver:
|
||||
```bash
|
||||
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||
```
|
||||
|
||||
Remember to replace placeholder texts like `YourConnectionName` or `your_network_file.network` with the actual names specific to your setup. Each setup might be slightly different, so adjust the steps according to your network management tool and configuration.
|
||||
|
||||
|
||||
## Supervisord
|
||||
like pm2 but not limited to nodejs
|
||||
- Create a config file for supervisord and store it anywhere
|
||||
```ini
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:app1]
|
||||
command=node /path/to/app1/app.js
|
||||
directory=/path/to/app1
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/path/to/app1.log
|
||||
stderr_logfile=/path/to/app1_error.log
|
||||
|
||||
[program:app2]
|
||||
command=node /path/to/app2/app.js
|
||||
directory=/path/to/app2
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/path/to/app2.log
|
||||
stderr_logfile=/path/to/app2_error.log
|
||||
```
|
||||
- Then start it with
|
||||
`sudo supervisord -c /home/user/supervisor/supervisord.conf`
|
||||
Then for interacting
|
||||
`sudo supervisorctl start app1`
|
||||
`sudo supervisorctl stop app1`
|
||||
`sudo supervisorctl restart app1`
|
||||
`sudo supervisorctl status`
|
||||
- Issues
|
||||
sometimes when using package manager supervisor may not work properly so install it with pip.
|
||||
`pip install supervisor`. sometimes if pip is not installed then upgrade your python package
|
||||
- Setting up proxy
|
||||
In `~/.bashrc` add following so that terminals can use proxy
|
||||
```bash
|
||||
export http_proxy="210.61.216.63:60808"
|
||||
export https_proxy="115.87.207.193:8080"
|
||||
```
|
||||
for systemwide add in `/etc/environemnt`.
|
||||
- `sudo systemd-analyze` : this will tell the boot time of firmware+loader+kernel+userspace
|
||||
- using proxy with curl
|
||||
` curl -x 37.27.29.181:80 ipinfo.io`
|
||||
here `37.27.29.181:80` is proxy `-x` is flag for proxy
|
||||
|
||||
|
||||
|
||||
### inotify
|
||||
Note : inotify wont work to detect changes in remote system
|
||||
https://unix.stackexchange.com/questions/238956/is-there-a-way-to-use-inotify-on-remote-filesystems-specifically-webdav
|
||||
make changes or execute script when changes on files or directory
|
||||
- install ionotify and rsync
|
||||
`sudo apt-get install inotify-tools rsync`
|
||||
- Create a script with following (for syncing directories)
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
SOURCE="/path/to/source"
|
||||
DESTINATION="/path/to/destination"
|
||||
|
||||
# Function to sync directories
|
||||
sync_directories() {
|
||||
# a for archiving(preserving metadata), v for verbose, z for compressing
|
||||
rsync -avz --delete "$SOURCE/" "$DESTINATION/"
|
||||
}
|
||||
|
||||
# Ensure initial sync
|
||||
sync_directories
|
||||
|
||||
# Monitor the source directory for any activity, and sync upon changes
|
||||
# while read -r directory events filename; do: This line starts a while loop that reads input and assigns the values to three variables: directory, events, and filename. -r option is used with read command to prevent backslashes from acting as escape characters.
|
||||
inotifywait -mre close_write,create,delete,move "$SOURCE" |
|
||||
while read -r directory events filename; do
|
||||
sync_directories
|
||||
done
|
||||
```
|
||||
finally make it executable
|
||||
`chmod +x sync_directories.sh`
|
||||
- bidirectional sync without noticing deletions ie only modifications of files will be noticed (for directories)
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
SOURCE=$1
|
||||
DESTINATION=$2
|
||||
|
||||
# Function to sync directories
|
||||
sync_directories() {
|
||||
# u means updates
|
||||
# deletions will be ignored with flag --ignore-existing
|
||||
rsync -avu --ignore-existing "$SOURCE/" "$DESTINATION/"
|
||||
}
|
||||
|
||||
sync_directories2() {
|
||||
rsync -avu --ignore-existing "$DESTINATION/" "$SOURCE/"
|
||||
}
|
||||
|
||||
# Ensure initial sync
|
||||
sync_directories
|
||||
|
||||
# Monitor the source directory for any activity, and sync upon changes
|
||||
inotifywait -mre close_write,create,delete,move "$SOURCE" |
|
||||
while read -r directory events filename; do
|
||||
sync_directories
|
||||
done
|
||||
|
||||
inotifywait -mre close_write,create,delete,move "$DESTINATION" |
|
||||
while read -r directory events filename; do
|
||||
sync_directories2
|
||||
done
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
or use unison
|
||||
Do the initial sync:
|
||||
`unison -auto -batch dirA dirB`
|
||||
|
||||
Run the continuous bidirectional sync:
|
||||
`unison -auto -batch -repeat watch -times dirA dirB`
|
||||
|
||||
|
||||
- for syncing files
|
||||
unidirectional
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
SOURCE_FILE="/path/to/source/myfile.txt"
|
||||
TARGET_FILE="/path/to/target/myfile.txt"
|
||||
|
||||
# Loop forever
|
||||
while true; do
|
||||
# Wait for modifications to the specified file
|
||||
inotifywait -e modify,move,create,delete "$SOURCE_FILE" && \
|
||||
# Sync file. Here, we use cp, but you could use rsync or other commands depending on your needs
|
||||
rsync -avu --delete "$SOURCE_FILE" "$TARGET_FILE"
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
**bidirectional**
|
||||
inotify itself wont detect changes and even if we write 2 different statements then it will wait for first one to complete so we need to create 2 different sh files and execute those files in background
|
||||
|
||||
`sync_directories1.sh`
|
||||
```bash
|
||||
SOURCE=$1
|
||||
DESTINATION=$2
|
||||
|
||||
db_name= "main.kdbx"
|
||||
|
||||
SOURCE_FILE="$SOURCE/${db_name}"
|
||||
DESTINATION_FILE= "$DESTINATION/${db_name}"
|
||||
|
||||
# Function to sync directories
|
||||
sync_directories() {
|
||||
rsync -avu --ignore-existing "$SOURCE/${db_name}" "$DESTINATION/${db_name}"
|
||||
}
|
||||
|
||||
|
||||
# Ensure initial sync
|
||||
sync_directories
|
||||
|
||||
|
||||
# Monitor the source directory for any activity, and sync upon changes
|
||||
inotifywait -mre close_write,create,delete,move "$SOURCE" |
|
||||
while read -r directory events filename; do
|
||||
sync_directories
|
||||
done
|
||||
```
|
||||
`sync_directories2.sh`
|
||||
```bash
|
||||
SOURCE=$1
|
||||
DESTINATION=$2
|
||||
|
||||
db_name= "main.kdbx"
|
||||
|
||||
SOURCE_FILE="$SOURCE/${db_name}"
|
||||
DESTINATION_FILE= "$DESTINATION/${db_name}"
|
||||
|
||||
# Function to sync directories
|
||||
sync_directories2() {
|
||||
rsync --ignore-existing "$DESTINATION/${db_name}" "$SOURCE/${db_name}"
|
||||
}
|
||||
|
||||
# Ensure initial sync
|
||||
sync_directories2
|
||||
|
||||
inotifywait -mre close_write,create,delete,move "$DESTINATION" |
|
||||
while read -r directory events filename; do
|
||||
sync_directories2
|
||||
done
|
||||
|
||||
```
|
||||
`sync_directories.sh`
|
||||
```bash
|
||||
./sync_directories1.sh /path/to/first /path/to/second &
|
||||
./sync_directories2.sh /path/to/first /path/to/second &
|
||||
|
||||
```
|
||||
Finally execute `sync_directories.sh`
|
||||
Warning : using & means there will be problem in closing it
|
||||
- nohup to run script in backround without needing to keep terminal open
|
||||
if not available then install this with whole toolkit ie `coreutils`
|
||||
`nohup script.sh &`
|
||||
this will cause problems if we have to close processes
|
||||
- screen : multiplexer which will emulates terminal in background instead of process itself so easy to terminate processes.
|
||||
https://sentrytwo.com/6bb78a2539
|
||||
|
||||
to start the process in detached mode
|
||||
```bash
|
||||
screen -dmS sync1 ./sync_directories1.sh
|
||||
```
|
||||
this will start the session with name sync1
|
||||
|
||||
to close the session
|
||||
`screen -S sync1 -X quit`
|
||||
|
||||
|
||||
|
||||
- cron jobs
|
||||
- in arch by default cron service isnt installed so install it by
|
||||
`pacman -S cronie`
|
||||
https://phoenixnap.com/kb/set-up-cron-job-linux
|
||||
- Start cron service by
|
||||
`sudo systemctl start cron.service`
|
||||
in arch
|
||||
`sudo systemctl start cronie.service`
|
||||
- add cron tab through
|
||||
`crontab -e` then type
|
||||
`* * * * * /home/hpes/Videos/imp/scripts/crons/cronscript.sh`
|
||||
cron jub will run every minute
|
||||
Syntax is
|
||||
`<minute> <hour> <day_of_the_month> <month_of_the_year> <day_of_the_week> /path/to/your_script.sh`
|
||||
crontab location is `/var/spool/cron/`
|
||||
- Managing history in linux
|
||||
https://www.cyberciti.biz/faq/disable-bash-shell-history-linux/
|
||||
- check what service is connected to port (say 8080)
|
||||
`lsof -i :8080 -S`
|
||||
or
|
||||
`netstat -a | grep 8080`
|
||||
- text to speech
|
||||
using espeak
|
||||
`espeak 'wake up' 2>/dev/null`
|
||||
to get list of voices
|
||||
`espeak voices`
|
||||
to set the voice
|
||||
`espeak -v <voice>`
|
||||
|
||||
- umount target is busy
|
||||
`sudo umount -l /mnt/pendrive/` `-l` is important
|
||||
this is still dangerous though bcz it can unmount even the partition of the current os
|
||||
|
||||
https://stackoverflow.com/questions/7878707/how-to-unmount-a-busy-device
|
||||
- list drivers
|
||||
https://discuss.kde.org/t/settings-says-no-touchpad-found/14139
|
||||
`libinput list-devices`
|
||||
- hard reboot and hard shutdown
|
||||
Terminal command for hard-shutdown,
|
||||
`sudo sh -c "echo o > /proc/sysrq-trigger"`
|
||||
Terminal command for hard-restart,
|
||||
`sudo sh -c "echo b > /proc/sysrq-trigger"`
|
||||
- aliases
|
||||

|
||||

|
||||
- direnv
|
||||
to load and unload environment variables depending on current directory
|
||||
https://direnv.net/
|
||||
- date
|
||||
```
|
||||
You can refer to the following table to generate timestamps in various formats:
|
||||
Format / result Command Output
|
||||
YYYY-MM-DD date -I $(date -I)
|
||||
YYYY-MM-DD_hh:mm:ss date +%F_%T $(date +%F_%T)
|
||||
YYYYMMDD_hhmmss date +%Y%m%d_%H%M%S $(date +%Y%m%d_%H%M%S)
|
||||
YYYYMMDD_hhmmss (UTC version) date --utc +%Y%m%d_%H%M%SZ $(date --utc +%Y%m%d_%H%M%SZ)
|
||||
YYYYMMDD_hhmmss (with local TZ) date +%Y%m%d_%H%M%S%Z $(date +%Y%m%d_%H%M%S%Z)
|
||||
YYYYMMSShhmmss date +%Y%m%d%H%M%S $(date +%Y%m%d%H%M%S)
|
||||
YYYYMMSShhmmssnnnnnnnnn date +%Y%m%d%H%M%S%N $(date +%Y%m%d%H%M%S%N)
|
||||
YYMMDD_hhmmss date +%y%m%d_%H%M%S $(date +%y%m%d_%H%M%S)
|
||||
Seconds since UNIX epoch date +%s $(date +%s)
|
||||
Nanoseconds only date +%N $(date +%N)
|
||||
Nanoseconds since UNIX epoch date +%s%N $(date +%s%N)
|
||||
ISO8601 UTC timestamp date --utc +%FT%TZ $(date --utc +%FT%TZ)
|
||||
ISO8601 UTC timestamp + ms date --utc +%FT%T.%3NZ $(date --utc +%FT%T.%3NZ)
|
||||
ISO8601 Local TZ timestamp date +%FT%T%Z $(date +%FT%T%Z)
|
||||
YYYY-MM-DD (Short day) date +%F\(%a\) $(date +%F\(%a\))
|
||||
YYYY-MM-DD (Long day) date +%F\(%A\) $(date +%F\(%A\))
|
||||
```
|
||||
- finding duplicates
|
||||
for current dir
|
||||
```bash
|
||||
find -not -empty -type f -printf "%s
|
||||
" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
|
||||
|
||||
```
|
||||
for custom one
|
||||
```bash
|
||||
find "$DIR" -not -empty -type f -printf "%s\n" |
|
||||
sort -rn |
|
||||
uniq -d |
|
||||
xargs -I{} -n1 find "$DIR" -type f -size {}c -print0 |
|
||||
xargs -0 md5sum |
|
||||
sort |
|
||||
uniq -w32 --all-repeated=separate
|
||||
```
|
||||
- fzf usage
|
||||
`find * -type f | fzf --multi > selected1`
|
||||
select files with shift+tab and then press enter and all the path will be saved to selected1 file
|
||||
- pretty print json
|
||||
`jq . package.json`
|
||||
here `.` is for current directory as top level directory is needed here
|
||||
and for reading large json do this
|
||||
`jq '.' large_file.json | less`
|
||||
- change default browser
|
||||
`xdg-settings set default-web-browser <insert the filename>.desktop`
|
||||
- get hashes
|
||||
`sha256sum <file>`. so there are others too: `sha1sum`, `md5sum`
|
||||
SHA-2 Family:
|
||||
The sha1sum tool, which uses SHA-1, is part of the broader SHA (Secure Hash Algorithm) family. Other members of this family include:
|
||||
sha256sum (256-bit hash, more secure than SHA-1)
|
||||
sha224sum (224-bit hash)
|
||||
sha384sum (384-bit hash)
|
||||
sha512sum (512-bit hash, offers maximum security in the SHA family)
|
||||
Blake2 : b2sum
|
||||
SHA-3 : `openssl sha3-256 file.txt`
|
||||
[sha types.txt](../../_resources/sha%20types.txt)
|
||||
- aur alternatuve in other distros
|
||||
Most distributions have larger repositories so don't need an AUR. Though, if you really want to dive into third-party repositories, I mean, there is Pacstall for Debian, Copr for Fedora, PPAs for Ubuntu, the community build system for openSUSE, the SlackBuilds for Slackware.
|
||||
|
||||
Plus Nix and pkgsrc are cross-distro and massive.
|
||||
|
||||
Basically no one else needs the AUR because there are lots of other, sometimes more extensive, options.
|
||||
- generate totp from totp key
|
||||
I have emailed myself the recovery codes and the actual totp key, I also have a bash alias
|
||||
```bash
|
||||
# for hex key
|
||||
alias GHGEN="oathtool --totp 'totp key here'"
|
||||
|
||||
# or for base32 key use
|
||||
alias GHGEN="oathtool -b --totp 'totp key here'"
|
||||
```
|
||||
https://gitlab.com/oath-toolkit/oath-toolkit
|
||||
-
|
||||
|
||||
|
||||
|
||||
Create a desktop entry of appimage with bash script
|
||||
|
||||
```sh
|
||||
#!/bin/bash
|
||||
|
||||
# Check if an AppImage file is passed as a parameter
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <AppImage file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Assign the AppImage file path
|
||||
APPIMAGE_FILE="$1"
|
||||
|
||||
# Check if the provided AppImage file exists
|
||||
if [ ! -f "$APPIMAGE_FILE" ]; then
|
||||
echo "Error: File '$APPIMAGE_FILE' not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract the application name (assuming the AppImage filename is the application name)
|
||||
APP_NAME=$(basename "$APPIMAGE_FILE" .AppImage)
|
||||
|
||||
# Create the desktop entry content
|
||||
DESKTOP_ENTRY="[Desktop Entry]
|
||||
Name=$APP_NAME
|
||||
Exec=$APPIMAGE_FILE
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=$APPIMAGE_FILE
|
||||
Categories=Utility"
|
||||
|
||||
# Create the desktop entry filename
|
||||
DESKTOP_ENTRY_PATH="$HOME/.local/share/applications/$APP_NAME.desktop"
|
||||
|
||||
# Create the desktop entry file
|
||||
echo "$DESKTOP_ENTRY" > "$DESKTOP_ENTRY_PATH"
|
||||
|
||||
# Make the desktop entry executable
|
||||
chmod +x "$DESKTOP_ENTRY_PATH"
|
||||
|
||||
echo "Desktop entry for '$APP_NAME' created successfully at '$DESKTOP_ENTRY_PATH'"
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
xargs
|
||||
```sh
|
||||
rg --files | rg '.*\.json' | xargs stat
|
||||
|
||||
```
|
||||
|
||||
so whatever the output `rg --files | rg '.*\.json'` these will give stat will take as paameter lien by line so basicially `stat first line of output` and so on.
|
||||
|
||||
|
||||
|
||||
**xclip**
|
||||
clipboard for x11
|
||||
```sh
|
||||
# to clipboard
|
||||
xclip -selection clipboard -t image/png -i example.png
|
||||
# or
|
||||
# from clipboard
|
||||
xclip -o -se c -t image/png
|
||||
|
||||
# text to variable
|
||||
fullfilepath=$(xclip -selection clipboard -o)
|
||||
|
||||
```
|
||||
|
||||
images to file from clipboard
|
||||
x11
|
||||
`xclip -selection clipboard -t image/png -o > output.png`
|
||||
and for wayland
|
||||
install `wl-clipboard`
|
||||
and
|
||||
`wl-paste > output.png`
|
||||
|
||||
for file to clipboard
|
||||
`wl-copy -t image/png < /path/to/your/image.png`
|
||||
|
||||
|
||||
|
||||
**native games in linux**
|
||||
for native games in linux following 32 but libraries needed to be installed
|
||||
|
||||
`apt install libgl1:i386 libglx0:i386 libc6:i386 libstdc++6:i386`
|
||||
|
||||
|
||||
fix buzzing of sound
|
||||
- https://youtu.be/Kt0dkXWnaC4 : How To Fix Buzzing Speakers On Linux
|
||||
|
||||
|
||||
**Alternative of shred**
|
||||
|
||||
```sh
|
||||
dd if=/dev/urandom of=/storage/emulated/0/yourfile.txt bs=1M count=1
|
||||
rm /storage/emulated/0/yourfile.txt
|
||||
```
|
||||
|
||||
|
||||
openvpn setup as server
|
||||
|
||||
1. Run a popular, pre-made installation script for quick setup:
|
||||
`wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh`.
|
||||
Follow the prompts on screen to set up protocols (UDP recommended), port (1194), and DNS.
|
||||
|
||||
2. Configure and Connect Client
|
||||
Once installed, the script will generate a .ovpn file (e.g., client.ovpn).
|
||||
Download this file from your VPS to your local computer/phone using SCP or SFTP.
|
||||
Install the OpenVPN Connect client app, import the .ovpn file, and click "Connect".
|
||||
3. in linux use `sudo openvpn --config client1.ovpn` to connect with it
|
||||
|
||||
|
||||
|
||||
### wireguard
|
||||
```sh
|
||||
curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh
|
||||
chmod +x wireguard-install.sh
|
||||
./wireguard-install.sh
|
||||
```
|
||||
to check status
|
||||
`systemctl status wg-quick@wg0`
|
||||
|
||||
for bringiing down individual clients from server use
|
||||
|
||||
**to get list**
|
||||
`sudo wg show`
|
||||
|
||||
**for temporarily disable**
|
||||
`sudo wg set wg0 peer CLIENT_PUBLIC_KEY remove`
|
||||
or for safer just changed allowed ip
|
||||
`10.66.66.3/32, fd42:42:42::3/128` this was original lets say
|
||||
so use
|
||||
`sudo wg set wg0 peer CLIENT_PUBLIC_KEY allowed-ips 0.0.0.0/32`
|
||||
then later change back to
|
||||
`sudo wg set wg0 peer CLIENT_PUBLIC_KEY allowed-ips 10.66.66.3/32,fd42:42:42::3/128`
|
||||
|
||||
|
||||
**for permanent disable**
|
||||
`sudo nano /etc/wireguard/wg0.conf`
|
||||
|
||||
remove or comment out client
|
||||
```txt
|
||||
PublicKey = CLIENT_PUBLIC_KEY
|
||||
AllowedIPs = 10.0.0.3/32
|
||||
```
|
||||
|
||||
then apply changes
|
||||
```sh
|
||||
sudo wg-quick down wg0
|
||||
sudo wg-quick up wg0
|
||||
```
|
||||
|
||||
|
||||
other config details
|
||||
```txt
|
||||
|
||||
IPv4 or IPv6 public address: 198.12.73.213
|
||||
Public interface: eth0
|
||||
WireGuard interface name: wg0
|
||||
Server WireGuard IPv4: 10.66.66.1
|
||||
Server WireGuard IPv6: fd42:42:42::1
|
||||
Server WireGuard port [1-65535]: 53586
|
||||
First DNS resolver to use for the clients: 1.1.1.1
|
||||
Second DNS resolver to use for the clients (optional): 1.0.0.1
|
||||
|
||||
WireGuard uses a parameter called AllowedIPs to determine what is routed over the VPN.
|
||||
Allowed IPs list for generated clients (leave default to route everything): 0.0.0.0/0,::/0
|
||||
|
||||
```
|
||||
|
||||
in client
|
||||
**best method is to use wireguard**
|
||||
1. download wiregard profiles from https://account.protonvpn.com/downloads
|
||||
2. install wireguard-tools and then copy that conf files to /etc/wireguard
|
||||
3. run `sudo wg-quick up <conf_name>` (without .conf at end)
|
||||
4. to disconnect sudo wg-quick down <conf_name>
|
||||
Note : in proton config files, it is configured such that browsers cant access it so make changes in conf files like this
|
||||
AllowedIPs = 0.0.0.0/0, ::/0 to allow all network traffic
|
||||
5. for kill switch add above `peer` section
|
||||
```txt
|
||||
# Kill switch: block all traffic not going through WireGuard
|
||||
PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
|
||||
PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
|
||||
```
|
||||
|
||||
galv peer
|
||||
```txt
|
||||
peer: n4S+ao5+VqQRwYcYoHIslRKCgyyMAvUWlSuIOhztlC4=
|
||||
preshared key: (hidden)
|
||||
allowed ips: 10.66.66.4/32, fd42:42:42::4/128
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
nmap : nice command to get details of entered domain. scan networks for live hosts, open ports, running services, operating systems, and potential vulnerabilities
|
||||
|
||||
|
||||
`flatpak info --show-location io.gitlab.news_flash.NewsFlash`
|
||||
and for user data
|
||||
`~/.var/app`
|
||||
|
||||
to uninstall unsed packages
|
||||
`flatpak uninstall --unused`
|
||||
|
||||
to list themes
|
||||
`flatpak list --runtime | grep -i theme`
|
||||
|
||||
- check what process is precenting system from sleep
|
||||
`dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.GetInhibitors`
|
||||
then whatever the inhibtor id is returned use this
|
||||
` dbus-send --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager/Inhibitor503 org.gnome.SessionManager.Inhibitor.GetAppId`
|
||||

|
||||
|
||||
|
||||
**isolate softwares**
|
||||
- using firejail
|
||||
`--private` : will disable access from filesystem
|
||||
`firejail --private firefox "http://dangerous-url.com"`
|
||||
for breaking off internet
|
||||
`firejail --net=none --private firefox "https://www.google.com"`
|
||||
|
||||
|
||||
|
||||
**get resource usage like cpu and ram of all processes containing the given keyword**
|
||||
useful to actually track things properly
|
||||
|
||||
for the physical memory
|
||||
`ps axo %cpu,rss,comm | awk '{print $1 "%\t" $2/1024 " MB\t" $3}'`: Lists CPU percentage, calculates memory in MB (RSS / 1024), and shows the command name.
|
||||
|
||||
when printing and using the 1st method it will just print one word so change comm to args and for real full thing use following
|
||||
`ps axo %cpu,rss,args | awk 'NR==1 {print "CPU%\tMEM_MB\tCOMMAND"; next} {printf "%s%%\t%.2f MB\t", $1, $2/1024; for(i=3;i<=NF;i++) printf "%s ", $i; print ""}'`
|
||||
|
||||
for swap one
|
||||
|
||||
```bash
|
||||
for pid in /proc/[0-9]*; do
|
||||
pid_num=$(basename $pid)
|
||||
swap=$(awk '/^Swap:/ {sum+=$2} END {print sum}' $pid/smaps_rollup 2>/dev/null)
|
||||
if [ ! -z "$swap" ] && [ "$swap" -gt 0 ]; then
|
||||
name=$(cat $pid/comm 2>/dev/null)
|
||||
echo "$swap $pid_num $name"
|
||||
fi
|
||||
done | sort -rn | head -n 10 | awk '{printf "PID: %-6s Swap: %.2f MB Command: %s\n", $2, $1/1024, $3}'
|
||||
|
||||
```
|
||||
for printing full command line
|
||||
```bash
|
||||
for pid in /proc/[0-9]*; do
|
||||
pid_num=$(basename $pid)
|
||||
swap=$(awk '/^Swap:/ {sum+=$2} END {print sum}' $pid/smaps_rollup 2>/dev/null)
|
||||
if [ ! -z "$swap" ] && [ "$swap" -gt 0 ]; then
|
||||
# Reads the full command line string and cleans up null characters
|
||||
full_cmd=$(tr '\0' ' ' < $pid/cmdline 2>/dev/null)
|
||||
# Fallback to short name if cmdline is empty (common for kernel threads)
|
||||
if [ -z "$full_cmd" ]; then full_cmd=$(cat $pid/comm 2>/dev/null); fi
|
||||
echo "$swap|$pid_num|$full_cmd"
|
||||
fi
|
||||
done | sort -t'|' -k1 -rn | head -n 10 | awk -F'|' '{printf "PID: %-6s Swap: %.2f MB Command: %s\n", $2, $1/1024, $3}'
|
||||
|
||||
```
|
||||
and finally a go program which can do this all
|
||||
[main.go](../../_resources/main.go)
|
||||
build it by
|
||||
`go build -o procusage main.go` and then `./procusage firefox`
|
||||
and the bash version
|
||||
[main1.sh](../../_resources/main1.sh)
|
||||
just use `bash main1.sh firefox` to run
|
||||
|
||||
go code listing all processes if no arguments are given and also tabular form
|
||||
[main.go](../../_resources/main-1.go)
|
||||
|
||||
|
||||
**change swapiness**
|
||||
|
||||
to check first
|
||||
`cat /proc/sys/vm/swappiness`
|
||||
|
||||
permanent solution
|
||||
`sudo nano /etc/sysctl.conf` and add
|
||||
`vm.swappiness=10` at bottom.
|
||||
do this to apply change without rebooting: `sudo sysctl -p`
|
||||
|
||||
temporary
|
||||
`sudo sysctl vm.swappiness=10`
|
||||
|
||||
|
||||
|
||||
android logs (crash logs including)
|
||||
|
||||
|
||||
```sh
|
||||
adb logcat
|
||||
|
||||
# for only errors
|
||||
adb logcat *:E
|
||||
```
|
||||
|
||||
for specific app
|
||||
```sh
|
||||
adb logcat | grep com.yourcompany.appname
|
||||
```
|
||||
3
joplin notion extension/linux/Extras/alpine.md
Normal file
3
joplin notion extension/linux/Extras/alpine.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
alpine
|
||||
|
||||
- installing i3 on alpine : https://wiki.alpinelinux.org/wiki/I3wm
|
||||
59
joplin notion extension/linux/Extras/amber bash.md
Normal file
59
joplin notion extension/linux/Extras/amber bash.md
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
amber bash
|
||||
|
||||
https://docs.amber-lang.com/getting_started/getting_started
|
||||
|
||||
**installation**
|
||||
download its release and add binary to PATH env variable
|
||||
|
||||
**usage**
|
||||
`amber run main.ab` to simply run it
|
||||
|
||||
`amber build main.ab main.sh` to convert it into bash script
|
||||
`./main.sh`
|
||||
|
||||
**example**
|
||||
|
||||
```js
|
||||
// importing inbuilt methods for array and text variables
|
||||
import { split, slice } from "std/text"
|
||||
|
||||
const reduceFactor = 10
|
||||
|
||||
// this main function allows using arguments
|
||||
main(args){
|
||||
|
||||
echo(args[1])
|
||||
|
||||
// accepting first argument as folder. index 0 is just main.ab or bash
|
||||
const folder = args[1]
|
||||
|
||||
|
||||
// using commands and getting its output into text variable named 'res'
|
||||
let filesSortedByTimeStr = $ ls -t "{folder}" $ failed {echo(-1)}
|
||||
|
||||
// converting string to array with demiliter
|
||||
let filesSortedByTimeArray = split(filesSortedByTimeStr, "\n")
|
||||
|
||||
let abFilesSortedByTimeArray = []
|
||||
for index,file in filesSortedByTimeArray{
|
||||
|
||||
if slice(file, -4) == ".fos" {
|
||||
// add elements into array
|
||||
abFilesSortedByTimeArray+=[file]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const bufferFolder = "{folder}/tobedeleted"
|
||||
$ mkdir -p "{bufferFolder}" $ failed {echo("couldnt created tobedeleted folder")}
|
||||
for index,file in abFilesSortedByTimeArray{
|
||||
if index % reduceFactor != 0{
|
||||
$ mv "{folder}/{file}" "{bufferFolder}/" $ failed {}
|
||||
}
|
||||
}
|
||||
|
||||
let res = abFilesSortedByTimeArray
|
||||
$ echo {res} > output.txt $ failed{}
|
||||
}
|
||||
|
||||
```
|
||||
18
joplin notion extension/linux/Extras/ssh.md
Normal file
18
joplin notion extension/linux/Extras/ssh.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
ssh
|
||||
|
||||
For connecting to remote device
|
||||
`ssh user@<host>` then type password if no ssh keys setup
|
||||
|
||||
non interactively with password
|
||||
1. install sshpaas https://github.com/kevinburke/sshpass
|
||||
for deb [sshpass_1.10-0.1_amd64.deb](../../../_resources/sshpass_1.10-0.1_amd64.deb)
|
||||
2. use this command
|
||||
`sshpass -p 'mypassword' scp myblogs.7z root@192.168.1.4:/root/projects/static/`
|
||||
more secure way
|
||||
```sh
|
||||
export SSHPASS='mypassword'
|
||||
sshpass -e scp myblogs.7z root@ 198.12.73.213:/root/projects/static/
|
||||
unset SSHPASS
|
||||
```
|
||||
3. for running commands non interactive
|
||||
`ssh user@host "command"`
|
||||
28
joplin notion extension/linux/Extras/vps.md
Normal file
28
joplin notion extension/linux/Extras/vps.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
vps
|
||||
|
||||
|
||||
podman start commands
|
||||
|
||||
to keep it running
|
||||
podman run -itd -p 80:80 -p 443:443 --name vps1 vps-image:v1 /bin/bash
|
||||
|
||||
now later to open running container
|
||||
podman exec -it vps1 bash
|
||||
|
||||
btop
|
||||
btop --utf-force
|
||||
|
||||
2. java
|
||||
java -jar demo-0.0.1-SNAPSHOT.jar
|
||||
|
||||
3. npm
|
||||
pm2 start ecosystem.config.js --no-daemon
|
||||
|
||||
4.npm
|
||||
npm run start
|
||||
|
||||
5. npm
|
||||
npm run start
|
||||
|
||||
6. python
|
||||
python3 -m http.server 9020
|
||||
13
joplin notion extension/linux/Extras/yazi.md
Normal file
13
joplin notion extension/linux/Extras/yazi.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
yazi
|
||||
|
||||
- copy file path, go to this mode by pressing c.
|
||||
- to go to help press type `~` or f1 key
|
||||
- to sort go to sort mode by `,`.
|
||||
- to open options type `O`.
|
||||
- to go to a specfic directory use `g` and then space key
|
||||
- use `m` to show details like in detailed view
|
||||
|
||||
|
||||
|
||||
tip
|
||||
when opening tmux use this `tmux -u` to support icons
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue