25. June 2022
xattr -d com.apple.metadata:kMDItemWhereFroms filename.mkv
25. June 2022
xattr -d com.apple.metadata:kMDItemWhereFroms filename.mkv
30. March 2020
Inside the wp-content folder:
wp db export ../backup_db.sql
And run this from outside the www folder:
tar -zcvf www_files_backup.tar.gz www
9. February 2019
The first thing I did was, I added a check in the header.php:
if ( isset($_GET['mycronjob'])) {
$date = date('Y-m-d H:i:s');
file_put_contents("test.txt", $date );
myFunction();
}
The first two lines inside of the if statement outputs a test.txt into the same folder as header.php with the time and date. (so I can check that the cron job is doing something)
After that it runs myFunction.
To make this code to run, you have to enter this address in your browser: https://www.example.com/?mycronjob, and that will trigger the content inside of the if statement.
So after that i logged into the server as a user and run this command:
crontab -e
And then I added the following to the file and saved it:
0 * * * * curl --request GET 'https://www.example.com/?mycronjob' >/dev/null 2>&1
This means that it will ‘visit’ this site ones every hour (at 1200, 1300, 1400 and so on). The last part (/dev/null 2>&1) means that it wouldn’t send out any mail to the server admin.
Here are some ‘nice to know’ command you can use instead of ‘0 * * * *’:
| Special string | Meaning |
| @reboot | Run once, at startup. |
| @yearly | Run once a year, “0 0 1 1 *”. |
| @annually | (same as @yearly) |
| @monthly | Run once a month, “0 0 1 * *”. |
| @weekly | Run once a week, “0 0 * * 0”. |
| @daily | Run once a day, “0 0 * * *”. |
| @midnight | (same as @daily) |
| @hourly | Run once an hour, “0 * * * *”. |
1. October 2018
nano ~/.bash_profile
ME_EMOJI=(?);
RANDOM_ME_EMOJI=${ME_EMOJI[$((RANDOM%1))]};
export PS1="$RANDOM_ME_EMOJI \[\h:\W \u \$ ";
#export PS1="? \w $RANDOM_ME_EMOJI >";
24. April 2018
Make sure you stand in your parent directory.
TAR.GZ:
tar -zcvf archive-name.tar.gz directory-name
ZIP (not always the server has zip library. Use Tar.gz):
zip -r filenameforthezipedfile thefolderwhoisgoingtobezipped
20. April 2018
mkdir (create new folder)
rmdir (delete folder)
rm -rf folder (delete folder with content)
rm -r (delete file)
touch index.html (create document)
open index.html (open document)
open -a "Visual Studio Code" index.html (open file in specific app)
cd .. (go back)
ls (list)
ls -las (better list)
la -las (also better list)
pwd (present directory)
open . (open folder in Finder)
mv oldname.jpg newname.jpg (change name on file or folder)
man xxxx (shows a manual of a command)
Command + K (clean the terminal)
Command + Z (gets back)
chmod 700 filename - Sometimes you have to be superuser (SU) - Set all Rights
grep -r wc_checkout_params (Search for something)
find . -type f -exec chmod 644 {} \; - give rights
find . -type d -exec chmod 755 {} \; - give rights
du -sh */ (check the folder size, one level)
du . -h --max-depth=1 (check the folder size)
df (show server size)
Remove everything on the computer in terminal:
sudo rm -rf /
20. April 2018
It is not every ISP that supports ‘keepalive’, if you are using a mobile connection for example, vill this happen.
If it happens with Ssh, you can run ‘top’ when you leave the terminal. Or you can: https://unix.stackexchange.com/questions/34004/how-does-tcp-keepalive-work-in-ssh
20. April 2018
1. Create a file: nano xxxxxxxx 2. Put in your commands that you what to run 3. Save the file (Ctl + O, Return, Ctl + X) 4. Make the file Executable: chmod 0760 xxxxxxxxxx (or chmod 700 xxxxxxxxx) 5. Run the script: ./xxxxxxxxxxxxx
20. April 2018
wp plugin update --all --exclude=woocommerce wp cache flush wp core update wp plugin update --all wp wc update wp core language update