Posts

Showing posts from September, 2012

Little thinks about PSQL

Hi , if you just wanna list all databases on your postgres. It's just $ psql -l U postgres and if you wanna drop db. It's just $ dropdb -U postgres That's it.

Something about su and sudo

su - run a shell with substitute user and group IDs (  http://linux.die.net/man/1/su  ) sudo, sudoedit - execute a command as another user (  http://linux.die.net/man/8/sudo  ) The sudo allows a permitted user to execute a command as a superuser or another user as specified in the sudoers file ( which we can edit by visudo command ). The su is frequently use with -c ( --command ). But we put those 2 together like below example $ sudo su -c "whoami;echo $HOME"   # may be you'll get root and current user's home $ sudo -u hudson sh -c "whoami;pwd;whoami" ref http://linux.die.net

Linux networking #1

$ sudo route $ sudo vi /etc/resolveconf/resolv.conf.d/base $ sudo /etc/init.d/resolvconf restart

SMB usage

$ smbtree   # show list of smb share $ smbclient -L $ smbclient \\\\host\\sharename

SSH with X11 forward

$ ssh -Y # forward X11 Enables trusted X11 forwarding.  Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls. You can use -X but -Y must be better.

Create user for linux

$ useradd -m -p -s

BASH scripting TIP #1

In bash script file $? - store exit value of last command that was executed $* - store all args "$@" - store all args, individually with qoute "$1", "$2" $1 - first arg $2 - second arg $n - nth arg

Some trouble shooting that I just found and use :) #1

KVM machine in my office turn on with its kvm's instances. But some of them don't got an IP, even network interface card. So here is what i have found. $ sudo ifconfig eth0 up   # to bring up eth0 $ sudo dhclient -r   # release ip  $ sudo dhclient   # obtain ip ref cyberbiz website

Setup PySide

Setup PySide sudo add - apt - repository ppa : pyside sudo apt - get update   Great thanks to this ref :  http://qt-project.org/wiki/PySide_Binaries_Linux