you are uploading the file use below code.
$file = basename(realpath($_GET['file']));
Avoid using mysql(i)_ extensions use PDO
filter_var($_REQUEST['search'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)
;
Aws cli configuration
AWS Access Key ID [None]: YOURKEY
AWS Secret Access Key [None]: YOURSECRETKEY
Default region name [None]: us-west-2
Default output format [None]: json
Space in S3 Bucket
aws s3api --profile PROFILE_NAME list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]" | awk 'NR!=2 {print $0;next} NR==2 {print $0/1024/1024/1024" GB"}'
ssh -i /web/KP-EC2.pem ec2-user@xxx.xxx.xxx.xxx
sudo yum update -y
Click on below links (Use right click and open in a new tab)
You may be using a ubuntu machine or you are creating virtual host on ubuntu server. Open terminal using ctrl+alt+T in ubuntu, putty on windows. Connect with ssh if you are going to creating virtual host on ubuntu server.
grep keyword /var/spool/cron/root | egrep -v ^# | grep -v ^$ | awk '{print $1,$2,$3,$4,$5,$8}'
cat netstat.log.5 | awk '$4 ~ /:80$/ {c++;print $5 | "sed 's/::ffff://' | sed 's/:.*$//'| sort | uniq -c | sort -n | tail -n 10"} END {print c}'
netstat -plantu | grep -c :1433
ifconfig eth0
tail -20 /var/log/httpd/error_log
grep -i maxclients /etc/httpd/conf/httpd.conf
cat /etc/my.cnf | grep cache -i | grep -v ^#
grep "^|" queries-pre-restart.txt | awk '{ print $14 }' | sort | uniq -c | sort -nr
mkdir -p www/public_html
Will make directory at nested level (it will create both directory)1. git checkout master
- git checkout allows you to move between branches and potentially restore tree files.
- The command git checkout master switches you to the master branch, which is always the best place to start before making changes to your repo.
2. git pull origin master
- Get the latest updates on the master branch,
- This is typically done to merge upstream changes. A git pull is actually a combination of git fetch, which grabs all the latest information, and git merge, which merges the two histories together.
- Essentially, git pull origin master allows you to do two commands at once. It’s a great time-saver!
- Always run git pull origin master before starting work on a repository. After all, you want to be sure your repository is up to date with the remote repo where you collaborate.
##To compress all files of foldername##
tar -cvzf docs.tar.gz /var/www/html/foldername
##extract docs.tar.gz in docs folder##
tar -xvzf docs.tar.gz
Convert DateTime in UnixTimeStamp
SELECT *,from_unixtime(date_added) FROM
TABLE_NAME order by date_added desc
Space consume by a table
SELECT table_schema "Data Base Name",sum( data_length + index_length ) / 1024 / 1024 /1024 "Used GB" FROM information_schema.TABLES GROUP BY table_schema ;
Character Set
utf8mb4_unicode_ci
Set a login path using terminal/putty
Redirection to https file
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirection to https and www page
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]