Skip to content

Instantly share code, notes, and snippets.

@ArturLinnik
Last active March 22, 2021 18:12
Show Gist options
  • Save ArturLinnik/46fb079a34207200184d54da6c0a45e1 to your computer and use it in GitHub Desktop.
Save ArturLinnik/46fb079a34207200184d54da6c0a45e1 to your computer and use it in GitHub Desktop.
Arch linux useful commands.
SCREENSHOT

import -window root screenshot.jpg https://wiki.archlinux.org/index.php/Screen_capture_(Espa%C3%B1ol)

XHOST ISSUE

https://unix.stackexchange.com/questions/209746/how-to-resolve-no-protocol-specified-for-su-user

POLYBAR INSTALLATION

https://github.com/polybar/polybar/wiki

WM POST ARCH INSTALLATION (i3)

https://www.youtube.com/watch?v=nSHOb8YU9Gw

USEFUL COMMANDS TO CONFIGURE NTCTL

https://bbs.archlinux.org/viewtopic.php?id=165549

PYWAL (sudo)

https://www.youtube.com/watch?v=Es79N_9BblE

PULSEAUDIO

pulseaudio --start --verbose start-pulseaudio-x11

BRIGHTNESS

xbacklight -set (value)

BRIGHTNESS I3 KEYS

https://www.reddit.com/r/i3wm/comments/3a6nh3/help_how_to_use_function_keys_in_i3_config/

FONT FOR URXVT

https://addy-dclxvi.github.io/post/configuring-urxvt/

RELOAD .Xresources

xrdb ~/.Xresources

FONTS HELP

https://forum.manjaro.org/t/failing-to-change-font-for-urxvt/104672/3

INSTALL FONTS MANUALLY (polybar)

move to /usr/share/fonts fc-cache fc-list | grep <font-name> font-<number> = "<font-name>:style=Regular,size=8;2"

CHANGE NEOFETCH IMG

https://www.reddit.com/r/SolusProject/comments/8qlkbm/images_in_neofetch/

I3 NO BORDERS

https://www.reddit.com/r/i3wm/comments/87kclz/how_do_i_remove_borders_and_titles/

I3 GAPS

https://erikdubois.be/how-to-change-the-size-of-the-gaps-between-the-windows-in-i3/

TRANSPARENCY TERMINAL

https://bbs.archlinux.org/viewtopic.php?id=117543

POLYBAR(3) AND ICONS HELP

https://github.com/adi1090x/polybar-themes https://www.reddit.com/r/archlinux/comments/b2ox2t/siji_font_with_polybar_dropping_characters/

ROFI THEME

https://forum.archlabslinux.com/t/rofi-theming-tips/699

GOTOP DOTS PROBLEM

https://www.reddit.com/r/archlinux/comments/apqnhr/ugly_graph_in_gotop/

ROFI WITH PYWAL

https://github.com/dylanaraps/pywal/blob/master/pywal/templates/colors-rofi-dark.rasi https://github.com/dylanaraps/pywal/wiki/Customization#rofi

SHOW KEYS "NAME"

showkey
xev

CHANGE KEYBOARD LAYOUT

https://wiki.archlinux.org/index.php/Xorg/Keyboard_configuration

CHECK BATTERY

inxi -B

READ A USB

  1. Mount the USB: mount /dev/sdb1 /mnt/usb
  2. Unmount the USB: umount /mnt/usb

MAKE A BACKUP

rsync -av --delete /Directory1/ /Directory2/ (from Directory1 to Directory2)

MAKE A FULL SYSTEM BACKUP

sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup/folder

FLASH A USB (umounted)

sudo dd bs=4M if=/path/to/archlinux.iso of=/dev/sdX status=progress oflag=sync (NO NUMBER)

CHECK DISK FREE/USED SPACE

df --total -h

CHECK DISK USAGE OF A FOLDER

du -sh /path/to/folder

FORMAT USB

  1. Know the name: lsblk
  2. Unmont it: umount /dev/sdb1
  3. Format it: sudo mkfs.vfat /dev/sdb1 // sudo mkfs.ntfs /dev/sdb1 // sudo mkfs.ext4 /dev/sdb1

DELETE UNNECESSARY PACKAGES

sudo pacman -R $(pacman -Qdtq)

FORMAT USB AND ALL ITS PARTITION WITH FDISK

https://dottheslash.wordpress.com/2011/11/29/deleting-all-partitions-on-a-usb-drive/

SHUTDOWN AFTRER CERTAIN TIME

sudo shutdown -P +60 // sudo shutdown -P 1:00 // sudo shutdown -c

SHRINK PARTITION

  1. umount /dev/sda4
  2. e2fsck -f /dev/sda4
  3. resize2fs /dev/sda4 200G
  4. gdisk /dev/sda (delete partition and create a new one of the same size that the filesystem)

EXTEND A PARTITION

(the same as shrinking but you first resize the partition and then the filesystem)

CHROOT WITHOUT ERRORS

mount /dev/sda3 /rescue
mount /dev/sda4 /rescue/home
mount /dev/sda2 /rescue/boot
mount /dev/sda5 /rescue/efi
mount -t proc proc /rescue/proc
mount -t sysfs sys /rescue/sys
mount -o bind /dev /rescue/dev
mount -t devpts pts /rescue/dev/pts
chroot /rescue

CLONE A MOUNTED DIRECTORY FROM THE USB

mount --bind /sys/firmware/efi/efivars /rescue/sys/firmware/efi/efivars

UPDATE "lsblk"

partprobe /dev/sda

UPDATE GRUB

grub-mkconfig -o /boot/grub/grub.cfg

SHARED DIRECTORY

  1. Edit fstab
  2. groupadd sharedusers -g 2000
  3. chown [your_user_name]:sharedusers -R /home/artur/shared

CHANGE HOSTNAME

vim /etc/hostname
vim /etc/hosts

CHECK INTERNET SPEED

speedtest-cli

CLEAR CACHE EXCEPT 3 MORE RECENT VERSIONS

sudo paccache -r

CHECK SYSTEM INFORMATION

  1. hwinfo (hardware)
  2. lspci (peripheral components)
  3. uname (basic system information)

IF HEADPHONES DOESN'T WORK

alsactl restore

VIEW PROCESSES

ps -aux

WHERE PACMAN INSTALLED A PACKAGE

pacman -Ql (package)

ALARM CLOCK

sleep 1h && mplayer /path/to/music.mp3

CPU BENCHMARK

geekbench

CLASS OF PROGRAM FOR I3

xprop (and click on the window)

PUBLIC IP

curl ifconfig.co

DEVICES CONNECTED TO YOUR NETWORK

sudo nmap -sn IP/Mask

COPY FILES TO SSH CONNECTED DEVICE

scp -r /path/to/file user@hostIP:/path/to/file

Terminal-based programs:

  • Monitoring: Gotop
  • Music Player: Cmus
  • RSS Feed Reader: Canto
  • File Manager: Ranger
  • Launcher: Rofi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment