Check These Out
List all commands present on system by folder.
$PATH contains all command folder separated by ':'. With ${PATH//:/ }, we change ':' in space and create a list of folder for ls command.
This is useful for example if you are on ssh in a server and the server goes down without letting you out.
This is part of a larget sets of escape sequences provided by ssh. You can find them with ~? Here's the list:
~. - terminate connection (and any multiplexed sessions)
~B - send a BREAK to the remote system
~C - open a command line
~R - request rekey
~V/v - decrease/increase verbosity (LogLevel)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
Control (stop, start, restart) a Windows Service from a Linux machine which has the `net` command (provided by samba).
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
This is to pull all the saved S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) information from a hard drive.
This can give you an idea of the nature and extent of an issue on a failing hard drive.
I use this as an alias:
alias authplain "printf '\!:1\0\!:1\0\!:2' | mmencode | tr -d '\n' | sed 's/^/AUTH PLAIN /'"
then..
# authplain someuser@somedomain.com secretpassword
AUTH PLAIN c29tZXVzZXJAc29tZWRvbWFpbi5jb20Ac29tZXVzZXJAc29tZWRvbWFpbi5jb20Ac2VjcmV0cGFzc3dvcmQ=
#
The $(!!) will expand to the previous command output (by re-running the command), which becomes the parameter of the new command newcommand.
We use `-not -name ".*"` for the reason we must omit hidden files (which unnecessary). We can only show up total lines like this:
$ find * -type f -not -name ".*" | xargs wc -l | tail -1