Command Line Cheatsheet

List of command lines I often use (in case I need to find them 😀 ). These things are for Linux OS since I need to deploy my projects.

  • Create user
useradd [username]
  • Change password of a user
passwd [username]
  • Compress folder
tar -czvf [name-of-archive].tar.gz [/path/to/directory-or-file]
zip -r [file_name].zip [directory_need_to_zip]
  • Extract file
tar -xzvf [file_need_to_extract].tar.gz
unzip [file_need_to_extract].zip -d [destination_folder]
  • Check disk space
du -sh *
du -sh [/path/to/folder]
  • MySQL server
service mysql status
service mysql stop
service mysql start

service mysqld status
service mysqld stop
service mysqld start

service mariadb status
service mariadb stop
service mariadb start
  • MySQL command
mysql -u root -p;
show databases;
create database [db_name];
create user [username]@localhost identified by '[password]';
grant all privileges on [db_name].* to [username]@localhost;
  • Restart Apache
service httpd restart
service apache2 restart
/etc/init.d/httpd reload
systemctl restart apache2
systemctl restart php-fpm.service