I use the terminal a LOT. I just discovered a neat time saver. Say you typed a long command like:
sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files:scan --all --verbose
and wanted to use it again, but that was like a half-hour ago so there were hundreds of commands between then and now. Scrolling through them would be more work than typing it all again - assuming of course I remember it correctly.
Here's the tip: type "history |grep php" and the above command along with a list of other appears like this:
The command I wanted is line 440, so all I have to type is:
!440
That's it! Neat!
sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files:scan --all --verbose
and wanted to use it again, but that was like a half-hour ago so there were hundreds of commands between then and now. Scrolling through them would be more work than typing it all again - assuming of course I remember it correctly.
Here's the tip: type "history |grep php" and the above command along with a list of other appears like this:
Code:
[FONT=monospace][COLOR=#000000] 437 dpkg -l |grep [/COLOR][COLOR=#FF5454][B]php[/B][/COLOR] 438 [COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000] -v[/COLOR] 440 sudo -u www-data /usr/bin/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000] /var/www/nextcloud/occ files:scan --all --verbose[/COLOR] 463 locate config.[COLOR=#FF5454][B]php[/B][/COLOR] 464 nano /var/www/nextcloud/config/config.[COLOR=#FF5454][B]php[/B][/COLOR] 466 nano /var/www/nextcloud/config/config.[COLOR=#FF5454][B]php[/B][/COLOR] 468 nano /var/www/nextcloud/config/config.[COLOR=#FF5454][B]php[/B][/COLOR] 493 nano /var/www/nextcloud/config/config.[COLOR=#FF5454][B]php[/B][/COLOR] 514 locate Error[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000].log[/COLOR] 515 locate Errorlog.[COLOR=#FF5454][B]php[/B][/COLOR] 517 cat lib/private/Log/Syslog.[COLOR=#FF5454][B]php[/B][/COLOR] 524 nano /var/www/nextcloud/config/config.[COLOR=#FF5454][B]php[/B][/COLOR] 526 nano /var/www/nextcloud/config/config.[COLOR=#FF5454][B]php[/B][/COLOR] 541 apt install [COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]7.0-pdo[/COLOR] 542 apt install [COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]-pdo[/COLOR] 544 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR] 545 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.1[/COLOR] 546 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.1/apache2/[/COLOR] 547 rm -rfv /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.1[/COLOR] 548 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0[/COLOR] 549 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0/apache2/[/COLOR] 550 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0/apache2/conf.d/[/COLOR] 551 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0/apache2/conf.d/20-mysql.ini[/COLOR] 552 ls /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0/apache2/conf.d/20-mysqli.ini[/COLOR] 553 cat /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0/apache2/conf.d/20-mysqli.ini[/COLOR] 554 cat /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0/apache2/conf.d/20-pdo_mysql.ini[/COLOR] 555 cat /etc/[COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000]/7.0/apache2/[/COLOR][COLOR=#FF5454][B]php[/B][/COLOR][COLOR=#000000].ini [/COLOR] 568 cat /var/www/nextcloud/config/config.[COLOR=#FF5454][B]php[/B][/COLOR] 606 cat nextcloud/index.[COLOR=#FF5454][B]php[/B][/COLOR] 613 nano index.[COLOR=#FF5454][B]php[/B][/COLOR] 626 history |grep [COLOR=#FF5454][B]php[/B][/COLOR] [/FONT]
!440
That's it! Neat!
Comment