Bash

command description group
tar -zcf ./ARCHIVE.tar.gz ./PACK_FILE.sql Make gzipped tar file from PACK_FILE.sql tar
tar -zxf ./ARCHIVE.tar.gz Unpack ARCHIVE.ta.gz tar
ls -R ./whales/ ı wc -l Count number of all files and directories in directory files
du –max-depth=1 -b ./whales/6/0/12 ı sort -n Get size of all dirs in one directory and sort them by the size files
cat access_log ı grep 'addCount' ı wc -l Count the occurence of addCount in Apache's access log files
find ./ -name '.svn' -exec rm -fR {} \; Delete all .svn directories from current directory and subdirectories files

ı means pipeline (|)

MySQL

command description
mysql -uUSER -pPASSWORD db_name < ~/import.sql Import SQL dump

SSH

SSH tunnel to remote MySQL server

ssh -L LOCALHOST_PORT:DATABASE_HOST_AT_REMOTE_SERVER:PORT_OF_DATABASE_AT_REMOTE_SERVER SSH_USER@REMOTE_SERVER

Example

If you need to connect to mysql host mysql.yourhosting.com:3306 at yourhosting.com through your local port 8889:

ssh -L 8889:mysql.yourhosting.com:3306 root@yourhosting.com
 
# usually you will use something like this:
# ssh -L 8889:localhost:3306 root@yourhosting.com

Then connect with your MySQL manager on your localhost to localhost:8889 and use same login details as on the hosting server

SSH tunnel from remote SVN to local SVN repository

ssh -l root -C -R 3690:192.168.1.100:3690 remote_server.com
 
basic_unix_commands.txt · Last modified: 2010/07/04 19:41 by root
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki