After you connect to your account via SSH, you might need these commands for:
pwd (print working directory) - show the full path to the directory in which you are currently.
cd (change directory) - move from one folder to another.
cd directory_name- go to this subfolder of the current folder
cd ..- go one level up
ls (list) - show the list of all files and folders in the current directory.
ls -ainclude hidden files (which begin with a dot)
Files and folders management
cp (copy). You can copy both files and folders.
cp copy_what copy_where
If you would like to copy to a higher directory, insert the full path, starting from home
mv (move). Same as cp, you can move both files and folders.
mv move_what move_where
mkdir (make directory) - create a new empty directory.
touch - create a new empty file.
rmdir (remove a directory) - delete the folder.
rm (remove) - delete a file. You can mention several files at a time.
rm -r deletes folders, their subfolders, and their content
grep - find a specific text inside files.
grep -inrl 'text'
find - find files with a specific name.
find . -type f -name 'name*.php'
Create an archive
Create an archive of specific files:
zip archive-name.zip filename1.php filename2.php filename3.php
tar -cvf archive.tar filename1.php filename2.php filename3.php
tar -zcf NewArchive.tar.gz filename1.php filename2.php filename3.php
Where instead of archive type the name of the future archive, and after that - exact files which should be included.
Create an archive of the whole folder:
zip -r archive.zip DirectoryName
tar -cvf archive.tar DirectoryName
tar -zcf archive.tar.gz DirectoryName
Unpack an archive
tar -xvf archive.tar
tar -zxvf archive.tar.gz
Import database file.sql to the database_username database.
mysql -u database_username -p database_name < file.sql
For this command, you should be in the folder where the file.sql is located
Export of database_username database to the file.sql file.
mysql -u database_username -p database_name > file.sql
For this command, you don't need to create a file beforehand
For both commands, in the next step, you should insert the database password
Checking inodes and disk usage per directory
Show the inodes number for every subdirectory of the current folder.
find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
Show the disk usage per each subdirectory and file of the current folder.
du -shc * | sort -rh
It can also be done faster via File Manager (beta)
Managing WordPress websites
Purge WordPress cache
wp cache flush
wp litespeed-purge all
Replace WordPress core files
rm -rf wp-includes
rm -rf wp-admin
wp core download --skip-content --force
backup=WP_`date +%s` && mkdir $backup && mv wp-admin $backup && mv wp-includes $backup && mv *.php $backup && wget https://wordpress.org/latest.zip && unzip latest.zip && rm -rf wordpress/wp-content && mv wordpress/* . && cp -rv $backup/wp-config.php .
Even more commands with a detailed explanation of usage can be found here: