diff options
author | Christian Cleberg <hello@cmc.pub> | 2025-03-19 00:08:06 -0500 |
---|---|---|
committer | Christian Cleberg <hello@cmc.pub> | 2025-03-19 00:08:06 -0500 |
commit | eec1a17cdde9a41d2cfa1d102e685534ff592be3 (patch) | |
tree | 50d8d5632e3ce42be2c48f4860bb424d601aa0f0 /content | |
parent | 0cd4db2804c5f9df601e3518f009de83641acbd3 (diff) | |
download | cleberg.net-eec1a17cdde9a41d2cfa1d102e685534ff592be3.tar.gz cleberg.net-eec1a17cdde9a41d2cfa1d102e685534ff592be3.tar.bz2 cleberg.net-eec1a17cdde9a41d2cfa1d102e685534ff592be3.zip |
add shell wiki post
Diffstat (limited to 'content')
-rw-r--r-- | content/wiki/sh.org | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/content/wiki/sh.org b/content/wiki/sh.org new file mode 100644 index 0000000..7399898 --- /dev/null +++ b/content/wiki/sh.org @@ -0,0 +1,48 @@ +#+title: sh + +* File Loop + +#+begin_sh shell +# All files in current directory +for file in *; do echo "${file}"; done + +# Files only +for file in *; do if [ -f "$file" ]; then echo "$file"; fi; done + +# Directories only +for file in *; do if [ -d "$file" ]; then echo "$file"; fi; done +#+end_src + +* Exifdata + +#+begin_src shell +sudo exiftool -r -all= -ext jpg -ext png . +#+end_src + +* Optipng + +#+begin_src shell +optipng -o7 image.png +#+end_src + +* Nginx + Goaccess + +#+begin_src shell +zcat /var/log/nginx/access.log.*.gz | goaccess /var/log/nginx/access.log - +#+end_src + +* Distro Information + +#+begin_src shell +echo /etc/*_ver* /etc/*-rel*; cat /etc/*_ver* /etc/*-rel* +#+end_src + +* sed + +#+begin_src shell +# Replace text within file +sed -i '' 's/SEARCH_TEXT/REPLACEMENT_TEXT/g' file.txt + +# Delete empty lines +sed '/^\s*$/d' +#+end_src |