Show git branch in terminal

show git branch in terminal

When working with git, to avoid accidental commit to wrong branch, it will be better if terminal show the branch name you are currently in. To display “git branch” in terminal, edit .bashrc vi ~/.bashrc Add following code to end of the file. # Show git branch in command promt if git repo show_git_branch() { … Read more

Disable SELinux on CentOS/RHEL

To disable SELinux Method 1 sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config setenforce 0 Method 2 edit file vi /etc/selinux/config Find SELINUX=enforcing Replace with SELINUX=disabled Reboot the server with reboot You can disable selinux for current session by running command setenforce 0 See SELinux

Show Hidden Files

For linux to show hidden files when you type ls command Edit ~/.bashrc vi /root/.bashrc Add line alias ls=’ls -la –color’ Save and exit. Now you need to re login to SSH to see the hidden files when you type “ls” After editing the file will look like [root@194 ~]# cat /root/.bashrc # .bashrc # … Read more

curl using cookie

Here is some example of using curl to login to site, use cookie to do further requests. curl -k –cookie-jar ./cookies_hotfile –data “returnto=%2F&user=USERNAME_HERE&pass=PASSWORD_HERE” http://site.com/login.php curl -L -O –cookie ./cookies_hotfile http://site.com/dl/5222/4444/file.zip.html See curl

chown

chown command is ued to change ownership of a file or folder In this example ownership of folder public_html to username and group specified. chown -R username:group public_html -R used for recursively change ownership, that is all files and folders inside the folder also get the new ownership. See Linux Commands

at

yum install at Enable atd [root@server12 ~]# service atd status atd is stopped [root@server12 ~]# chkconfig –list | grep atd atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off [root@server12 ~]# service atd start Starting atd: [ OK ] [root@server12 ~]# Setting Job [root@server12 ~]# echo “/sbin/shutdown -h now” | at 21:15 16.02.2017 job 1 at … Read more

Install PowerDNS on Ubuntu 20.04

PowerDNS is an OpenSource DNS server. Update apt repo apt-get update && apt-get upgrade -y On Ubuntu, systemd-resolved listen to port 53. This is a local DNS resolver, we need to stop this service before we can install PowerDNS. systemctl disable systemd-resolved systemctl stop systemd-resolved rm -f /etc/resolv.conf echo “nameserver 1.1.1.1” > /etc/resolv.conf echo “nameserver … Read more