Linux CLI snippets

for loop of all files in a directory The following snippet shows all files in Loop_dir. Loop_dir="path_to_dir" for entry in "$Loop_dir"/* do echo "$entry" done cf) https://stackoverflow.com/questions/13210880/replace-one-substring-for-another-string-in-shell-script/13210909 Check argument is set or not https://www.cyberciti.biz/faq/unix-linux-bash-script-check-if-variable-is-empty/ process tree ps -aef —forest Find from all files in the directory Find all lines from files in the current directory find ./ -type f -print | xargs grep 'foo' I created my custom alias. alias afind="find -type f -print | xargs grep" Delete prefix of files in a directory Here is a pioneer.