18 lines
1,021 B
Org Mode
18 lines
1,021 B
Org Mode
#+TITLE: Erwin's NixOS config
|
|
|
|
This configures my machines.
|
|
|
|
* Useful oneliners
|
|
** Remove all files except the smallest
|
|
|
|
#+begin_example
|
|
$ ls -s size | head -n 1 | xargs stat -c %s | awk '{print $1 + 1}' | xargs -I '%S' fd -S +%Sb -X rm {} \;
|
|
#+end_example
|
|
|
|
| cmd | Explanation |
|
|
|--------------------------------------+-----------------------------------------------------------------|
|
|
| =ls -s size= | List all files, sort by size (=ls= is aliased to =eza= in my setup) |
|
|
| =head -n 1= | Take the first line |
|
|
| =xargs stat -c %s= | Print the size in bytes |
|
|
| =awk '{print $1 + 1}= | Add one to it |
|
|
| =xargs -I '%S' fd -S +%Sb -X rm {} \;= | Find all files larger than the smallest and delete them |
|