Ubuntu Server Commands


Reset CHMOD files and folders

find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;

List all child directories of the current folder

ls -d */

See file list by extension

find . -type f -name "*.txt"


Scan a folder wp-content/

sudo clamscan --infected --recursive --remove wp-content/

Manage archive files

# Zip folder into .tar.gz file
$ tar cvfz FILENAME.tar.gz DIRECTORY/

# Zip folder into .tar.bz2 file
$ tar cvfj FILENAME.tar.bz2 DIRECTORY/

# Unzip .tar.gz file
$ tar xvfz FILE.tar.gz

# Unzip .tar.bz2 file
$ tar xvfj FILE.tar.bz2

# Unzip .sql.gz
$ gzip -d FILE.sql.gz


Restart services if failed

# service php74rc-fpm restart
# service php74rc-fpm status


Export SQL

mysqldump -u db_username -p db_name > data.sql

Import SQL

mysql -u db_username -p db_name < data.sql