Sorting Unix 'ls' command output by filesize
Updated: 6th December 2022Tags: ubuntu bash
ls -Slh
-S will sort files by size
-l long listing
-h will make the output human-readable
-r will reverse the output
ls -Slh
-S will sort files by size
-l long listing
-h will make the output human-readable
-r will reverse the output
bash
mysql -e "show variables like 'datadir'"
mysql
show variables like 'datadir'
Memcache. It allows you to store both strings and php arrays and have fun. If it is not enough, try redis.
Edit file ~/.bash_aliases
nano ~/.bash_aliases
For example I make alias a
. So when I press a
it will produce php artisan tinker
Here file ~/.bash_aliases
alias a='php artisan tinker'
Load aliases immediately
source ~/.bash_aliases
Php isset will tell false if variable is null.
//false
isset($a[1]);
$a[1] = null;
//false
isset($a[1]);
That's why you should use array_key_exists if you need to check if it is set or not.
//false
array_key_exists($a[1]);
$a[1] = null;
//true
array_key_exists($a[1]);
DB::enableQueryLog(); // Enable query log
// use orm
dd(DB::getQueryLog()); // Show results of log
ps aux --sort=-%mem | awk 'NR<=800{print $0}'
ps -eo pid,lstart,cmd
git reset --soft HEAD~1
git push origin master --force
git reset --hard HEAD~1
git push origin master --force
Laravel queue job is caching your job php code, so after updating job code you need to:
php artisan queue:restart
Fast command to test nginx config and reload nginx if test is successful
sudo nginx -t && sudo nginx -s reload
To run some command in background, so you can close terminal, type the following:
nohup command-with-options &
TL DR; To build app on windows to linux 64 type this in powershell
$Env:GOOS = "linux"; $Env:GOARCH = "amd64"; go build main.go