Check These Out
Tells sort to ignore all characters before the Xth position in the first field per line. If you have a list of items one per line and want to ignore the first two characters for sorting purposes, you would type "sort -k1.3". Change the "1" to change the field being sorted. The decimal value is the offset in the specified field to sort by.
..not guaranteed to always be accurate but fun to see how old you Linux installation is based on the root partitions file system creation date.
Usage:
$ mydir=/very/long/path/to/a/dir
$ cd mydir
I often need to cd where no man wants to go (i.e. long path). by enabling the shell option cdable_vars, I can tell cd to assume the destination is the name of a variable.
If your customer deletes a file that is still in use by a process, that space does not get freed up (will not show up in df) until that process either closes the file on its own, or is killed.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
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
you will be sad after you run a command and find out it needs root, so you should run it again but with prefix sudo.
so this line is to make it simple. just 'sudo !!'
And then to complete the task:
Go to target host;
$ssh host
Turn everything off:
$for i in `chkconfig --list | fgrep :on | awk '{print $1}'` ; do chkconfig --level 12345 $i off; done
Create duplicate config:
$while read line; do chkconfig --level $line on; done < foo
I removed the dependency of the English language