cat a
a
b
c
d
e
cat b
c
d
View grep.md
View cert.md
openssl x509 -noout -modulus -in server.crt| openssl md5
openssl rsa -noout -modulus -in server.key| openssl md5
# really cool feature of openssl
openssl s_server -cert server.crt -key server.key
# if the keys don't match you will get an error message
View tr.md
string_with_newlines='a
b
c'
echo $string_with_newlines |tr -s '\n' ' '
a b c
View sort.md
Sorting cmd output by column with the sort command
Some commands come with their own sorting functionality. Anyhow it's an useful flag to have in your repertoire
So let's say we want to sort by VSZ and we have this output.
[azureuser@alma ~]$ ps aux |head -5
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 1.5 0.1 175056 13480 ? Ss 19:24 0:01 /usr/lib/systemd/systemd --switched-root --system --deserialize 16
root 2 0.0 0.0 0 0 ? S 19:24 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I< 19:24 0:00 [rcu_gp]
View man_pages_grep.md
To look through all man pages for a string there are two options
- loop through the manpages files with find, xargs and zgrep:
find $(manpath|tr ':' ' ') -type f -print0 | xargs -0 zgrep -i '\.config/systemd'
- simply use man -K notice the capital K:
man -K '.config/systemd'
View simple yaml .vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ts=2 sw=2 sts=2 | |
set et | |
set nu ru | |
set ai si | |
set hlsearch | |
syntax on | |
filetype plugin indent on |
View Useful commands for EX374.md
Creates an example ansible-navigator.yml config:
ansible-navigator settings --sample > ansible-navigator.yml
View variables.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# define var in script | |
GREETING="Welcome" | |
echo GREETING | |
echo $GREETING | |
# pass var as arg | |
echo "you have typed $1 as the first argument" | |
echo "these are all arguments: $@" |