Check These Out
Appends the input file with the date format YYYY-MM-DD.bak. Also runs silently if you remove the -v on the cp at the end of the function.
Here's an annotated version of the command, using full-names instead of aliases. It is exactly equivalent to the short-hand version.
# Recursively list all the files in the current directory.
Get-ChildItem -Recurse |
# Filter out the sub-directories themselves.
Where-Object { return -not $_.PsIsContainer; } |
# Group the resulting files by their extensions.
Group-Object Extension |
# Pluck the Name and Count properties of each group and define
# a custom expression that calculates the average of the sizes
# of the files in that group.
# The back-tick is a line-continuation character.
Select-Object `
Name,
Count,
@{
Name = 'Average';
Expression = {
# Average the Length (sizes) of the files in the current group.
return ($_.Group | Measure-Object -Average Length).Average;
}
} |
# Format the results in a tabular view, automatically adjusted to
# widths of the values in the columns.
Format-Table -AutoSize `
@{
# Rename the Name property to something more sensible.
Name = 'Extension';
Expression = { return $_.Name; }
},
Count,
@{
# Format the Average property to display KB instead of bytes
# and use a formatting string to show it rounded to two decimals.
Name = 'Average Size (KB)';
# The "1KB" is a built-in constant which is equal to 1024.
Expression = { return $_.Average / 1KB };
FormatString = '{0:N2}'
}
A text file contains thousands of numbers. This command prints lines were the number is greater or equal than a specified value (134000000).
better with accounts on ldap
-Qdt Lists dependencies/packages which are no longer required by any packages
-q Output only package name (not the version number)
-R Remove package(s)
Rest is self-explanatory.
I just started out with Arch - so if there is any better/standard method to achieve the same - please suggest.
Benchmark a SQL query against MySQL Server.
The example runs the query 10 times, and you get the average runtime in the output. To ensure that the query does not get cached, use `RESET QUERY CACHE;` on top in the query file.
With no '-q 0' switch, nc simply waits, and whatever awaits the data hangs.