Check These Out
http://linuxhelp.blogspot.com/2005/11/make-your-files-immutable-which-even.html
I wanted an easy way to list out the sizes of directories and all of the contents of those directories recursively.
Very entertaining when run on someone elses machine remotely ;)
On Mageia (and Mandriva) Linux, this command will clear your existing urpmi configuration and configure it to use only network sources. It can be useful after you have installed from CD/DVD and
don't want to continually be prompted to insert CD/DVD each time you install a package.
acknowledgement: blino
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
Another way of doing it that's a bit clearer. I'm a fan of readable code.
syntax follows regular command line expression.
example: let's say you have a directory (with subdirs) that has say 4000 .php files.
All of these files were made via script, but uh-oh, there was a typo!
if the typo is "let's go jome!" but you meant it to say "let's go home!"
find . -name "*.php" | xargs perl -pi -e "s/let\'s\ go\ jome\!/let\'s\ go\ home\!/g"
all better :)
multiline: find . -name "*.php" | xargs perl -p0777i -e 's/knownline1\nknownline2/replaced/m'
indescriminate line replace: find ./ -name '*.php' | xargs perl -pi -e 's/\".*$\"/\new\ line\ content/g'
Create a persistent SSH connection to the host in the background. Combine this with settings in your ~/.ssh/config:
Host host
ControlPath ~/.ssh/master-%r@%h:%p
ControlMaster no
All the SSH connections to the machine will then go through the persisten SSH socket. This is very useful if you are using SSH to synchronize files (using rsync/sftp/cvs/svn) on a regular basis because it won't create a new socket each time to open an ssh connection.
Based on capsule8 agent examples, not rigorously tested
This is based on __unixmonkey73469__ answer. You will need to supply `--multiline 1` option to JSON importer if your .json is multiline (i.e. it was prettyfied)
And you still need catmandu installed via `cpanm Catmandu`