Common Tasks - marco1475/linux-htpc GitHub Wiki
Shift
+ PgUp
or PgDn
will scroll through the console log.
Read 4
Write 2
Execute 1
-
The
ls
command lists 7 metadata fields:<info> <hardlinks> <owner> <group> <size> <modified> <name>
-
info
includes the file type (-
for normal file,d
for directory,p
for named pipe, andl
for 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-contrib
package 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 obtain
anddiff put
are relative to the current split window, i.e.obtain
copies from the other window to the current window andput
copies 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
-
-b
limits 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_profile
source~/.bashrc
:if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
dd if=/dev/urandom of=/dev/sdX bs=512
-
Find out the
bs
value by runningfdisk -l /dev/sdX
and 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_cnt
contains anything other than0
you need to repair your RAID array. -
Instead of setting
/sys/block/md0/md/sync_action
tocheck
, set it torepair
:echo repair > /sys/block/md0/md/sync_action
- You will have to do this as
root
, justsudo
won't do. - You can monitor the repair (or check) progress by using
cat /proc/mdstat
.
- You will have to do this as
-
UUID
s:lsblk -no name,uuid ls -l /dev/disk/by-uuid/
-
PARTUUID
s: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-boot
assumes the EFI System Partition is mounted on/boot
, which is not true in our case (it's on/esp
and/boot
ismount
-bound to/boot
). -
You have to pass
--path
to 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
quiet
flag set.- To fix this, remove the
quiet
flag from/esp/loader/entries/arch.conf
'soptions
line.
- To fix this, remove the
- Late KMS boot messages override the previous output.
- There is no way to fix this.
-
getty@tty1
service does not pass the--noclear
flag to agetty.- Arch sets this flag by default.
-
systemd
clears the screen before showing the login prompt.-
To fix this, create
/etc/systemd/system/[email protected]/noclear.conf
to override onlyTTYVTDisallocate
for agetty onTTY1
and 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
PKGBUILD
tarball 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
PKGBUILD
and all.install
files for malicious code, and build the package:cd <package_name> makepkg -sri # Run this as normal user, not root!