forked from andonome/lk
change formatting
input examples are now given as ```bash input $ARG1 ``` While outputs use md's '> ' sign as a quote.
This commit is contained in:
@@ -8,24 +8,33 @@ tags: [ "Documentation", "System" ]
|
||||
|
||||
Install:
|
||||
|
||||
> yay -S simple-mtpfs
|
||||
```bash
|
||||
yay -S simple-mtpfs
|
||||
```
|
||||
|
||||
List available phones:
|
||||
|
||||
> simple-mtpfs -l
|
||||
```bash
|
||||
simple-mtpfs -l
|
||||
```
|
||||
|
||||
Make a mount point:
|
||||
|
||||
> mkdir phone
|
||||
```bash
|
||||
mkdir phone
|
||||
```
|
||||
|
||||
Check your phone, and tell it to allow access to the USB.
|
||||
|
||||
> simple-mtpfs --device 1 phone
|
||||
```bash
|
||||
simple-mtpfs --device 1 phone
|
||||
```
|
||||
|
||||
## Stop
|
||||
|
||||
> fusermount -u phone
|
||||
|
||||
```bash
|
||||
fusermount -u phone
|
||||
rmdir phone
|
||||
```
|
||||
|
||||
|
||||
|
@@ -8,39 +8,55 @@ See a file's contents:
|
||||
|
||||
Return full contents of a string:
|
||||
|
||||
> awk '{ print }' file
|
||||
```bash
|
||||
awk '{ print }' file
|
||||
```
|
||||
|
||||
Print the first and second column:
|
||||
|
||||
> awk '{print$1$2}'
|
||||
```bash
|
||||
awk '{print$1$2}'
|
||||
```
|
||||
|
||||
Return every line with the word 'the' (like grep):
|
||||
|
||||
> awk '/the/{print}' file
|
||||
```bash
|
||||
awk '/the/{print}' file
|
||||
```
|
||||
|
||||
Print everything containing a lowercase letter:
|
||||
|
||||
> awk '/[a-z]/{print}' file
|
||||
```bash
|
||||
awk '/[a-z]/{print}' file
|
||||
```
|
||||
|
||||
Same with numbers [0-9], or using a caret we can show lines starting with a number - ^[0-9], or ending with an uppercase letter - $[A-Z].
|
||||
|
||||
# Conditionals
|
||||
|
||||
> awk '{ if($1 ~ /123/) print }' file
|
||||
```bash
|
||||
awk '{ if($1 ~ /123/) print }' file
|
||||
```
|
||||
|
||||
Check if the first column is equal to 1 or 2 or 3, and if so then print that line.
|
||||
|
||||
Grep for 'hawk' in a story:
|
||||
|
||||
> awk '/hawk/' story.txt
|
||||
```bash
|
||||
awk '/hawk/' story.txt
|
||||
```
|
||||
|
||||
Return any line with one or more "&" sequences:
|
||||
|
||||
> awk '/&+/' script.sh
|
||||
```bash
|
||||
awk '/&+/' script.sh
|
||||
```
|
||||
|
||||
The pipe is used for 'or', so 'Orcs or drums' would be:
|
||||
|
||||
> awk '/Orcs|Drums/' story.txt
|
||||
```bash
|
||||
awk '/Orcs|Drums/' story.txt
|
||||
```
|
||||
|
||||
Basic variables are:
|
||||
|
||||
|
@@ -4,7 +4,9 @@ tags: [ "Documentation", "System" ]
|
||||
---
|
||||
Convert a text file from one encoding type to another with:
|
||||
|
||||
> iconv -f ascii -t utf8 oldfilename > newfilename
|
||||
```bash
|
||||
iconv -f ascii -t utf8 oldfilename > newfilename
|
||||
```
|
||||
|
||||
Available options are:
|
||||
|
||||
@@ -18,5 +20,7 @@ Available options are:
|
||||
|
||||
Generate a full list of encoding types available with:
|
||||
|
||||
> iconv -l
|
||||
```bash
|
||||
iconv -l
|
||||
```
|
||||
|
||||
|
@@ -1,49 +0,0 @@
|
||||
---
|
||||
title: "compression"
|
||||
tags: [ "Documentation", "System" ]
|
||||
---
|
||||
# Tar
|
||||
|
||||
## Basics
|
||||
|
||||
* --create -c
|
||||
|
||||
* --list -t
|
||||
|
||||
* --extract --get -x
|
||||
|
||||
* --file=file -f file
|
||||
|
||||
|
||||
|
||||
|
||||
Look in tar file:
|
||||
|
||||
> tar -tf filename.tar.gz
|
||||
|
||||
Look in detail:
|
||||
|
||||
> tar -tvf filename.tar.gz
|
||||
|
||||
# Zip
|
||||
|
||||
Zip file:
|
||||
|
||||
> zip name.zip file
|
||||
|
||||
Zip directory:
|
||||
|
||||
> zip -r name.zip dir
|
||||
|
||||
Update existing entries.
|
||||
|
||||
> zip -ru name.zip dir file1 file2
|
||||
|
||||
Delete file from the zipfile.
|
||||
|
||||
> zip -d name.zip dfile
|
||||
|
||||
# 7z for .img.xz
|
||||
|
||||
> 7z x file.img.xz
|
||||
|
@@ -9,27 +9,37 @@ Install the package `xdg-utils`, then make very liberal use of the tab button.
|
||||
|
||||
Ask what type of application opens an mkv file:
|
||||
|
||||
> xdg-mime query default video/mkv
|
||||
```bash
|
||||
xdg-mime query default video/mkv
|
||||
```
|
||||
|
||||
Same with pdf:
|
||||
|
||||
> xdg-mime query default application/pdf
|
||||
```bash
|
||||
xdg-mime query default application/pdf
|
||||
```
|
||||
|
||||
Ask what file-type `book.pdf` uses.
|
||||
|
||||
> xdg-mime query filetype *book.pdf*
|
||||
```bash
|
||||
xdg-mime query filetype *book.pdf*
|
||||
```
|
||||
|
||||
## Set
|
||||
|
||||
Set the mime type of mp4 videos to mpv.
|
||||
|
||||
> xdg-mime default mpv.desktop video/mp4
|
||||
```bash
|
||||
xdg-mime default mpv.desktop video/mp4
|
||||
```
|
||||
|
||||
You'll need to use the tab key a lot here, and remember many items start with `org`.
|
||||
|
||||
You can use an asterisk for everything in a category.
|
||||
|
||||
> xdg-mime default org.gnome.font-viewer.desktop font/\*
|
||||
```bash
|
||||
xdg-mime default org.gnome.font-viewer.desktop font/\*
|
||||
```
|
||||
|
||||
This often won't work as expected, because some fonts will have the type `application` rather than `font`.
|
||||
|
||||
|
@@ -1,51 +0,0 @@
|
||||
---
|
||||
title: "e-mail"
|
||||
tags: [ "Documentation", "System" ]
|
||||
---
|
||||
# Terminology
|
||||
|
||||
|MTA | Mail transfer agent |
|
||||
|POP3| Post Office Protocol 3 |
|
||||
|SMTP| Simple Mail Transfer Protocol|
|
||||
|IMAP| Internet Message Access Protocol|
|
||||
|
||||
There are a number of Linux e-mail agents - postfix, sendmail, exim (insecure) and qmail (dead).
|
||||
|
||||
# Programs
|
||||
|
||||
> sudo apt-get install postfix mailutils
|
||||
|
||||
This will register your domain in the /etc/postfix/main.cf file.
|
||||
|
||||
# Internal Mail
|
||||
|
||||
> sendmail -t roach-1
|
||||
|
||||
Write a message and stop composition with Ctrl+D.
|
||||
|
||||
The mail is kept in /var/mail/ and you can read it with:
|
||||
|
||||
> mail
|
||||
|
||||
# Aliases
|
||||
|
||||
Aliases are groups of mail recipients. The lists are kept under /etc/aliases.
|
||||
|
||||
`crew: matthew@gmail.com,ghost,danial@yahoo.com`
|
||||
|
||||
Update the list of aliases from this with:
|
||||
|
||||
> sudo newaliases
|
||||
|
||||
Then you can:
|
||||
|
||||
> sendmail -t crew
|
||||
|
||||
... and send to the whole crew.
|
||||
|
||||
|
||||
View pending e-mails using:
|
||||
|
||||
> mailq
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "editors"
|
||||
title: "$EDITOR"
|
||||
tags: [ "Documentation", "System" ]
|
||||
---
|
||||
The System's default text editor can be defined within /etc/profile. It's given the variable `EDITOR`.
|
||||
@@ -16,9 +16,12 @@ export VISUAL=$EDITOR
|
||||
|
||||
Then reload that profile with:
|
||||
|
||||
> source /etc/profile
|
||||
```bash
|
||||
source /etc/profile
|
||||
```
|
||||
|
||||
If nano still pops up:
|
||||
|
||||
> sudo ln -sf $(which vim) $(which nano)
|
||||
If you want to ensure `nano` never appears again:
|
||||
|
||||
```bash
|
||||
sudo ln -sf $(which vim) $(which nano)
|
||||
```
|
||||
|
@@ -1,45 +0,0 @@
|
||||
---
|
||||
title: "elvish"
|
||||
tags: [ "Documentation", "System" ]
|
||||
---
|
||||
# Setup
|
||||
To run a shell as non-root, the shell must be listed in /etc/shells.
|
||||
|
||||
# Basics
|
||||
Elvish has an inbuilt calculator.
|
||||
|
||||
Basic commands include: *, ^, +. E.g.:
|
||||
|
||||
> 2*4+2
|
||||
|
||||
|
||||
#Lists
|
||||
|
||||
li = [orcs hobbits elves]
|
||||
|
||||
Then either
|
||||
|
||||
> echo $li
|
||||
|
||||
> echo $@li
|
||||
|
||||
> echo $path
|
||||
|
||||
|
||||
# Environmental Variables
|
||||
Summon with E:, e.g.
|
||||
|
||||
> echo $E:USER
|
||||
|
||||
# Commands
|
||||
|
||||
C-n - File manager
|
||||
|
||||
C-l - Recent locations
|
||||
|
||||
C-r - Recent commands
|
||||
|
||||
See all binding with:
|
||||
|
||||
> pprint $edit:insert:binding
|
||||
|
@@ -1,25 +1,38 @@
|
||||
|
||||
---
|
||||
title: "exiftool"
|
||||
tags: [ "Documentation", "Metadata" ]
|
||||
---
|
||||
|
||||
Find metadata.
|
||||
|
||||
> exiftool image.jpg
|
||||
```bash
|
||||
exiftool image.jpg
|
||||
```
|
||||
|
||||
Find info on all images in current directory.
|
||||
|
||||
> exiftool -ext .png .
|
||||
```bash
|
||||
exiftool -ext .png .
|
||||
```
|
||||
|
||||
You can make this recurring with the -r switch.
|
||||
|
||||
And overwrite all metadata:
|
||||
|
||||
> exiftool -all= -overwrite_original -ext jpg .
|
||||
```bash
|
||||
exiftool -all= -overwrite_original -ext jpg .
|
||||
```
|
||||
|
||||
Or just GPS data:
|
||||
|
||||
> exiftool -gps:all= *.jpg
|
||||
```bash
|
||||
exiftool -gps:all= *.jpg
|
||||
```
|
||||
|
||||
You can also use the imagemagick tool:
|
||||
|
||||
> identify -verbose
|
||||
```bash
|
||||
identify -verbose
|
||||
```
|
||||
|
||||
|
||||
|
@@ -15,11 +15,9 @@ The ordering of `/etc/fstab` is
|
||||
|
||||
E.g.:
|
||||
|
||||
```
|
||||
UUID=877f14e8-4738-46b0-884f-ba330dad1a7d /mnt/biggie ext4 nofail,rw,relatime 0 2
|
||||
|
||||
UUID=B21648C416488AF5 /mnt/share ntfs nofail,rw,nosuid,nodev,user_id=0,group_id=0,allow_other,blksize=4096 0 0
|
||||
```
|
||||
> UUID=877f14e8-4738-46b0-884f-ba330dad1a7d /mnt/biggie ext4 nofail,rw,relatime 0 2
|
||||
>
|
||||
> UUID=B21648C416488AF5 /mnt/share ntfs nofail,rw,nosuid,nodev,user_id=0,group_id=0,allow_other,blksize=4096 0 0
|
||||
|
||||
## 5: Dump
|
||||
|
||||
|
@@ -4,26 +4,38 @@ tags: [ "Documentation", "System" ]
|
||||
---
|
||||
Check which kernet modules are loaded into memory
|
||||
|
||||
> sudo /sbin/lsmod
|
||||
```bash
|
||||
sudo /sbin/lsmod
|
||||
```
|
||||
|
||||
Check which virtual box modules are loaded into memory
|
||||
|
||||
> sudo /sbin/lsmod | grep vbox
|
||||
```bash
|
||||
sudo /sbin/lsmod | grep vbox
|
||||
```
|
||||
|
||||
Virtual box is using vboxpci, vboxnetadp, vboxnetflt, vboxdr.
|
||||
|
||||
Look at what's claiming wifi:
|
||||
|
||||
> sudo lshw -C network
|
||||
```bash
|
||||
sudo lshw -C network
|
||||
```
|
||||
|
||||
If this shows that the device is 'unclaimed' then it's time to add a module, e.g. ath9k.
|
||||
|
||||
> sudo modprobe ath9k
|
||||
```bash
|
||||
sudo modprobe ath9k
|
||||
```
|
||||
|
||||
Modules can also be 'restarted' by removing and adding them, e.g. the video module, 'uvcvideo':
|
||||
|
||||
> sudo rmmod uvcvideo
|
||||
```bash
|
||||
sudo rmmod uvcvideo
|
||||
```
|
||||
|
||||
> sudo modprobe uvcvideo
|
||||
```bash
|
||||
sudo modprobe uvcvideo
|
||||
```
|
||||
|
||||
|
||||
|
@@ -7,7 +7,9 @@ tags: [ "Documentation", "RAID" ]
|
||||
You will need 4 disks and the `mdadm` package.
|
||||
The total size will be equal to the disks x 3, because one will be used for redundancy.
|
||||
|
||||
> sudo mdadm --create --verbose /dev/*md127* --level=5 --raid-devices=*4* */dev/sdb /dev/sdc /dev/sdd /dev/sde*
|
||||
```bash
|
||||
sudo mdadm --create --verbose /dev/*md127* --level=5 --raid-devices=*4* */dev/sdb /dev/sdc /dev/sdd /dev/sde*
|
||||
```
|
||||
|
||||
Note the variable parts:
|
||||
|
||||
@@ -17,17 +19,23 @@ Note the variable parts:
|
||||
|
||||
Now look at how the raid status:
|
||||
|
||||
> cat /proc/mdstat
|
||||
```bash
|
||||
cat /proc/mdstat
|
||||
```
|
||||
|
||||
This will increase until the entire thing is fine.
|
||||
|
||||
Check the health of your `mdadm` array:
|
||||
|
||||
> sudo mdadm --detail /dev/md127
|
||||
```bash
|
||||
sudo mdadm --detail /dev/md127
|
||||
```
|
||||
|
||||
You should see `State : clean`. If you see it is `degraded`, then a disk has broken.
|
||||
|
||||
## Replacing a Disk
|
||||
|
||||
> sudo mdadm --add /dev/md127 /dev/sdb1
|
||||
```bash
|
||||
sudo mdadm --add /dev/md127 /dev/sdb1
|
||||
```
|
||||
|
||||
|
@@ -4,7 +4,9 @@ tags: [ "Documentation", "System" ]
|
||||
---
|
||||
# FDisk Basics
|
||||
|
||||
> sudo fdisk /dev/sda
|
||||
```bash
|
||||
sudo fdisk /dev/sda
|
||||
```
|
||||
|
||||
- m for help.
|
||||
|
||||
@@ -29,15 +31,21 @@ 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:
|
||||
|
||||
> sudo mkfs -t ext4 /dev/sdc1
|
||||
```bash
|
||||
sudo mkfs -t ext4 /dev/sdc1
|
||||
```
|
||||
|
||||
or if you're making a swap partition, you can use:
|
||||
|
||||
> sudo mkswap /dev/sdb2
|
||||
```bash
|
||||
sudo mkswap /dev/sdb2
|
||||
```
|
||||
|
||||
or for the reiser fileSystem, we can use:
|
||||
|
||||
> sudo mkreiserfs /dev/sdc2
|
||||
```bash
|
||||
sudo mkreiserfs /dev/sdc2
|
||||
```
|
||||
|
||||
# File System Types
|
||||
|
||||
@@ -53,61 +61,87 @@ or for the reiser fileSystem, we can use:
|
||||
|
||||
# Parted
|
||||
|
||||
> sudo parted /dev/sdb
|
||||
```bash
|
||||
sudo parted /dev/sdb
|
||||
```
|
||||
|
||||
|
||||
# Monitoring
|
||||
Look at physical and virtual partitions:
|
||||
|
||||
> df -h
|
||||
```bash
|
||||
df -h
|
||||
```
|
||||
|
||||
or divide things by inode - the thing which records where files are?
|
||||
|
||||
> df -i
|
||||
```bash
|
||||
df -i
|
||||
```
|
||||
|
||||
Examine a fileSystem with:
|
||||
|
||||
> sudo dumpe2fs /dev/sda1 | less
|
||||
```bash
|
||||
sudo dumpe2fs /dev/sda1 | less
|
||||
```
|
||||
|
||||
# Prevention
|
||||
There are multiple programs which work mostly the same way.
|
||||
|
||||
> sudo tune2fs -c 30 /dev/sda1
|
||||
```bash
|
||||
sudo tune2fs -c 30 /dev/sda1
|
||||
```
|
||||
|
||||
This will check sda1 every 30 boots. It can also be checked every month.
|
||||
|
||||
> sudo tune2fs -i 1m /dev/sda1
|
||||
```bash
|
||||
sudo tune2fs -i 1m /dev/sda1
|
||||
```
|
||||
|
||||
This thing can also make a new label for the System:
|
||||
|
||||
> sudo tune2fs -L new_name /dev/sdb3
|
||||
```bash
|
||||
sudo tune2fs -L new_name /dev/sdb3
|
||||
```
|
||||
|
||||
# Repair
|
||||
Start by unmounting the fileSystem.
|
||||
|
||||
> sudo umount /dev/sdc1
|
||||
```bash
|
||||
sudo umount /dev/sdc1
|
||||
```
|
||||
|
||||
Then it's time to check.
|
||||
|
||||
> sudo fsck /dev/sdc1
|
||||
```bash
|
||||
sudo fsck /dev/sdc1
|
||||
```
|
||||
|
||||
And possibly repair damage:
|
||||
|
||||
> e2fsck -p /dev/sdc1
|
||||
```bash
|
||||
e2fsck -p /dev/sdc1
|
||||
```
|
||||
|
||||
|
||||
or the same with:
|
||||
|
||||
> sudo debugfs /dev/sdc1
|
||||
```bash
|
||||
sudo debugfs /dev/sdc1
|
||||
```
|
||||
|
||||
# Mounting
|
||||
You can mount with a specified filetype with:
|
||||
|
||||
> sudo mount -t ext3 /dev/sdc2 /mnt/stick
|
||||
```bash
|
||||
sudo mount -t ext3 /dev/sdc2 /mnt/stick
|
||||
```
|
||||
|
||||
or if you don't know the type, just try the lot:
|
||||
|
||||
> sudo mount -a /dev/sdc1 /mnt/stick
|
||||
```bash
|
||||
sudo mount -a /dev/sdc1 /mnt/stick
|
||||
```
|
||||
|
||||
# File Systems
|
||||
xfs and zfs can only be expanded.
|
||||
@@ -118,21 +152,31 @@ NB: When I followed these instructions, the process destroyed my data. Seemed fi
|
||||
|
||||
Check the fileSystem's health:
|
||||
|
||||
> sudo e2fsck -f /dev/sdb1
|
||||
```bash
|
||||
sudo 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.
|
||||
|
||||
> resize2fs /dev/sdb1 450G
|
||||
```bash
|
||||
resize2fs /dev/sdb1 450G
|
||||
```
|
||||
|
||||
Then delete the partition with either gdisk or fdisk, depending upon the layout.
|
||||
|
||||
> sudo fdisk /dev/sdb
|
||||
```bash
|
||||
sudo fdisk /dev/sdb
|
||||
```
|
||||
|
||||
> d
|
||||
```bash
|
||||
d
|
||||
```
|
||||
|
||||
Then make a new fileSystem of the desired type with:
|
||||
|
||||
> n
|
||||
```bash
|
||||
n
|
||||
```
|
||||
|
||||
And finally resize to the full size you want:
|
||||
|
||||
@@ -149,14 +193,20 @@ 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:
|
||||
|
||||
> sudo vgcreate my-new-vg /dev/sdb2 /dev/sdc3
|
||||
```bash
|
||||
sudo vgcreate my-new-vg /dev/sdb2 /dev/sdc3
|
||||
```
|
||||
|
||||
Then make a new logical volume out of the volume group:
|
||||
|
||||
> sudo lvcreate -n my-new-lv my-new-vg
|
||||
```bash
|
||||
sudo lvcreate -n my-new-lv my-new-vg
|
||||
```
|
||||
|
||||
Then have a look at all logical volumes:
|
||||
|
||||
> sudo lvscan
|
||||
```bash
|
||||
sudo lvscan
|
||||
```
|
||||
|
||||
|
||||
|
@@ -4,44 +4,66 @@ tags: [ "Documentation", "basics" ]
|
||||
---
|
||||
# Making a Swap File
|
||||
|
||||
> cd /var/cache/
|
||||
```bash
|
||||
cd /var/cache/
|
||||
```
|
||||
|
||||
> sudo dd if=/dev/zero of=swapfile bs=1K count=4M
|
||||
```bash
|
||||
sudo 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.
|
||||
|
||||
> sudo chmod 600 swapfile
|
||||
```bash
|
||||
sudo chmod 600 swapfile
|
||||
```
|
||||
|
||||
> sudo mkswap swapfile
|
||||
```bash
|
||||
sudo mkswap swapfile
|
||||
```
|
||||
|
||||
> sudo swapon swapfile
|
||||
```bash
|
||||
sudo swapon swapfile
|
||||
```
|
||||
|
||||
Test it's working with top
|
||||
|
||||
> top -bn1 | grep -i swap
|
||||
```bash
|
||||
top -bn1 | grep -i swap
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
> echo "/var/cache/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
|
||||
```bash
|
||||
echo "/var/cache/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
|
||||
```
|
||||
|
||||
Test it'll work at boot with:
|
||||
|
||||
> sudo swapoff swapfile
|
||||
```bash
|
||||
sudo swapoff swapfile
|
||||
```
|
||||
|
||||
> sudo swapon -va
|
||||
```bash
|
||||
sudo swapon -va
|
||||
```
|
||||
|
||||
# Partition Swaps
|
||||
|
||||
Put this in /etc/fstab:
|
||||
|
||||
`UUID=blah-blah none swap sw 0 0`
|
||||
> UUID=blah-blah none swap sw 0 0
|
||||
|
||||
Then test it works with:
|
||||
|
||||
> sudo swapon -va
|
||||
```bash
|
||||
sudo swapon -va
|
||||
```
|
||||
|
||||
Test other partitions in fstab with:
|
||||
|
||||
> sudo mount -a
|
||||
```bash
|
||||
sudo mount -a
|
||||
```
|
||||
|
||||
|
@@ -2,11 +2,15 @@
|
||||
title: "journal"
|
||||
tags: [ "Documentation", "systemd" ]
|
||||
---
|
||||
```
|
||||
|
||||
Find errors since November
|
||||
|
||||
> journalctl --since=2018-11-01 --grep="EXT4-fs error"
|
||||
```bash
|
||||
journalctl --since=2018-11-01 --grep="EXT4-fs error"
|
||||
```
|
||||
|
||||
Limit size to 2G.
|
||||
|
||||
> journalctl --vacuum-size=2G
|
||||
```bash
|
||||
journalctl --vacuum-size=2G
|
||||
|
@@ -26,13 +26,12 @@ WantedBy=multi-user.target
|
||||
|
||||
After making the new service, systemd requires reloading:
|
||||
|
||||
> sudo systemctl daemon-reload
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
# Types
|
||||
|
||||
* simple - the service cannot be called on by others. It runs on repeat.
|
||||
|
||||
* oneshot - the service executes once, then stops.
|
||||
|
||||
|
||||
|
||||
|
@@ -2,19 +2,33 @@
|
||||
title: "systemd"
|
||||
tags: [ "Documentation", "systemd" ]
|
||||
---
|
||||
> systemctl list-units
|
||||
```bash
|
||||
systemctl list-units
|
||||
```
|
||||
|
||||
> sudo systemctl status mpd
|
||||
```bash
|
||||
sudo systemctl status mpd
|
||||
```
|
||||
|
||||
> sudo systemctl daemon-reload
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
> sudo systemctl taskd.service start
|
||||
```bash
|
||||
sudo systemctl taskd.service start
|
||||
```
|
||||
|
||||
> sudo systemctl status taskd.service
|
||||
```bash
|
||||
sudo systemctl status taskd.service
|
||||
```
|
||||
|
||||
# Startup
|
||||
|
||||
> sudo systemd-analyze
|
||||
```bash
|
||||
sudo systemd-analyze
|
||||
```
|
||||
|
||||
> sudo systemd-analyze blame
|
||||
```bash
|
||||
sudo systemd-analyze blame
|
||||
```
|
||||
|
||||
|
@@ -4,7 +4,9 @@ tags: [ "Documentation", "System" ]
|
||||
---
|
||||
Start with:
|
||||
|
||||
> tmux
|
||||
```bash
|
||||
tmux
|
||||
```
|
||||
|
||||
Input a command with C-b
|
||||
|
||||
@@ -32,15 +34,23 @@ In addition to Windows, there are panes.
|
||||
|
||||
Crate a new session with the name 'backup'.
|
||||
|
||||
> tmux new -s backup
|
||||
```bash
|
||||
tmux new -s backup
|
||||
```
|
||||
|
||||
List sessions:
|
||||
|
||||
> tmux list-sessions
|
||||
```bash
|
||||
tmux list-sessions
|
||||
```
|
||||
|
||||
> tmux kill-session -t 2
|
||||
```bash
|
||||
tmux kill-session -t 2
|
||||
```
|
||||
|
||||
> tmux attach -t backup
|
||||
```bash
|
||||
tmux attach -t backup
|
||||
```
|
||||
|
||||
|
||||
# Control
|
||||
|
@@ -1,5 +0,0 @@
|
||||
---
|
||||
title: "urxvt"
|
||||
tags: [ "Documentation", "System" ]
|
||||
---
|
||||
Perl scripts typically kept in /usr/lib/urxvt/perl
|
@@ -6,11 +6,15 @@ https://linuxconfig.org/vnc-server-on-ubuntu-18-04-bionic-beaver-linux
|
||||
|
||||
Enable remote desktop access.
|
||||
|
||||
> sudo apt install vnc4server xfce4 xfce4-goodies
|
||||
```bash
|
||||
sudo apt install vnc4server xfce4 xfce4-goodies
|
||||
```
|
||||
|
||||
Disable the vncserver desktop:
|
||||
|
||||
> vncserver -kill :1
|
||||
```bash
|
||||
vncserver -kill :1
|
||||
```
|
||||
|
||||
Replace the config in ~/.vnc/xstartup with:
|
||||
|
||||
@@ -22,43 +26,49 @@ Replace the config in ~/.vnc/xstartup with:
|
||||
|
||||
Install tigervnc, then run it to set a password:
|
||||
|
||||
> vncserver
|
||||
```bash
|
||||
vncserver
|
||||
```
|
||||
|
||||
You'll get a session number.
|
||||
|
||||
Shut it down with the 'kill' command and the session's number:
|
||||
|
||||
> vncserver -kill :1
|
||||
```bash
|
||||
vncserver -kill :1
|
||||
```
|
||||
|
||||
This will forward over port 5900+x where x is the session number. For the first server, that's port 5901.
|
||||
|
||||
# Create a systemd service
|
||||
|
||||
> sudo vim /etc/systemd/system/vncserver@:1.service
|
||||
```bash
|
||||
sudo vim /etc/systemd/system/vncserver@:1.service
|
||||
```
|
||||
|
||||
Then enter:
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=Remote desktop service (VNC)
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=foo
|
||||
PAMName=login
|
||||
PIDFile=/home/%u/.vnc/%H%i.pid
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
|
||||
ExecStart=/usr/bin/vncserver %i -geometry 1440x900 -alwaysshared -fg
|
||||
ExecStop=/usr/bin/vncserver -kill %i
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
> [Unit]
|
||||
> Description=Remote desktop service (VNC)
|
||||
> After=syslog.target network.target
|
||||
>
|
||||
> [Service]
|
||||
> Type=simple
|
||||
> User=foo
|
||||
> PAMName=login
|
||||
> PIDFile=/home/%u/.vnc/%H%i.pid
|
||||
> ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
|
||||
> ExecStart=/usr/bin/vncserver %i -geometry 1440x900 -alwaysshared -fg
|
||||
> ExecStop=/usr/bin/vncserver -kill %i
|
||||
>
|
||||
> [Install]
|
||||
> WantedBy=multi-user.target
|
||||
|
||||
Then enable that service:
|
||||
|
||||
> sudo systemctl start vncserver@:1.service
|
||||
```bash
|
||||
sudo systemctl start vncserver@:1.service
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user