Last active
February 14, 2017 05:58
-
-
Save inbalj/0058ff9fb7598b2ce9b515149df4087d to your computer and use it in GitHub Desktop.
Usefull linux commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Generate login-link | |
| ------------------- | |
| reset user 1 password in db | |
| UPDATE users SET pass = md5(‘123456789’) where uid = 1; | |
| Drush can generate a one-time login link. | |
| ---------------------------------------- | |
| drush uli | |
| Reset password | |
| -------------- | |
| drush upwd --password="givememypasswordback" "admin" | |
| (where "admin" is the user name) | |
| get logs: | |
| tail -f /var/log/httpd/error.donor.log | |
| connect to ssh server | |
| --------------------- | |
| ssh [email protected] | |
| copy file from remote server: | |
| ------------------------------ | |
| scp [email protected]:dump.sql.gz . | |
| copy file from local to remote server: | |
| -------------------------------------- | |
| scp filename.txt [email protected]:destination-location | |
| copy folder from remote server: | |
| ------------------------------ | |
| scp -r [email protected]:dump-folder . | |
| fix ssh key on server | |
| --------------------- | |
| ssh [email protected] - connect to remote server | |
| su sitename - get su permission | |
| cd ~siber - change directory to site | |
| cp /usr/local/reasonat/ssh_keys/inbal* . - copy ssh keys to .ssh folder on site | |
| make - run make | |
| connect to mysql server via terminal and drush | |
| ---------------------------------------------- | |
| drush sqlc --uri=http://199.966.299.99 | |
| upload the database to phpmyadmin- | |
| ---------------------------------- | |
| mysql -uroot -p DATABASENAME < ~/Downloads/NEWDATABASE.mysql | |
| download the database from phpmyadmin- | |
| -------------------------------------- | |
| mysql -uroot -p DATABASENAME > ~/Downloads/NEWDATABASE FILE.mysql | |
| import Database | |
| --------------- | |
| drush sql-cli < ~/my-sql-dump-file-name.sql | |
| fix problem in network | |
| ---------------------- | |
| sudo service networking restart | |
| uncheck "Enable Networking" | |
| check "Enable Networking" | |
| change icon of application | |
| -------------------------- | |
| sudo nautilus /usr/share/applications/ | |
| get database: | |
| -------------- | |
| drush sql-dump > ~/qa.sql | |
| gzip ~/qa.sql | |
| extract gzip file | |
| ------------------ | |
| gunzip ~/qa.sql.gz | |
| find file name in directory | |
| --------------------------- | |
| you can change the ~ with . for current folder | |
| find ~/ -type f -name "string to search" | |
| extract multiple tar files at the same time | |
| ------------------------------------------- | |
| ls *.tar | xargs -i tar xf {} | |
| compile one sass file ( when you are located on the root of the theme ) | |
| --------------------- | |
| compass compile sass/normalize.scss --css-dir=css | |
| Extract sublime | |
| ---------------- | |
| sudo dpkg -i sublime-text_build-3103_i386.deb | |
| Patches | |
| ------- | |
| apply a patch | |
| curl http://www.drupal/xxx.patch | patch -p1 | |
| OR | |
| curl http://drupal.org/files/[patch-name].patch | git apply -v | |
| apply to a file | |
| curl -O http://www.drupal/xxx.patch | |
| undo patch | |
| curl http://www.drupal/xxx.patch | patch -p1 -R | |
| add watchdog to file to debug a problem | |
| ------------------------------------------ | |
| static $once = 0; | |
| if (!$once && !is_array($elements)) { | |
| $once = 1; | |
| $trace = debug_backtrace(2,20); | |
| watchdog(Inbal,"<pre>" . print_r($trace,TRUE). "</pre>>"); | |
| } | |
| Switch PHP version ( Apache ): | |
| ----------------------------------- | |
| from php5.6 to php7.0: | |
| sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart | |
| from php7.0 to php5.6: | |
| sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart | |
| git | |
| --- | |
| add a remote repository | |
| ----------------------- | |
| git remote add dev site-name@host:~/com.git | |
| estimate space usage to a specific folder | |
| -----------------------------------------`::q | |
| sudo du -hs /home/inbal/* | |
| result: | |
| ------ | |
| 6.6G /home/inbal/deja-dup | |
| 92M /home/inbal/Desktop | |
| 1.8G /home/inbal/Documents | |
| 292M /home/inbal/Downloads | |
| 124M /home/inbal/drush-backups | |
| 12K /home/inbal/examples.desktop | |
| 100K /home/inbal/java_error_in_PHPSTORM_3316.log | |
| 4.0K /home/inbal/Music | |
| 56K /home/inbal/openvpn-ca | |
| 28M /home/inbal/Pictures | |
| 4.0K /home/inbal/Public | |
| 4.0K /home/inbal/Templates | |
| 12M /home/inbal/Videos | |
| 11G /home/inbal/webdev | |
| sudo df -h /home/inbal/* | |
| result: | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
| /dev/sda5 41G 36G 2.9G 93% / | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment