2022-06-28 18:39:45 +02:00
|
|
|
---
|
2022-07-07 08:32:34 +02:00
|
|
|
title: 'Useful Commands'
|
2022-11-19 15:25:20 +01:00
|
|
|
visible: true
|
2022-06-28 18:39:45 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
[toc]
|
|
|
|
## Imagemagick
|
|
|
|
### Splitting PDF files
|
|
|
|
`$ convert -density 600 (input.pdf) -crop 50x100% +repage (out.pdf)`
|
|
|
|
|
|
|
|
```
|
|
|
|
-density: adjusts the quality of the resulting pdf. Higher values look better, but take longer to process
|
|
|
|
-crop 50x100%: this splits the pdf into "left" and "right". 100x50% would split into "top" and "bottom"
|
2022-07-07 08:35:48 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Find
|
|
|
|
### Change filtered permissions
|
|
|
|
Using find with its `exec` switch one can set different permissions based on the usual find filters.
|
|
|
|
One example would be only changing file or directory permissions.
|
|
|
|
`$ find (directory) -type f -exec chmod 744 {} +`
|
|
|
|
Replacing `-type f` with `-type d` would execute the `chmod` for directories instead.
|
2022-10-18 20:43:26 +02:00
|
|
|
|
|
|
|
## Various
|
|
|
|
### Overwrite disk with pseudorandom data
|
|
|
|
Using openssl on CPUs with AES acceleration one can create pseudorandom data with high speeds.
|
|
|
|
Much faster than `/dev/urandom` at least
|
|
|
|
`# openssl enc -aes-128-ctr -md sha512 -pbkdf2 -nosalt -pass file:/dev/urandom < /dev/zero | pv > (target disk)`
|
|
|
|
Around 2GiB/s on my Ryzen 7 1700x if output to `/dev/null`
|
|
|
|
|
2022-10-23 20:44:13 +02:00
|
|
|
### Formatted csv in terminal
|
2022-10-23 20:51:00 +02:00
|
|
|
> [From Pretty CSV viewing on the Command Line](https://www.stefaanlippens.net/pretty-csv.html)
|
|
|
|
|
2022-10-23 20:44:13 +02:00
|
|
|
`$ column -t -s, < (file.csv)`
|