Skip to content

Instantly share code, notes, and snippets.

@thomijasir
Last active May 20, 2019 04:07
Show Gist options
  • Save thomijasir/3256a5fd695f720461af8983288dfe63 to your computer and use it in GitHub Desktop.
Save thomijasir/3256a5fd695f720461af8983288dfe63 to your computer and use it in GitHub Desktop.
Linux commands are often used

List Linux Command Commonly Uses

Remove RPM

Chek RPM Packet name rpm -qa | grep -i webmin

Remove packet name rpm -e

Composer Install

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Creating & Pair SSH KEY

Generating new ssh key

ssh-keygen -t rsa -b 4096

Copy Your Public Key to Server

ssh-copy-id root@YOUR_IP_ADDRESS

for first time its require root password but for next login password will use Public Key

Database Export/Import Mysql

Export Database

mysqldump -u root -p digitecservers_513 > db_digitecservers_31-MAR-2016_backup.sql

Import Database

mysql -u username -p nama_database < nama_backup.sql

Zipping Folder or Files Uisng TAR GZIP OR ZIP

add v for verbose mode to show all activirty and extracting file during archiving file example tar czvf archive.tgz

Create Archive

tar czf archive.tgz yourfolderorfile/

Extrac to other folder

tar xzf ostechnix.tgz -C targetFolder/

Extract archive

tar xzf archive.tar.gz

ZIP All Folder in Linux

Create Archive

zip -r directoryname.zip directoryname

Extract Archive

unzip zipfilename.zip 

Extract Archive to Directory

unzip zipfilename.zip -d your/directory

Deleting Folder or File

rm -rf foldername

Giving User Access

chown -R www-data:www-data /srv/www/condotel.co.id/htdocs

Creating Alias File

ln -s /etc/nginx/sites-available/digitecservers.conf /etc/nginx/sites-enabled

Check Listener Port

sudo lsof -i -P -n

Get Directory File Size

du -a -h --max-depth=1 | sort -hr
du -sh file_path
df -h

Nginx Centos Default document root directory: /usr/share/nginx/html Default configuration file: /etc/nginx/nginx.conf Default Virtual host config directory: /etc/nginx/conf.d/ Default Virtual host config file: /etc/nginx/conf.d/default.conf

cd /srv/www/vuzmanga.com/htdocs wget http://wordpress.org/latest.tar.gz tar -zxvf latest.tar.gz cp -rvf wordpress/* . rm -R wordpress rm latest.tar.gz

sudo systemctl restart php7.0-fpm sudo systemctl restart nginx sudo systemctl restart mysql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment