Thursday, November 1, 2007

vi commands

A few commands for the vi editor.
(info taken from http://www.cs.rit.edu/~cslab/vi.html)

 General Startup
To use vi: vi filename
To exit vi and save changes: ZZ or :wq
To exit vi without saving changes: :q!
To enter vi command mode: [esc]

Screen Movement
^F move forward one screen
^U move backward one half screen
? finds a word going backward
/ finds a word going forwards

MySQL Problems

I had some mysql problems where I could no longer access some databases with a particular user and I could also not login as root anymore. Here are some of the commands that I used to get back to normal:

Kill the process
kill `cat /var/run/mysqld/mysqld.pid`

To start mysql as root (very dangerious way to do this)
/usr/bin/safe_mysqld --skip-grant-tables --user=root &

To Flush the privileges
FLUSH PRIVILEGES;

To change the permissions
grant CREATE,INSERT,DELETE,UPDATE,SELECT on database_name.* to username@localhost;

Linux Shortcuts

Here are some shortcuts that I am posting for myself so that I won't forget. I only access my linux webserver through terminal once in a while so I forget!

find a file:
find . -name "rc.conf" -print

httpd.conf location:
/etc/httpd/conf/httpd.conf

restart httpd
/etc/rc.d/init.d/httpd restart

update fedora core
yum update