sh 贝尔命令要记住!!!! (BASH)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 贝尔命令要记住!!!! (BASH)相关的知识,希望对你有一定的参考价值。

#SHELL COMMANDS TO REMEMBER!!!! (BASH)

# Find content in files
grep --color -irn CONTENT_STRING PATH  //https://www.computerhope.com/unix/ugrep.htm

# Find file on drive
find PATH -name FILENAME

# -i ignore case
# -n add line number to output
# -c shows number of times the searched item appears in file
# -v does and inverse search returning the opposite of what is being searched for


# replace (www-data) with whatever you want the new ownership to be.
# also you can replace the (*) with whatever file name/names you want to change.
# eg: sudo chown -R www-data: help.txt
# eg: sudo chown -R root: help.txt

sudo chown -R www-data: *

#Execute a bash script with the "./" prefix
$ chmod u+x my_shell_script.sh
#Then execute
$ ./my_shell_script.sh


#shell script logical
#uses 'command' to verify installation of a command
if ! [ -x "$(command -v someclicommand)" ]; then
    # exec false case. i.e: (someclicommand is not installed)
else
    # exec true case. i.e: (someclicommand is installed)
fi

以上是关于sh 贝尔命令要记住!!!! (BASH)的主要内容,如果未能解决你的问题,请参考以下文章

sh Nginx命令要记住

sh GIT命令要记住!!!!

Linux的Bash Shell详解

Linux下如何执行Shell脚本

Shell中bash的特性小结

linux 命令中的sh是啥意思??