Restart
sudo reboot
Edit Cron
crontab -e
Write Permissons to www and user
sudo chown -R yourname:www-data cake;
sudo chmod -R g+s cake
Run inmotion’s PHP
ea-php70
Unzip File
If the unzip
command isn’t already installed on your system, then run:
sudo apt-get install unzip
After installing the unzip utility, if you want to extract to a particular destination folder, you can use:
unzip file.zip -d destination_folder
If the source and destination directories are the same, you can simply do:
unzip file.zip
Set WordPress write permissons
sudo chown -Rf www-data.www-data /var/www/[WordPress-directory]/public/
Execute custom php and composer
/c/path/to/php/php.exe composer.phar require barryvdh/laravel-dompdf
/c/PortableApps/xamppv7.1.3-3/php/php.exe /c/ProgramData/ComposerSetup/bin/composer.phar require jenssegers/date
Execute composer
./composer.phar -v
Linux Distro
$ cat /etc/os-release
Permissions
$ chown -R www-data:www-data app/cache
Folders Size
du -chd 1 | sort -h
Copy Folder:
cp -option -option2 source destination
Example, copy /home/vivek/letters/
folder and all its files to /usb/backup/
directory:
cp -avr /home/vivek/letters /usb/backup
Where:
- -a : Preserve the specified attributes such as directory an file mode, ownership, timestamps, if possible additional attributes: context, links, xattr, all.
- -v : Verbose output.
- -r : Copy directories recursively.
Grant user permission on users group
sudo adduser user1 site1
sudo adduser ubuntu www-data
Check User Groups
groups ubuntu
Check Disk Free, used available space
df -h
Copy File
cp from to
Add user to www-data (Web server)
sudo adduser yourusername www-data
Write Permissons
chmod -R 777 public/cached
Full permissons
sudo chown -Rf www-data.www-data /var/www/easywayrentacar.com/public/
Check wich Apache group is used for web server to write
ps aux | grep apache
Name should be in the first column
Write Permissions (Laravel/RHEL)
sudo chown -R $USER:apache storage;
chmod -R 775 storage;
sudo chown -R $USER:apache bootstrap/cache;
chmod -R 775 bootstrap/cache;
sudo chown -R $USER:apache public;
chmod -R 775 public;
Maybe change apache
to www-data
, check last command.
Use sudo if Operation not permitted.
Write Permissions (Laravel/Ubuntu)
sudo chown -R $USER:www-data storage;
chmod -R 775 storage;
sudo chown -R $USER:www-data bootstrap/cache;
chmod -R 775 bootstrap/cache;
sudo chown -R $USER:www-data public;
chmod -R 775 public;
Maybe change apache
to www-data
, check last command.
Use sudo if Operation not permitted.
Write Permissions WordPress (Ubuntu, Debian)
sudo chown -R $USER:www-data public;
chmod -R 775 public;
Recursive delete, remove, erase full directory folder
rm -r /path/to/dir
rm -f -r /path/to/dir
Recursive copy full directory folder
cp -r /path/to/dir /path/to/newdir
Get size of subdirs
cd /dir/dub
du -hs *
Ordered size of dirs
du -h --max-depth=1 | sort -hr
General Available and used space
df
Download a File Using Curl
curl -O https://domain.ltd/path/to/file.zip
Where domain.ltd
is the origin server domain
and /path/to/file.zip
is the file path.
Unzip File
$ unzip file.zip
Where fil.zip
is the zipped file to unzip.
Tar + Gzip a folder
$ tar -zcvf newrelic.tar.gz newrelic/
a newrelic
a newrelic/.DS_Store
a newrelic/CHANGELOG
a newrelic/extension-example.xml
a newrelic/extension.xsd
a newrelic/LICENSE
a newrelic/newrelic-api-sources.jar
a newrelic/newrelic-api.jar
a newrelic/README.txt
$ ls -lsa
0 drwxr-xr-x 13 mkyong staff 442 Jan 24 21:40 newrelic
11072 -rw-r--r-- 1 mkyong staff 5667938 Jul 23 15:44 newrelic.tar.gz
List the contents of tar gz file
$ tar -tf newrelic.tar.gz
newrelic/
newrelic/._.DS_Store
newrelic/.DS_Store
newrelic/._CHANGELOG
newrelic/CHANGELOG
newrelic/._extension-example.xml
newrelic/extension-example.xml
newrelic/._extension.xsd
Extract untar GZ
tar -zxvf {file.tar.gz}
Compress Directory (Zip file)
zip -r /var/www/itowork.tk.zip /var/www/itowork.tk
Or
zip -r archivename.zip directory_name
Where /var/www/itowork.tk.zip
is the new zipped file
and /var/www/itowork.tk
es the source to compress.
Compress File (Tar Gz File)
tar -zcvf /var/www/itowork.tk.back.tar.gz /var/www/itowork.tk
Where /var/www/itowork.tk.zip
is the new zipped file
and /var/www/itowork.tk
es the source to compress.
Move or Rename Folder
$ mv /path/to/source /path/to/dest
Where /path/to/source
is the origin
and /path/to/dest
is the destination folder.
In this example, move or rename /home/vivek/data/
directory
to /nas/home/vivek/archived/
directory:
$ mv /home/vivek/data/ /nas/home/vivek/archived/
To get verbose output (explain what is being done), type:
$ mv -v /home/vivek/data/ /nas/home/vivek/archived/
How do I Move Multiple Directories?
Use the following syntax to move dir1
and dir2
to /path/to/dest/
directory:
$ mv -v dir1 dir2 /path/to/dest/
$ ls -l /path/to/dest/
OR use the following syntax:
$ mv -v /home/vivek/dir1/ /home/vivek/dir2/ -t /nas/home/vivek/archived/
Backup, clone Files
$ tar -zcvf path/to/archive.tar.gz /var/www
Backup Files *.tar.gz
files, will be placed at /home/user
if path is not defined.
Backup, clone database
$ mysqldump -u {username} -p {password} {databasename} > {/path/to/backupfile.sql}
Backup Database *.sql files
, will be placed at /home/user
if path is not defined.
Adding Default Keys
In the simplest form, ssh-add
can be run without arguments. Used this way, it adds the default keys ~/.ssh/id_rsa
, ~/.ssh/id_dsa
, ~/.ssh/id_ecdsa
. ~/ssh/id_ed25519
, and ~/.ssh/identity
, if they exist.
Adding an Arbitrary Key
To add an arbitrary private key, give the path of the key file as an argument to ssh-add
. For example,
ssh-add ~/.ssh/tatu-aws-key
would add the file ~/.ssh/tatu-aws-key
.
Vim Save And Quit The Editor Command
The procedure to save a file in vim / vi and quit the editor is as follows:
- Open the terminal application in Linux or Unix
- Next, open a file in vim / vi, type: vim filename
- To save a file in Vim / vi, press Esc key, type :w and hit Enter key
- One can save a file and quit vim / Vi by pressing Esc key, type 😡 and hit Enter key