Check These Out
What happens here is we tell tar to create "-c" an archive of all files in current dir "." (recursively) and output the data to stdout "-f -". Next we specify the size "-s" to pv of all files in current dir. The "du -sb . | awk ?{print $1}?" returns number of bytes in current dir, and it gets fed as "-s" parameter to pv. Next we gzip the whole content and output the result to out.tgz file. This way "pv" knows how much data is still left to be processed and shows us that it will take yet another 4 mins 49 secs to finish.
Credit: Peteris Krumins http://www.catonmat.net/blog/unix-utilities-pipe-viewer/
Install using yum install yum-utils
Options include:
--oldkernels Remove old kernel and kernel-devel packages
--count=KERNELCOUNT Number of kernel packages to keep on the system (default 2)
use package-cleanup --help for a complete list
Recursively find disk usage, sort, and make human readable:
* For systems without human-readable sort command
* awk, not perl
The --parents option will cause cp or mkdir to automatically create the parent directory structure.
$mkdir --parents /one/two/three/dir
will create /one, /one/two, and /one/two/three as needed before creating dir. cp will copy files with their full directory structure into the target directory with this option.
Thanks to Peter Leung at:
http://linuxcommando.blogspot.com/2007/11/use-of-parents-flag-in-mkdir-and-c.html
which has good examples of usage.
This lets you replace a file or directory and quickly revert if something goes wrong. For example, the current version of a website's files are in public_html. Put a new version of the site in public_html~ and execute the command. The names are swapped. If anything goes wrong, execute it again (up arrow or !!).
this is helpful because dmesg is where i/o errors, etc are logged to... you will also be able to see when the system reboots or someone attaches a thumb drive, etc.
don't forget to set yourself up in /etc/aliases to get roots email.
if you want to move with command mv large list of files than you would get following error
/bin/mv: Argument list too long
alternavite with exec:
find /source/directory -mindepth 1 -maxdepth 1 -name '*' -exec mv {} /target/directory \;
This is the THIRD in a set of five commands. See my other commands for the previous two.
This step creates the oauth 1.0 token as explained in http://oauth.net/core/1.0/
The token is required for a Twitter filtered stream feed (and almost all Twitter API calls)
This token is simply an encrypted version of your base string. The encryption key used is your hmac.
The last part of the command scans the Base64 token string for '+', '/', and '=' characters and converts them to percentage-hex escape codes. (URI-escapeing). This is also a good example of where the $() syntax of Bash command substitution fails, while the backtick form ` works - the right parenthesis in the case statement causes a syntax error if you try to use the $() syntax here.
See my previous two commands step1 and step2 to see how the base string variable $b and hmac variable $hmac are generated.
I just added the args [arp-scan --localnet] which works for Debian users, because the package 'arp' has name 'arp-scan', and it doesn't works with the argument 'arp'.