Tasks - jasper-zanjani/dotfiles GitHub Wiki
- Set up SSH server on WSL
- Set custom resolution on a VM
- Bash scripting
- Diagnosing network problems
- Distros
- Samba
- X forwarding
Specify a custom resolution in a VM [github.io](https://stafwag.github.io/blog/blog/2018/04/22/high-screen-resolution-on-a-kvm-virtual-machine-with-qxl/ 'stafwag.github.io: "High screen resolution on a KVM virtual machine with QXL")
cvt 2560 1440
xrandr --newmode "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync
xrandr --addmode Virtual-1 2560x1440_60.00
xrandr --output Virtual-1 --mode 2560x1440_60.0
ssh -Y user@host
Have remote system use local computer {me.luna.edu}'s X display
export DISPLAY=me.luna.edu:0
Install and configure Samba server [vitux.com][https://vitux.com/how-to-install-and-configure-samba-on-ubuntu/]
Install samba
sudo apt install samba
Verify the samba service smbd
is running
sudo systemctl status smbd
Configure Samba
sudo mkdir /samba # Create a directory for the share
sudo chmod -R 0777 /samba
sudo chown -R nobody:nobody /samba # Remove ownership
Open firewall rule
sudo firewall-cmd --permanent --add-service=samba
sudo firewall-cmd --reload
Configure Samba config file at [/etc/samba/smb.conf][/etc/samba/smb.conf]
[samba-share]
comment = Samba on Ubuntu
path = /samba
read only = no
browsable = yes
Set up a Samba account for $USER
sudo smbpasswd -a $USER
Restart Samba service [vitux.com][https://vitux.com/how-to-install-and-configure-samba-on-ubuntu/] tecmint.com
sudo systemctl restart smbd.service
Install and configure Samba as a client
sudo apt install smbclient
Access samba share at $SHARE
at server $HOST
using user credential $USER
sudo smbclient //$HOST/$USER -U $USER
This will display the Samba CLI
smb: \>
Validating arguments [Sobell][Sobell]: 548
if [ $# != 2 ]
then
echo "..."
exit 1
fi
[ -z "$1" ] && echo "..." && exit 1
[coderwall.com][https://coderwall.com/p/kq9ghg/yakuake-scripting]
if [ ! -z "$2" ] ; then ...; fi
Placed in a while loop, if user responds with anything except "y" (the read command will read only the first letter) the loop will terminate [Cannon][CLKF]
read -p "Backup another server? (y/n)" -n 1
["$BACKUP_AGAIN"="y"] || break
Test from the inside out, starting with the loopback
- ping looback address, testing the TCP/IP stack
- ping the hardware interface
- ping another host on the network
- ping the gateway
- ping an IP address on the Internet
- ping a hostname on the Internet
Display contents of a random file
ls | sort -R | sed 1q | xargs cat
Find out which commands you use most often
history | awk '{print $2' | sort | uniq -c | sort -rn | head
Count the number of occurrences of a string
| uniq -c | sort -
Change hostname
sudo hostnamectl set-hostname newhostname
Check kernel version linuxize.com
uname -srm
hostnamectl | grep "Kernel"
cat /proc/version
Inspect available drives and partitions before/after inserting USB drive
lsblk
Mount ISO (if
)to USB drive (of
), with progress displayed
dd if=Downloads/archlinux-2018.03.01-x86_64.iso of=/dev/sdba status="progress"
Reboot from the USB drive. If there are values displayed a UEFI system is required and a different installation sequence is needed.
ls /sys/firmware/efi/efivars
Ensure an Ethernet internet connection or wi-fi menu
a valid Wi-Fi connection is present
timedatectl set-ntp true
Begin the process of partitioning the disk; enter the fdisk
command prompt
fdisk /dev/sdb
Set up ext4
filesystem on boot, root, and home partitions
mkfs.ext4 /dev/sdb1
mkfs.ext4 /dev/sdb3
mkfs.ext4 /dev/sdb4
Make the swap partition a swap drive
mkswap /dev/sdb2
swapon /dev/sdb2
Mount partitions
mount /dev/sdb3 /mnt
mkdir /mnt/home
mkdir /mnt/boot
mount /dev/sdb1 /mnt/boot
mount /dev/sdb4 /mnt/home
Install Arch Linux on the directory provided with the packages base
, base-devel
(which includes sudo
and other development tools), vim
pacstrap /mnt base base-devel vim
Make an fstab
file, taking all the drives mounted at that location, going off of UUIDs rather than the sd
identifiers (which might change)
genfstab -U /mnt > /mnt/etc/fstab
Change root to new Arch Linux installation
arch-chroot /mnt
Install networkmanager
which will allow Ethernet Internet connections upon reboot
pacman -S networkmanager
Tell SystemD to start NetworkManager upon login
systemctl enable NetworkManager
Install GRUB
pacman -S grub
Install GRUB as bootloader
grub-install --target=i386-pc /dev/sdb
Generate GRUB configuration
grub-mkconfig -o /boot/grub/grub.cfg
Set password for root
passwd
Uncomment the two lines referring to US English
vim /etc/locale.gen
Read that file and set locale
locale-gen
Set LANG
language variable
echo "LANG=en-US.UTF-8" > /etc/locale.conf
Set timezone by making localtime
a link to the correct timezone (this command is all that is required when resetting timezone during travel)
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
Write new hostname
echo archizard > /etc/hostname
Return to USB shell
exit
Unmount hard drive for safety
umount -R /mnt
Reboot
reboot
- Install
noto-fonts
andttf-linux-libertine
ttf-inconsolata
-
~/.config/fontconfig/fonts.conf
XML file that defines fonts as serif, monospace, etc
pacman -S xfce4
exec xfce4-session
sudo pacman -S lightdm lightdm-gtk-greeter
sudo systemctl enable lightdm.service
- Ctrl+Alt+F2|F3|F4... bring up another TTY
- Alt+LeftArrow|RightArrow navigate to adjacent TTY