Simple command to find out what shell you are using.
bash |copy code |?
1 ps -ef | grep $$ | awk '{print $8}'
Simple command to find out what shell you are using.
bash |copy code |?
1 ps -ef | grep $$ | awk '{print $8}'
This way you can get stats from your logs but this method is a little bit rudimentary as you are going to get visits from crawlers, bots,… that are not real visits. Parse your logs directly with awk.
bash |copy code |?
1 #!/bin/sh2 3 4 echo 'Number of unique visitors'5 6 cat /var/log/apache/www.yoursite.com-access.log |awk '{print $1}' | sort | uniq | wc -l7
How to make a regexp search with find recursively . If you want to search only in php files, replace file_pattern with “*.php”
echo 'Ip of unique visitors'
If you want to know what files a rpm package copied to your system, you can find it out executing the following command:
cat cat /var/log/apache/www.yoursite.com-access.log |awk '{print $1}' | sort | uniq | wc -l |awk '{print $1}' | sort | uniq
How to change the owner/group of a file or directory recursively.
bash |copy code |?
1 find . -iname-exec grep -n
To change the group:
bash |copy code |?
1 rpm -ql foo
Get the size of the current directory (.) or another one (foldername) with du command.
bash |copy code |?
1 sudo chown -R newusername foldername2 bash |copy code |?
1 sudo chgrp -R newgroupname foldernameFind and delete
Find files and directories containning your search terms, and delete them witout confirmation and recursively. No matter if they are not empty.
bash |copy code |?
1 du -sh .Snippet to remove caps and spaces from filename
Remove caps and spaces from names in files in current directory with tr command. First step is parse the name of the file or directory and then rename it.
du -sh foldername2 bash |copy code |?
1 find . -name "search_terms" -exec rm -rf {} \;3 bash |copy code |?
1 for f in *; do4 file=$(echo $f | tr A-Z a-z | tr ' ' _)5 Download a Web Site with wget
Wget is a tool to download websites from cli. How to download an entire site could be acomplished with the following example:
[ ! -f $file ] && mv "$f" $file02 done03 bash |copy code |?
01 wget \04 --recursive \05 --no-clobber \06 --page-requisites \07 --html-extension \08 --convert-links \09 --restrict-file-names=windows \10 --domains demosite.org \Bash: Find all .hidden files but ignore .htaccess file
A bash command to search for all hidden files recursively in the current directory but ignore apache .htaccess files.
--no-parent \