Linux cheatsheet

From EKiniWiki

Jump to: navigation, search
  • SSH
  ssh -p <port_number>  username@website.com
  • Check version
  uname -a
  • installing something in linux
  ./configure
  make
  make install
  • tar a target directory
  tar cfvzp filename.tar.gz /path/to/target_dir
  • extract a tar file. This will overwrite existing folders/files.
  tar xfvzp filename.tar.gz
  • dump and entire database into a file.
  mysqldump -uroot -p<password> database_name -R > file.sql
  • import an sql file to a database
  mysql -uroot -p<password> database_name < file.sql
  • creating a symbolic link
  ln -s /path/to/whatever linked-whatever
  • delete all .svn directories in a directory recursively
  find . -name ".svn" -exec rm -rf {} \;
  • convert encoding of file to another encoding. Useful in SQL Dumps. Example is thru exec() - a PHP Function
  exec('iconv -f "ISO-8859-1" -t UTF8 '.$path_to_file.'.csv > '.$new_temp_file.'.csv');
  • use wget to download files from the command line. Running this will download the files in your present working directory - by typing PWD
   //with proxy - you must "use_proxy = on" in /etc/wgetrc
   wget http://wiki.ekini.net/images/9/90/Zend_quickstart.tar.gz --proxy-user=<username>  --proxy-passwd=<password>
   
   //without proxy
   wget http://wiki.ekini.net/images/9/90/Zend_quickstart.tar.gz
  • List process
  ps aux | grep <process-name>
  ps aux | grep httpd //will list any process with httpd
  • PEAR behind an authenticated proxy server. set the http_proxy to be able to download and install PEAR packages
  pear config-set http_proxy http://username:password@yourproxy:80
Personal tools
Bookmarks