Common Tasks - marco1475/linux-htpc GitHub Wiki
Shift + PgUp or PgDn will scroll through the console log.
Read 4
Write 2
Execute 1
-
The
lscommand lists 7 metadata fields:<info> <hardlinks> <owner> <group> <size> <modified> <name>-
infoincludes the file type (-for normal file,dfor directory,pfor named pipe, andlfor symbolic link), and permission triples forowner,group, andothers.
-
pacman -S <package_name>
pacman -Rs <package_name>
pacman -Syu
pacdiff
- You will need to install the
pacman-contribpackage to getpacdiff. - If the kernel gets updated, don't forget to restart, otherwise you'll get weird errors.
| Action | Shortcut |
|---|---|
| next change | ]c |
| previous change | [c |
| diff obtain | do |
| diff put | dp |
| fold open | zo |
| fold close | zc |
| rescan files | :diffupdate |
| switch window | Ctrl-W + Ctrl-W |
-
diff obtainanddiff putare relative to the current split window, i.e.obtaincopies from the other window to the current window andputcopies from the current window to the other window.
-
List of file and directory sizes in human-readable format:
du -ah <directory> -
Total size of a directory:
du -sh <directory>
-
Start and stop:
systemctl start <service_name>.service systemctl stop <service_name>.service -
Add and remove from boot sequence:
systemctl enable <service_name>.service systemctl disable <service_name>.service -
Reload changed configuration files:
systemctl daemon-reload -
See log of a given service:
journalctl -u service-name.service -b-
-blimits the log to the current boot session.
-
usermod -aG <group> <user>
groupadd <group>
uname -r
lsmod | grep <module_name>
-
>writes to (i.e. overwrites) a file -
>>appends to a file
ssh -p port user@server-address
scp -P port <local/file> [email protected]:/remote/file
/connect chat.freenode.net
/msg NickServ idenfity marco1475 \<password\>
/join #archlinux
-
Non-interactive consoles (most Linux-ones) source
~/.bashrc. -
Interactive consoles (e.g. macOS' Terminal) source
~/.bash_profile. -
To solve this problem make
~/.bash_profilesource~/.bashrc:if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
dd if=/dev/urandom of=/dev/sdX bs=512
-
Find out the
bsvalue by runningfdisk -l /dev/sdXand look for the "physical sector size". -
To check on the progress of
dd, run the following command in a separate terminal:kill -USR1 $(pgrep dd)
-
If
/sys/block/md0/md/mismatch_cntcontains anything other than0you need to repair your RAID array. -
Instead of setting
/sys/block/md0/md/sync_actiontocheck, set it torepair:echo repair > /sys/block/md0/md/sync_action- You will have to do this as
root, justsudowon't do. - You can monitor the repair (or check) progress by using
cat /proc/mdstat.
- You will have to do this as
-
UUIDs:lsblk -no name,uuid ls -l /dev/disk/by-uuid/ -
PARTUUIDs:lsblk -no name,partuuid ls -l /dev/disk/by-partuuid/
cryptsetup open --type luks /dev/sdaX <dev-mapper-name>
cryptsetup close <dev-mapper-name>
- The partition appears under
/dev/mapper/<dev-mapper-name>
-
systemd-bootassumes the EFI System Partition is mounted on/boot, which is not true in our case (it's on/espand/bootismount-bound to/boot). -
You have to pass
--pathto the update call:bootctl --path=/esp update
-
The logs can be accessed through:
journalctl -b -
Boot messages are cleared because:
- The kernel parameters at boot have the
quietflag set.- To fix this, remove the
quietflag from/esp/loader/entries/arch.conf'soptionsline.
- To fix this, remove the
- Late KMS boot messages override the previous output.
- There is no way to fix this.
-
getty@tty1service does not pass the--noclearflag to agetty.- Arch sets this flag by default.
-
systemdclears the screen before showing the login prompt.-
To fix this, create
/etc/systemd/system/[email protected]/noclear.confto override onlyTTYVTDisallocatefor agetty onTTY1and leave the global service file/usr/lib/systemd/system/[email protected]untouched.[Service] TTYVTDisallocate=no
-
- The kernel parameters at boot have the
-
Create a directory for the AUR build and change directories:
mkdir ~/aur && cd ~/aur -
Download the
PKGBUILDtarball from the Arch User Repository:wget <url> -
Extract the tarball to the AUR build directory created in step 1:
tar -xvf <package_name>.tar.gz -
Change directory to the extracted package, verify the
PKGBUILDand all.installfiles for malicious code, and build the package:cd <package_name> makepkg -sri # Run this as normal user, not root!