Say goodbye to grep

ack is a famous code search tool to replace grep (in a lot of use cases): https://beyondgrep.com/why-ack/ Now there is something even better. There is ag aka The Silver Searcher: ggreer/the_silver_searcher It is like ack, but faster. Why not just grep? Hella fast. Like really really fast. It is beautifully optimized C. It ignores files from .gitignore Instead of doing this with grep: grep -R --exclude-dir=node_modules 'foobar' /path/to/your/code You can just do (if you have node_modules in your ....

July 25, 2021

Autostart any GUI app in Manjaro

In this example I will autostart the GUI package manager of Manjaro. Create a file e.g. ~/.config/autostart/pamac-manager.desktop In that file put: [Desktop Entry] Terminal=false Name=pamac-manager Type=Application Exec=/usr/bin/pamac-manager Icon=pamac-manager Comment=Package Manager In the Exec line put the path to your executable file. The rest you can probably guess. Source: https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html

April 30, 2021

Linux & OSX: Get file encoding

Sometime you need to know what’s your file encoding? Is it UTF-8, ISO 8859-1, ASCII or Windows 1252? You can find this out by using the file Unix command. Linux: file -i <filename> Mac OSX: file -I <filename> Example usage: username@server ~$ file -i somefile.php somefile.php: text/x-php; charset=us-ascii username@server ~$ file -i myutf8file.txt myutf8file.txt: text/plain; charset=utf-8 username@server ~$ file -i username.tar.bz2 username.tar.bz2: application/x-bzip2; charset=binary username@server ~$ If you want only the encoding....

September 28, 2018

cPanel: Listing all domains

I made a bash script listing all main domains and addon domains (for certain user by username or domain or for all users) in cPanel. Usage: lsdom [OPTION] [INPUT] Example: lsdom [cPanel username] Lists domains for certain user by username or domain or for all users Options: -d [domain] Displays all domains of the user of the input domain. -a, --all Lists all domains. -v, --version Displays version. -h, --help This help page....

February 11, 2018

cPanel: Listing all non-self-signed certificates

I made a bash script listing all non-self-signed certificates (for certain user by username or domain or for all users) in cPanel. Usage: lrcert [OPTION] [INPUT] Example: lrcert [cPanel username] Options: -d [domain] Displays all certificates of the owner of the domain. -a, --all Lists all certificates of all cPanel users -v, --version Displays version. -h, --help This help page. GitHub: https://github.com/nake89/lrcert/

February 10, 2018

Echoing multiline in linux terminal

There are at least three fun ways to echo multiline to a file. We are going to look at doing the output twice, the heredoc -method and writing multiline using double quotes. 1. Output twice I think this is the simplest and most intuitive method if you are familiar with linux output redirection. user@server:~/projects/blog\_content$ echo "This file is" >> multiline.txt user@server:~/projects/blog\_content$ echo "multiline" >> multiline.txt user@server:~/projects/blog\_content$ cat multiline.txt This file is multiline 2....

February 3, 2018

How to Search Contents of File in Linux

This is something you need to do often for one reason or another. Maybe you have a bunch of text files, which have been named horribly and you have no idea which file has the thing you are looking for, but you happen to remember a word in that file. Or maybe you need to find which file contains a certain variable to find the root cause of an error you are experiencing in your script....

April 15, 2017