Archives
date
1 | date --date="STRING" date --date="next Friday" date -d "2 days ago" date --date="yesterday" date --date="yesterday" +"%format" # Get yesterday's date in dd-mm-yy format date --date="yesterday" +"%d-%m-%y" date -d "yesterday" +"%m-%d-%y" # US date format date --date="yesterday" +"%Y-%m-%d" # YYYY-mm-dd format ## store y'day date in a shell variable called yday and display it ## yday=$(date --date="yesterday" +"%Y-%m-%d") echo "$yday" date -d 'now -20 hours' |
read timestamp
1 | date -d @1674634504 mercredi 25 janvier 2023, 09:15:04 (UTC+0100) |
Keystore
Java Keytool Commands for Creating and Importing
These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. Any root or intermediate certificates will need to be imported before importing the primary certificate for your domain.
Generate a Java keystore and key pair1
keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048
Generate a certificate signing request (CSR) for an existing Java keystore1
keytool -certreq -alias mydomain -keystore keystore.jks -file mydomain.csr
Import a root or intermediate CA certificate to an existing Java keystore1
keytool -import -trustcacerts -alias root -file Thawte.crt -keystore keystore.jks
Import a signed primary certificate to an existing Java keystore1
keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks
Generate a keystore and self-signed certificate (see How to Create a Self Signed Certificate using Java Keytoolfor more info)1
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
Java Keytool Commands for Checking
If you need to check the information within a certificate, or Java keystore, use these commands.
Check a stand-alone certificate1
keytool -printcert -v -file mydomain.crt
Check which certificates are in a Java keystore1
keytool -list -v -keystore keystore.jks
Check a particular keystore entry using an alias1
keytool -list -v -keystore keystore.jks -alias mydomain
Other Java Keytool Commands
Delete a certificate from a Java Keytool keystore1
keytool -delete -alias mydomain -keystore keystore.jks
Change a Java keystore password1
keytool -storepasswd -new new_storepass -keystore keystore.jks
Export a certificate from a keystore1
keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks
List Trusted CA Certs1
keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts
Import New CA into Trusted Certs1
keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts
COUCHDB
Healthcheck1
# curl -s http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984/_up | jq
List all databases1
# curl -s http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984/_all_dbs | jq
Database info1
# curl -s http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984/<db> | jq
List all docs from a database1
# curl -s http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984/<db>/_all_docs | jq
Info from a doc1
# curl -s http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984/<db>/<id_doc> | jq
Restart1
# curl -s -X POST -H"Content-Type: application/json" -u $COUCHDB_USER:$COUCHDB_PASSWORD localhost:5984/_node/couchdb@<node_name>/_restart
List member of a cluster1
# curl -s http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984/_membership | jq
add member1
# curl -s -u $COUCHDB_USER:$COUCHDB_PASSWORD -X PUT "http://localhost:5986/_nodes/couchdb@<node_name>" -d {}
get rev1
# curl -s -u $COUCHDB_USER:$COUCHDB_PASSWORD "http://localhost:5986/_nodes/couchdb@<node_name>"
del member1
# curl -s -u $COUCHDB_USER:$COUCHDB_PASSWORD -X DELETE "http://localhost:5986/_nodes/couchdb@<node_name>?rev=1-967a00dff5e02add41820138abb3284d"
set/unset maintenance mode1
# curl -s -u $COUCHDB_USER:$COUCHDB_PASSWORD -X PUT -H "Content-type: application/json" localhost:5984/_node/couchdb@<node_name>/_config/couchdb/maintenance_mode -d "\"false\""
Show config1
# curl -s -u $COUCHDB_USER:$COUCHDB_PASSWORD -X GET -H "Content-type: application/json" localhost:5984/_node/couchdb@<node_name>/_config/couchdb
# curl -s -u $COUCHDB_USER:$COUCHDB_PASSWORD -X GET -H "Content-type: application/json" localhost:5984/_node/couchdb@<node_name>/_config
Force db syn1
# curl -s -X POST -H"Content-Type: application/json" -u $COUCHDB_USER:$COUCHDB_PASSWORD localhost:5984/<db>/_sync_shards
ip
show ip
1
ip -4 addr show ip -4 -o addr show
set up ip
1
ip addr add 192.168.50.2/24 dev ens160
unset ip
1
ip addr del 192.168.1.5/24 dev eth0
link up
1
ip link set eth0 up
link down
1
ip link set eth0 down
add default gw
1
ip route add default via 192.168.1.1
add gw
1
ip route add 10.0.0.0/8 dev eth0