Check These Out
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
Remove security from PDF document using this very simple command on Linux and OSX. You need ghostscript for this baby to work.
Add permanent line numbers to a file without creating a temp file.
The rm command deletes file10 while the nl command works on the open file descriptor of file10 which it outputs into a new file again named file10.
The new file10 will now be numbered in the same directory with the same file name and content as before, but it will in fact be a new file, using (ls -i) to show its inode number will prove this.
Line can be modified as needed. This considers weekdays to be Mon-Fri. If run any working day it'll provide a parameters for the next working day for "at".
"beep" provided as a sample command.
This can be modified easily to include wait time. If you need something to run "D" days after today:
# D=4;if [ $(date +%u --date="${D} days") -lt 5 ];then AT="+${D} days";else AT="next monday";fi; echo "beep" | at noon ${AT}
rsync'ing an empty directory over a directory to be deleted recursively is much faster than using rm -rf, for various reasons. Relevant only for directories with really a lot of files.
You could do the following, however, brace expansion with {} is not defined in POSIX, and therefore not guaranteed to work in all shells. But, if it does, it's more convenient (although it's certainly not less typing):
$ cp -r {*,.??*} /dest
Sometimes there are times when I need to cp(1), mv(1) or rm(1) files recursively, but don't want to traverse the previous directory by following ../../../../ etc out of the current directory. This command prevents that. The secret sauce is ".??*". The file globbing ensures that it must start with a dot, and be followed by at least two characters. So, three characters must exist in the filename, which eliminates "." and "..".
Shows all block devices in a tree with descruptions of what they are.
Handy if you want to quickly generate a self-signed certificate. Also can be used in your automated scripts for generating quick-use certificates.