edit metadata
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Makefiles"
|
||||
tags: [ "system", "makefiles" ]
|
||||
tags: [ "system", "make" ]
|
||||
---
|
||||
|
||||
The `make` system wants to know:
|
||||
@@ -11,7 +11,7 @@ The `make` system wants to know:
|
||||
|
||||
Start with a basic test-area.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
mkdir make_test ; cd $_
|
||||
printf "%s:\n" README.md > Makefile
|
||||
printf "\t%s\n" 'echo "Basic makefile example." > $@' >> Makefile
|
||||
@@ -32,8 +32,6 @@ README.md: Makefile
|
||||
echo '```' >> $@
|
||||
cat $< >> $@
|
||||
echo '```' >> $@
|
||||
|
||||
|
||||
```
|
||||
|
||||
Note the order:
|
||||
@@ -92,7 +90,7 @@ $(storage_directory)/README.md: README.md
|
||||
|
||||
Now you can tell `make` to create the backup:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
make backups/README.md
|
||||
```
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Makefile Graphs"
|
||||
tags: [ "system", "makefiles", "graph" ]
|
||||
tags: [ "system", "make", "graph" ]
|
||||
---
|
||||
|
||||
If you have `graph-easy` (often in the package `perl-graph-easy` or similar), you can make a graph from the makefile with `make2graph` (the package is often called `makefile2graph`).
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Makefiles"
|
||||
tags: [ "system", "makefiles", "help" ]
|
||||
tags: [ "system", "make", "help" ]
|
||||
---
|
||||
|
||||
Make your first target 'help' to give an overview of the main targets.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
---
|
||||
title: "Makefile Patterns"
|
||||
tags: [ "system", "makefiles" ]
|
||||
tags: [ "system", "make" ]
|
||||
---
|
||||
|
||||
Using the [basic example](../Makefile.md), you can make a complete backup of all backup files.
|
||||
@@ -27,7 +27,6 @@ backups/backup.tgz: backups/backup_29.md backups/backup_30.md
|
||||
tar czf backups/backup.tgz backups/backup_29.md backups/backup_30.md
|
||||
```
|
||||
|
||||
|
||||
The phony `backup` target should now point to this tar backup.
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "awk"
|
||||
tags: [ "System" ]
|
||||
tags: [ "System", ".csv" ]
|
||||
---
|
||||
# Basics
|
||||
|
||||
|
@@ -30,7 +30,7 @@ There are a bunch of files:
|
||||
|
||||
Goal: swap the word "Column" for "Alice" in all files.
|
||||
|
||||
```
|
||||
```sh
|
||||
IFS=$'\n'
|
||||
for f in $(find . -name "Col*"); do
|
||||
mv "$f" $(echo "$f" | sed s/Column/Alice/)
|
||||
|
@@ -1,26 +1,24 @@
|
||||
---
|
||||
title: "character-encoding"
|
||||
tags: [ "System" ]
|
||||
tags: [ "System", "encoding" ]
|
||||
---
|
||||
|
||||
Convert a text file from one encoding type to another with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iconv -f ascii -t utf8 oldfilename > newfilename
|
||||
```
|
||||
|
||||
Available options are:
|
||||
|
||||
* ISO-8859-15
|
||||
|
||||
* UTF-8
|
||||
|
||||
* ASCII
|
||||
|
||||
* Lots more
|
||||
- ISO-8859-15
|
||||
- UTF-8
|
||||
- ASCII
|
||||
- Lots more
|
||||
|
||||
Generate a full list of encoding types available with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
iconv -l
|
||||
```
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "deduplicate"
|
||||
tags: [ "system", "deduplicate", "duplicates", "maintenance" ]
|
||||
tags: [ "system", "deduplicate", "maintenance", "storage" ]
|
||||
---
|
||||
|
||||
`rdfind`: find duplicate files, then delete them, or turn them into links.
|
||||
|
@@ -1,27 +1,24 @@
|
||||
---
|
||||
title: "$EDITOR"
|
||||
tags: [ "System" ]
|
||||
tags: [ "system" ]
|
||||
---
|
||||
The System's default text editor can be defined within /etc/profile. It's given the variable `EDITOR`.
|
||||
|
||||
Add these lines to `/etc/profile.d/local.sh`:
|
||||
|
||||
```
|
||||
|
||||
export EDITOR=vim
|
||||
|
||||
export VISUAL=$EDITOR
|
||||
Add these lines to `/etc/profile.d/custom.sh`:
|
||||
|
||||
```sh
|
||||
echo 'export EDITOR=vim' >> /etc/profile.d/custom.sh
|
||||
echo 'export VISUAL=$EDITOR' >> /etc/profile.d/custom.sh
|
||||
```
|
||||
|
||||
Then reload that profile with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
source /etc/profile
|
||||
```
|
||||
|
||||
If you want to ensure `nano` never appears again:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
sudo ln -sf $(which vim) $(which nano)
|
||||
```
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "fstab"
|
||||
tags: [ "System" ]
|
||||
tags: [ "system", "disk" ]
|
||||
---
|
||||
# Basics
|
||||
|
||||
@@ -29,7 +29,7 @@ Ignore this obsolete option.
|
||||
## 6: Pass
|
||||
|
||||
| Number | Meaning |
|
||||
| | |
|
||||
|:------:|:---------------------:|
|
||||
| 0 | Swap (or not mounted) |
|
||||
| 1 | Mount at / |
|
||||
| 2 | Mount somewhere else |
|
||||
@@ -37,5 +37,5 @@ Ignore this obsolete option.
|
||||
## Options
|
||||
|
||||
- `nofail` means the computer will not fail to boot, even if the drive fails, or is unplugged. It's a good option for everything except `/`.
|
||||
- noauto means 'don't mount on boot' (but you can still mount with `mount -a`).
|
||||
- `noauto` means 'don't mount on boot' (but you can still mount with `mount -a`).
|
||||
|
||||
|
@@ -1,41 +1,41 @@
|
||||
---
|
||||
title: "kernel"
|
||||
tags: [ "System" ]
|
||||
tags: [ "system" ]
|
||||
---
|
||||
Check which kernet modules are loaded into memory
|
||||
|
||||
```bash
|
||||
sudo /sbin/lsmod
|
||||
Check which kernel modules are loaded into memory:
|
||||
|
||||
```sh
|
||||
su root
|
||||
/sbin/lsmod
|
||||
```
|
||||
|
||||
Check which virtual box modules are loaded into memory
|
||||
|
||||
```bash
|
||||
sudo /sbin/lsmod | grep vbox
|
||||
```sh
|
||||
/sbin/lsmod | grep vbox
|
||||
```
|
||||
|
||||
Virtual box is using vboxpci, vboxnetadp, vboxnetflt, vboxdr.
|
||||
|
||||
Look at what's claiming wifi:
|
||||
|
||||
```bash
|
||||
sudo lshw -C network
|
||||
```sh
|
||||
lshw -C network
|
||||
```
|
||||
|
||||
If this shows that the device is 'unclaimed' then it's time to add a module, e.g. ath9k.
|
||||
|
||||
```bash
|
||||
sudo modprobe ath9k
|
||||
```sh
|
||||
modprobe ath9k
|
||||
```
|
||||
|
||||
Modules can also be 'restarted' by removing and adding them, e.g. the video module, 'uvcvideo':
|
||||
|
||||
```bash
|
||||
sudo rmmod uvcvideo
|
||||
```sh
|
||||
rmmod uvcvideo
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo modprobe uvcvideo
|
||||
```sh
|
||||
modprobe uvcvideo
|
||||
```
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "lf - The Light File Manager"
|
||||
tags: [ "File Browser" ]
|
||||
tags: [ "File Browser", "TUI" ]
|
||||
---
|
||||
|
||||
## Config File
|
||||
|
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "mdadm"
|
||||
tags: [ "RAID" ]
|
||||
tags: [ "RAID", "disk" ]
|
||||
---
|
||||
# RAID5
|
||||
|
||||
|
@@ -15,6 +15,7 @@ Show memory usage in Gibitytes.
|
||||
```bash
|
||||
free -g
|
||||
```
|
||||
|
||||
Show low and high gigibtye usage on a *l*ine, and repeat the measurement every 5 seconds:
|
||||
|
||||
```bash
|
||||
|
@@ -2,10 +2,12 @@
|
||||
title: "partitions"
|
||||
tags: [ "System" ]
|
||||
---
|
||||
|
||||
# FDisk Basics
|
||||
|
||||
```bash
|
||||
sudo fdisk /dev/sda
|
||||
```sh
|
||||
su root
|
||||
fdisk /dev/sda
|
||||
```
|
||||
|
||||
- m for help.
|
||||
@@ -31,20 +33,20 @@ fdisk will not help with a GPT formatted drive. For this, use gdisk, which is m
|
||||
|
||||
Now that we have a partition, we can make it into a fileSystem. Most will use:
|
||||
|
||||
```bash
|
||||
sudo mkfs -t ext4 /dev/sdc1
|
||||
```sh
|
||||
mkfs -t ext4 /dev/sdc1
|
||||
```
|
||||
|
||||
or if you're making a swap partition, you can use:
|
||||
|
||||
```bash
|
||||
sudo mkswap /dev/sdb2
|
||||
```sh
|
||||
mkswap /dev/sdb2
|
||||
```
|
||||
|
||||
or for the reiser fileSystem, we can use:
|
||||
|
||||
```bash
|
||||
sudo mkreiserfs /dev/sdc2
|
||||
```sh
|
||||
mkreiserfs /dev/sdc2
|
||||
```
|
||||
|
||||
# File System Types
|
||||
@@ -61,86 +63,86 @@ sudo mkreiserfs /dev/sdc2
|
||||
|
||||
# Parted
|
||||
|
||||
```bash
|
||||
sudo parted /dev/sdb
|
||||
```sh
|
||||
parted /dev/sdb
|
||||
```
|
||||
|
||||
|
||||
# Monitoring
|
||||
Look at physical and virtual partitions:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
df -h
|
||||
```
|
||||
|
||||
or divide things by inode - the thing which records where files are?
|
||||
|
||||
```bash
|
||||
```sh
|
||||
df -i
|
||||
```
|
||||
|
||||
Examine a fileSystem with:
|
||||
|
||||
```bash
|
||||
sudo dumpe2fs /dev/sda1 | less
|
||||
```sh
|
||||
dumpe2fs /dev/sda1 | less
|
||||
```
|
||||
|
||||
# Prevention
|
||||
There are multiple programs which work mostly the same way.
|
||||
|
||||
```bash
|
||||
sudo tune2fs -c 30 /dev/sda1
|
||||
```sh
|
||||
tune2fs -c 30 /dev/sda1
|
||||
```
|
||||
|
||||
This will check sda1 every 30 boots. It can also be checked every month.
|
||||
|
||||
```bash
|
||||
sudo tune2fs -i 1m /dev/sda1
|
||||
```sh
|
||||
tune2fs -i 1m /dev/sda1
|
||||
```
|
||||
|
||||
This thing can also make a new label for the System:
|
||||
|
||||
```bash
|
||||
sudo tune2fs -L new_name /dev/sdb3
|
||||
```sh
|
||||
tune2fs -L new_name /dev/sdb3
|
||||
```
|
||||
|
||||
# Repair
|
||||
Start by unmounting the fileSystem.
|
||||
|
||||
```bash
|
||||
sudo umount /dev/sdc1
|
||||
```sh
|
||||
umount /dev/sdc1
|
||||
```
|
||||
|
||||
Then it's time to check.
|
||||
|
||||
```bash
|
||||
sudo fsck /dev/sdc1
|
||||
```sh
|
||||
fsck /dev/sdc1
|
||||
```
|
||||
|
||||
And possibly repair damage:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
e2fsck -p /dev/sdc1
|
||||
```
|
||||
|
||||
|
||||
or the same with:
|
||||
|
||||
```bash
|
||||
sudo debugfs /dev/sdc1
|
||||
```sh
|
||||
debugfs /dev/sdc1
|
||||
```
|
||||
|
||||
# Mounting
|
||||
You can mount with a specified filetype with:
|
||||
|
||||
```bash
|
||||
sudo mount -t ext3 /dev/sdc2 /mnt/stick
|
||||
```sh
|
||||
mount -t ext3 /dev/sdc2 /mnt/stick
|
||||
```
|
||||
|
||||
or if you don't know the type, just try the lot:
|
||||
|
||||
```bash
|
||||
sudo mount -a /dev/sdc1 /mnt/stick
|
||||
```sh
|
||||
mount -a /dev/sdc1 /mnt/stick
|
||||
```
|
||||
|
||||
# File Systems
|
||||
@@ -152,35 +154,35 @@ NB: When I followed these instructions, the process destroyed my data. Seemed fi
|
||||
|
||||
Check the fileSystem's health:
|
||||
|
||||
```bash
|
||||
sudo e2fsck -f /dev/sdb1
|
||||
```sh
|
||||
e2fsck -f /dev/sdb1
|
||||
```
|
||||
|
||||
Resize the file System to something smaller than what you want, so here I want 500G and so I resize to 450 G.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
resize2fs /dev/sdb1 450G
|
||||
```
|
||||
|
||||
Then delete the partition with either gdisk or fdisk, depending upon the layout.
|
||||
|
||||
```bash
|
||||
sudo fdisk /dev/sdb
|
||||
```sh
|
||||
fdisk /dev/sdb
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
d
|
||||
```
|
||||
|
||||
Then make a new fileSystem of the desired type with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
n
|
||||
```
|
||||
|
||||
And finally resize to the full size you want:
|
||||
|
||||
sudo resize2fs /dev/sdb1
|
||||
resize2fs /dev/sdb1
|
||||
|
||||
And then check your disk again with e2fsck.
|
||||
|
||||
@@ -193,20 +195,18 @@ Let's start with names. PV = 'Physical Volume', VG = 'Volume Group', and LV = '
|
||||
|
||||
Now we can create a volume group out of sdb2 and sdc3:
|
||||
|
||||
```bash
|
||||
sudo vgcreate my-new-vg /dev/sdb2 /dev/sdc3
|
||||
```sh
|
||||
vgcreate my-new-vg /dev/sdb2 /dev/sdc3
|
||||
```
|
||||
|
||||
Then make a new logical volume out of the volume group:
|
||||
|
||||
```bash
|
||||
sudo lvcreate -n my-new-lv my-new-vg
|
||||
```sh
|
||||
lvcreate -n my-new-lv my-new-vg
|
||||
```
|
||||
|
||||
Then have a look at all logical volumes:
|
||||
|
||||
```bash
|
||||
sudo lvscan
|
||||
```sh
|
||||
lvscan
|
||||
```
|
||||
|
||||
|
||||
|
@@ -4,49 +4,47 @@ tags: [ "basics" ]
|
||||
---
|
||||
# Making a Swap File
|
||||
|
||||
```bash
|
||||
```sh
|
||||
su root
|
||||
cd /var/cache/
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo dd if=/dev/zero of=swapfile bs=1K count=4M
|
||||
dd if=/dev/zero of=swapfile bs=1K count=4M
|
||||
```
|
||||
|
||||
This creates a swapfile of (1k x 4M) 4 Gigs.
|
||||
Change 4M to XM for an XGig swap.
|
||||
|
||||
```bash
|
||||
sudo chmod 600 swapfile
|
||||
```sh
|
||||
chmod 600 swapfile
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo mkswap swapfile
|
||||
```sh
|
||||
mkswap swapfile
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo swapon swapfile
|
||||
```sh
|
||||
swapon swapfile
|
||||
```
|
||||
|
||||
Test it's working with top
|
||||
|
||||
```bash
|
||||
```sh
|
||||
top -bn1 | grep -i swap
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
```bash
|
||||
echo "/var/cache/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
|
||||
```sh
|
||||
echo "/var/cache/swapfile none swap sw 0 0" | tee -a /etc/fstab
|
||||
```
|
||||
|
||||
Test it'll work at boot with:
|
||||
|
||||
```bash
|
||||
sudo swapoff swapfile
|
||||
```sh
|
||||
swapoff swapfile
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo swapon -va
|
||||
```sh
|
||||
swapon -va
|
||||
```
|
||||
|
||||
# Partition Swaps
|
||||
@@ -57,13 +55,13 @@ Put this in /etc/fstab:
|
||||
|
||||
Then test it works with:
|
||||
|
||||
```bash
|
||||
sudo swapon -va
|
||||
```sh
|
||||
swapon -va
|
||||
```
|
||||
|
||||
Test other partitions in fstab with:
|
||||
|
||||
```bash
|
||||
sudo mount -a
|
||||
```sh
|
||||
mount -a
|
||||
```
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: "tmux"
|
||||
tags: [ "System" ]
|
||||
tags: [ "system" ]
|
||||
---
|
||||
Start with:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tmux
|
||||
```
|
||||
|
||||
@@ -34,21 +34,21 @@ In addition to Windows, there are panes.
|
||||
|
||||
Crate a new session with the name 'backup'.
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tmux new -s backup
|
||||
```
|
||||
|
||||
List sessions:
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tmux list-sessions
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tmux kill-session -t 2
|
||||
```
|
||||
|
||||
```bash
|
||||
```sh
|
||||
tmux attach -t backup
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user