Autocomplete ssh for hostnames


To autocomplete ssh hostnames from knownhosts,

complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh

Source link

http://hints.macworld.com/article.php?story=20080317085050719

Advertisements

Installing PHPmyAdmin


List of steps for Installing PHPmyAdmin, helpful 😀

1. phpMyAdmin Requirements

Need to ensure you have at least the following versions of PHP/Mysql installed on the server. To confirm this check using the below.

–PHP

php -v

–MYSQL

mysql -V

2. Download PHPmyAdmin

Download from the website the copy across to the server http://www.phpmyadmin.net

3. Install in apache root directory

Once downloaded copy the gz file to the apache root directory and unzip. To confirm the directory run the following.

grep DocumentRoot /usr/local/apache2/conf/httpd.conf
tar xvfz phpMyAdmin-3.4.0-all-languages.tar.gz

4. Modify the permissions to the installed directory

Run the below to change the permissions of the phpmyadmin folder.

chown -R apache:apache phpmyadmin/

Then run the following, ensure your in the phpmyadmin folder.

mkdir config
chmod o+rw config
cp config.sample.inc.php config/config.inc.php
chmod o+w config/config.inc.php

5. Add sym link to /var/www/html

Add a symbolic link to the www directory so that its accessible from the server.

ln -s /usr/local/apache2/htdocs/phpmyadmin /var/www/html/apps/phpmyadmin

6. Access PHPmyAdmin configuration page

Go to the server address http://servernamehere/phpmyadmin/setup/index.php, this will allow access to the configuration page so that you can setup access to the DB.

*Note*

You will need to have the root password to the mysql DB. If you dont have this then there is a work around, however this is only to be applied on servers that are not live. If you require access to the root password for non-live server then contact Sysadmins on this.

7. Access PHPmyAdmin page

If its all working when you go to http://servername/phpmyadmin/index.php you should get the usual login prompt and then be able to login.

8. Enable access for remote server access to mysql

Run the following on the server that has mysql installed that you want to connect to

GRANT ALL ON *.* TO usernamehere@'serverhosthere' IDENTIFIED BY 'PASSWORD';

If required..

To increase the memory size if you get the following error

"Fatal error: Allowed memory size of 33554432 bytes exhausted".

Find the php.ini file using the below command

whereis php.ini

Then open up the file and amend the “Memory Limit” and “Post_max_size” parameters.

grep multiple files


Nice tip for when you need to look through more than 1 log, however the log names may be changing due to archiving purposes. They could be adding a date/time or number on to the filename, you can also use the * icon as a wildcard.

Added some examples below

 grep stuff some.access.log.[0-9]
 grep stuff some.access.log.*