Thursday, July 31, 2014

Back up (dump) all databases in a server in seprate .sql files


#!/bin/bash
echo "show databases;" | mysql -u root --password='YOURSECUREPASSWORD' | while read databasename
do
    echo dumping $databasename
    mysqldump -u root --password='YOURSECUREPASSWORD' "$databasename" >"$databasename.sql"
done

Wednesday, July 30, 2014

Tuesday, July 29, 2014

Fix vagrant error "sudo: sorry, you must have a tty to run sudo"

if you try to spin off a CentOs or Oracle Linux using Vagrant in AWS you will get the following error :

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p '/vagrant'
Stderr from the command:
sudo: sorry, you must have a tty to run sudo
The fix is adding the "config.ssh.pty= true" to your Vagrantfile so it will look like something like this :

        config.vm.provider :aws do |aws,override|
                  # blah blah
                  config.ssh.pty= true
        end

Installing Java JDK 7 on Oracle Linux 5.5

Download the rpm

wget https://PATH TO THE RPM

rpm -ivh jdk-7u65-linux-x64.rpm

java -version

 /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_65/bin/java 17065

java -version


Changing the active jdk version

/usr/sbin/alternatives --config java

Monday, July 21, 2014

Change Linux machine name in Ubuntu

sudo hostname chef-worksation

Wednesday, July 9, 2014

See numeric permission in terminal

Ever wanted to see the Linux file permissions to number? (for example convert drwxr-xr-x to 755 ) ?
stat -c "%a %n" *

Sunday, July 6, 2014

Installing git on CentOs

for some reason, git wont be installed on a cent os unless you force it this way:

yum --disableexcludes=main install git

Tuesday, July 1, 2014

How to shorten terminal prompt in Linux ? (Trim Directory Path)

ever done cd into too many directory that your terminal prompt was taking the whole line making it hard to type any command ? Previously I posted about how to do shorten the terminal using PS1,

I found out a another way, which syntax doesn't require knowing any regex. simply enter:

$PROMPT_DIRTRIM=1

change 1 to the number of levels you wanna see.

here is how my prompt look before :
medya@arch-chef-001:~/chef-repo/vagrant-machines/oracle-linux-5-5$medya@arch-chef-001:~/.../vagrant-machines/oracle-linux-5-5$ PROMPT_DIRTRIM=1


and after 
medya@arch-chef-001:~/.../oracle-linux-5-5$


Related

Labels

computer (48) ubuntu (46) linux (28) tutorial (20) opinion (17) programming (14) software overview (13) terminal (12) troubleshooting (8) life (7) literature (7) poem (7) human languages (6) vim (6) bash (5) google (5) python (5) android (4) cars (4) phpBB (4) suggestion (4) tips (4) 12.04 (3) Chef (3) extension and addons (3) firefox (3) java (3) personal (3) russian (3) shell (3) windows (3) 64bit (2) Calligraphy (2) Chicago (2) Vagrant (2) apple (2) backup (2) bug (2) code (2) eclipse (2) funny (2) google chrome (2) idea (2) monitor (2) php (2) phpBB3 (2) shorter prompt (2) ssh (2) virtualbox (2) $_SERVER['REQUEST_URI'] (1) 2.7 (1) ALT+Backspace (1) AVR (1) Alt-Printscreen-K (1) AutoRotate (1) CTRL+ALT+DELETE (1) DRM (1) Debugging (1) Gimp (1) Gimp 2.8 (1) Microcontroler (1) Restart X (1) UML (1) Ventra (1) adsense (1) amazon (1) audio (1) aws (1) background process (1) battery (1) bing (1) blank (1) blogging (1) bmw (1) boot (1) business review (1) car (1) cd (1) chrome (1) comcast (1) computer kubuntu (1) conference (1) cookie (1) cron (1) database (1) date (1) display (1) domain name (1) download manager (1) dual boot (1) dual monitor (1) extensions (1) feature request (1) file (1) folder (1) freeze (1) gimp single window (1) git (1) gnome 3.10 (1) google docs (1) google plust (1) google+ (1) grep (1) icon (1) install (1) iterator (1) links (1) linu (1) linux links (1) list (1) mac os (1) media server (1) microsoft (1) moonlight (1) music (1) mysql (1) name (1) nautilus (1) netflix (1) notepad++ (1) parking (1) permission (1) philosophy (1) photo (1) prompt (1) protest (1) ps3mediaserver (1) putty (1) read from file (1) realtek (1) resolution (1) roku (1) samsung (1) scala (1) screenshot (1) security (1) selinux (1) server (1) skype (1) space (1) spam (1) spambot (1) sql (1) suspension (1) system monitor (1) tar (1) task manager (1) template design (1) th23 domain (1) thinking (1) ubuntu 13.10 (1) unity (1) vimrc (1) virtual machine (1) weblogic (1) wget (1) with space (1) xorg (1) xrand (1)