Clean up boot partition - Ubuntu
1. Check the current kernel version
$ uname -r
It will shows the list like below:
3.19.0-64-generic
2. Remove the OLD kernels
2.a. List the old kernel
$ sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r`
You will get the list of images something like below:
linux-image-3.19.0-59-generic
linux-image-3.19.0-61-generic
linux-image-3.19.0-65-generic
linux-image-extra-3.19.0-58-generic
linux-image-extra-3.19.0-59-generic
linux-image-extra-3.19.0-61-generic
2.b. Now its time to remove old kernel one by one as
$ sudo apt-get purge linux-image-3.19.0-58-generic
$ sudo apt-get purge linux-image-3.19.0-59-generic
$ sudo apt-get purge linux-image-3.19.0-61-generic
$ sudo apt-get purge linux-image-3.19.0-65-generic
When you're done removing the older kernels, you can run this to remove ever packages you won't need anymore:
$ sudo apt-get autoremove
Windows Time Service (w32time) Synchronization
View time source
w32tm /query /computer:[IP] /source
Change time peers
w32tm /config /manualpeerlist:[server],0x8 /syncfromflags:MANUAL
The actual IP address of the NTP server or its host name must be entered instead of [server].
The flag "0x8" forces w32time not to send "symmetric active" packets but normal "client" requests which the NTP server replies to as usual.
Then the following command can be used to immediately make the changes effective:
w32tm /config /update
If this command has completed successfully your system clock has synchronized to the given NTP server. To check it open a Date and Time window (click "time" icon in the lower right corner of the desktop) -> Change date and time settings -> Internet Time.
Alternatively, the w32time service can be restarted:
net stop w32time && net start w32time
If the w32time service is restarted it sends immediately a request to the NTP server. Additionally, the command:
w32tm /resync
can be used to let w32time send a request.
To configure a client computer or a member server to sync time from the domain, run the following command:
w32tm /config /syncfromflags:domhier /update
And then stop and restart the time service by running:
net stop w32time && net start w32time
Setting Timezone
prompt:
tzutil /l - list Timezones
tzutil /s "TIMEZONE"
tzutil /s "SA Western Standard Time"
tzutil /s "SA Western Standard Time_dstoff" (suffix _dstoff to DISABLE DAYLIGHT SAVING)
PowerShell:
Set-TimeZone -Name "TIMEZONE"
Set-TimeZone -Name "SA Western Standard Time"
Protect files and folders
Install safe-rm
sudo apt-get install safe-rm
Edit the conf file adding the folders path
pico /etc/safe-rm.conf
PHP CSV to Table
<?php
echo "<html><body><table>\n\n";
$f = fopen("so-csv.csv", "r");
while (($line = fgetcsv($f)) !== false) {
echo "<tr>";
foreach ($line as $cell) {
echo "<td>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>\n";
}
fclose($f);
echo "\n</table></body></html>";
?>
AWK get text between two patterns
awk '/BEGIN/,/END/' info.txt
***** BEGIN ***** BASH is awesome BASH is awesome ***** END *****
Fix Bug Phpmyadmin [sql.lib.php] + Php7.2 + Ubuntu 18.04
Edit file:
/usr/share/phpmyadmin/libraries/sql.lib.php
Change this (line #613):
|| (count($analyzed_sql_results[‘select_expr’] == 1)
there's a missing close bracket ‘)’ before operation with 1. So i changed it to:
|| ((count($analyzed_sql_results[‘select_expr’]) == 1)
/usr/share/phpmyadmin/libraries/sql.lib.php
Change this (line #613):
|| (count($analyzed_sql_results[‘select_expr’] == 1)
there's a missing close bracket ‘)’ before operation with 1. So i changed it to:
|| ((count($analyzed_sql_results[‘select_expr’]) == 1)
Ubuntu 18.04 change hostname
1. Change the hostname using hostnamectl.
In Ubuntu 18.04 we can change the system hostname and related settings using the command hostnamectl.
For example is we want to change the system static hostname to linuxize, we can use the following command:
sudo hostnamectl set-hostname linuxize
2. Edit the /etc/hosts file.Open the /etc/hosts file and change the old hostname to the new one.
127.0.0.1 localhost
127.0.0.1 linuxize
3. Edit the cloud.cfg file.
If the cloud-init package is installed you also need to edit the cloud.cfg file. This package is usually installed by default in the images provided by the cloud providers such as AWS and it is used to handle the initialization of the cloud instances.
To check if the package is installed run the following ls command:
ls -l /etc/cloud/cloud.cfg
In this case you’ll need to open the /etc/cloud/cloud.cfg file:
sudo nano /etc/cloud/cloud.cfg
Search for preserve_hostname and change the value from false to true:
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true
Assinar:
Postagens (Atom)
View expiration date of DNSSEC signature
dig SOA yourdomain.com @nameserver +dnssec
Mais vistos
-
Java Keytool Command These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. A...
-
Kaspersky seems to be storing windows update files on the C Drive: Here -> C:\ProgramData\KasperskyLab\adminkit\1093\.working Change fo...
-
A few cmds to help with the DFS troubleshooting aspects, keep in mind all should be run from an elevated PowerShell Dfsdiag /TestDCs D...