Grep a text from a specific file extension
Answer:
Suppose you want to grep a specific code from files with a specific file extension, you can try
# grep -r --include \*.php 'error_log(' .
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Grep a text from a specific file extension
Answer:
Suppose you want to grep a specific code from files with a specific file extension, you can try
# grep -r --include \*.php 'error_log(' .
Remove Mac OSX's dot underscore files
Answer:
To list the dot underscore files in a Mac directory, you can use:
# find . -name '._*' -exec ls {} \;
To remove them, you can try:
# find . -name '._*' -exec rm -v {} \;
How to get the current running Java processes with full argument
Answer:
To do so, use the command:
#jps -mlvV
Answer:
Sometimes, when you've removed files without using the git rm and git will warn you the message "Changed but not updated.."
To fix this, you can use the command
# git ls-files --deleted -z | xargs -0 git rm
Trap bash exit signal
Answer:
To trap your script before exit, you can use the trap in bash, e.g.
#!/bin/bash
set -eu
function bye {
echo "Good bye"
}
trap bye EXIT
sleep 1000
# Quit the script by pressing Ctrl+C