[root@test]# cat input a,b,c,d [root@test]# cat input | sed 's/','/\n/g' a b c d [root@test]# cat input | awk '$1=$1' RS=, OFS="\n" a b c d [root@test]# cat input | tr -s ',' '\n' a b c d
Enjoy π
[root@test]# cat input a,b,c,d [root@test]# cat input | sed 's/','/\n/g' a b c d [root@test]# cat input | awk '$1=$1' RS=, OFS="\n" a b c d [root@test]# cat input | tr -s ',' '\n' a b c d
Enjoy π
Go to the link : http://www.oracle.com/technetwork/java/javase/downloads/
Accept the license agreement and Download the tar.gz file (eg: jdk -8u65-linux-i586.tar.gz)
Extract the file using the command tar -xzvf jdk-8u65-linux-i586.tar.gz
Copy the extracted directory (In my case jdk1.8.0_65) to the required location say /scratch
alternatives –install /usr/bin/java java /scratch/jdk1.8.0_65/bin/java 20000
alternatives –config java
You can see the list of available java versions and select our installed one by typing the number corresponding to that one.
By default /etc/rc.local
and /etc/rc.d/rc.local
are no longer executable in CentOS7 with the new systemd-changes. Follow the below steps to make the script /root/g.sh run at boot time:
1. chmod +x /etc/rc.d/rc.local 2. chmod +x /root/g.sh 2. Mention your script at the bottom of the file /etc/rc.local (/etc/rc.local is a symlink to /etc/rc.d/rc.local)as below : sh /root/g.sh
Restart and check π
While booting up your machine, select the existing kernel and press ‘e’
Replace the entry ‘ro‘ with ‘rw init=/sysroot/bin/sh’
changed to
Press ctrl+x to save and start single user mode using the bash shell we mentioned above.
Run the below command and change password after that:
chroot /sysroot
passwd
Update selinux parameters as below :
touch /.autorelabel
Now reboot your machine. It may take some time to apply the apply the changes while booting up.
Thanks π
1. Install the package : facter
In centOS : yum install facter
In ubuntu : apt-get install facter
2. Run the command :
facter virtual
3. Check the output.
for example :
[root@test1 ~]# facter virtual vmware
root@test2:~# facter virtual physical
Thanks π
To change the color of the terminal :
tput setaf number
Use the below numbers for the corresponding color.
Black : 0
Red : 1
Green : 2
Yellow : 3
blue : 4
Magenta : 5
Cyan : 6
White : 7
Eg : For Green(my fav :)),
tput setaf 2
Enjoy π
1. First create a p12 file and import both the certificate and key into it using openssl.
openssl pkcs12 -export -name theg -in /etc/ssl/certs/theg.crt -inkey /etc/ssl/private/theg.key -out theg.p12
2.Convert the p12 format into jks format using keytool :
keytool -importkeystore -destkeystore theg.jks -srckeystore theg.p12 -srcstoretype pkcs12 -alias theg
Note : Here I used the name theg for my certificates and alias, change it accordingly.
I got the below error while restarting mysql service after updating the my.cnf file :
[ERROR] Plugin βInnoDBβ init function returned error. [ERROR] Plugin βInnoDBβ registration as a STORAGE ENGINE failed. [ERROR] Unknown/unsupported storage engine: INNODB [ERROR] Aborting
Just followed the below steps to resolve the issue :
cd /var/lib/mysql mv ibdata1 ib_logfile0 ib_logfile1 /tmp/
Note that my datadir was /var/lib/mysql. Change the location accordingly.
service mysqld restart
[root@theg-01 mysql]# service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
Thats it π
In cPanel, there is an option to lock the folders with a password. In normal case, it wont work with WordPress. In my case, below steps worked fine.
1. Add password authentication for the folder with wordpress files from cPanel
2. Create the user and password
3. Add following lines to the .htaccess file in the wordpress root directory
ErrorDocument 401 ./error.html ErrorDocument 403 ./error.html
4. Final .htaccess will look as below:
#next two lines allow password protected directories with 404 errors ErrorDocument 401 ./error.html ErrorDocument 403 ./error.html # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /dev/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /dev/index.php [L] </IfModule> # END WordPress #-- Following lines are added for password authentication in the site AuthUserFile "/home/user_name/.htpasswds/public_html/sub_domain/passwd" AuthName "dev" AuthType Basic require valid-user
Enjoy π
Follow the below steps to rename a host in BackupPC.
1. Stop BackupPC service :
service backuppc stop
2. Login to the configuration folder
cd /etc/BackupPC
2. Change the host file to the corresponding one :
vi hosts
*change old_host to new_host*
3. Rename the pl file in pc folder :
cd pc
mv old_host.pl new_host.pl
4. Make the changes in the backup location (I assume your backup is storing in the location /backup):
cd /backup/filesystem/pc/
mv old_host new_host
5.Start Backuppc service:
service backuppc start
6. Login to the backuppc console and make sure that the changes are replicated there.
Enjoy π