Showing posts with label Terminal. Show all posts
Showing posts with label Terminal. Show all posts

Friday, November 2, 2018

Create Instances at AWS (Amezon Web services) and connect through SSH.

Step 1: Login your AWS Account.

Step 2: At the navigation click on services, and select "EC2".

Step 3 : If you want to create new site or application or Instance, you need to click on "launch Instances".

Step 4: There is a option for free and paid server for creating instances. ("Choose an Awazon Machine Image (AMI)")

Note : Amazon web services provide you 8 TB space if you want more than it you need to select paid server.

Step 5 : Go through all the steps, there is a option of create key pair, it will use to connect your AWS website with ssh, but remember on thing you can create a pair key only one time and if another user want to access this folder you have to share your pair key.

eg. test.pem file



Step 6 : Connect instances using ssh and pem file

download your pem file and put this at your desktop and connect through ssh username and password.





Step 7 : you need to give the permission of your pem file to read and write.

$ chmod 400 test.pem


Step 8 : SSH Command :

ssh -i YOUR_PEMFILE.pem user@publicdns/domainname

ex - ssh -i xyz.pem ec2-user@ec2-45-415-458.compute-1.amazonaws.com

 
Step 9 : Now you will connect to your AWS Account :)

Step 10 : At AWS account click on your instances, below you will find description tab under that public DNS(IPv4)  ec2-45-415-458.compute-1.amazonaws.com, click on that link you will redirect your web page of your instances.


Sunday, October 21, 2018

Import and Export Database using ssh




Import Database using ssh :- 

 mysql -u <database_username> -p -D <Your_databasename> < <database_path>  
 Example :-   
  mysql -u abcpanam_devuser -p -D abcpanam_abcpanama < abcdistr_abcpanama(1).sql 


Export Database using ssh :- 

 [abcdistr@server ~]$ mysqldump -u abcdistr_ntf -p abcdistr_abcpanama > abcdistr_abcpanama.sql 


IMPORT AND EXPORT DATABASE AT lOCALHOST USING TERMINAL

Connect Terminal to database

 $ mysql -h 127.0.0.1 -u root  
 $ /opt/lampp/bin/mysql -uroot -ppassword  
 ntf-22@NTF-22:/$ /opt/lampp/bin/mysql -uroot (IF THERE IS NO PASSWORD) 


IMPORT :-

ntf-22@NTF-22:~$ sudo /opt/lampp/bin/mysql>mysql -u root ssh_test_db < /home/ntf-22/Desktop/abcdistr_abcgrouptt.sql  
ntf-22@NTF-22:~$ sudo /opt/lampp/bin/mysql>mysql -u <database_username> <database_name> < <downloaded_database_sql_file_path_at_your_system>  

EXPORT:-

ntf-22@NTF-22:~$ /opt/lampp/bin/mysql>mysqldump -u root -p ABC_magento_db > ABC_magento_db.sql  
 ntf-22@NTF-22:~$ /opt/lampp/bin/mysql>mysqldump -u <database_username> -p <database_name> > <new_database_name.sql> 

Basics Ubuntu Terminal commands





Some basics command to use terminal in Ubuntu Linux

S. NO
COMMAND
EXAMPLE
BRIEF DESCRIPTION
1.
cd <folder_name>
ntf-22@NTF-22:~$ cd /home/ntf-22/
To enter in a folder
2
cd  ..
ntf-22@NTF-22:~$ cd ..
exit from a folder
3
cd  /..
ntf-22@NTF-22:~$ cd /..
Exit from all folder and move at root
4
pkill  <software_name>
ntf-22@NTF-22:/$ pkill geany
Used to close specific software.
5
<software name>
ntf-22@NTF-22:/$ geany
Open directly through terminal
6
ssh username@domain
ntf-22@NTF-22:~$ ssh ntf-15@192.168.1.101

Connect other system using terminal
7
sudo mv frompath topath
ntf-22@NTF-22:/$ sudo mv opt/lampp/htdocs/swati-drupal home/ntf-22/Downloads

Move folder from terminal




8
sudo frompath/foldername  topath/folderRename
ntf-22@NTF-22:/$ sudo mv opt/lampp/htdocs/swati-drupal home/ntf-22/Downloads/swati-move
Move and Rename  folder using terminal
9
grep sshd /var/log/auth.log
ntf-22@NTF-22:~$ grep sshd /var/log/auth.log

Know whoes access your system and when .
10
gksu gedit /etc/hosts
ntf-22@NTF-22:~$ gksu gedit /etc/hosts
Search your website which you want to unblock and delete, if you want to block add url of the site.
11
mkdir <filename>
ntf-15@NTF-15:~/Music$ mkdir tt

Creating folder using command
11
rmdir <filename>

ntf-15@NTF-15:~/Music$ rmdir tt
Remove Folder Using command.
12
pwd
ntf-15@NTF-15:~$ pwd

Print Current Working Directory
Show in which directory are you working.
13
ls
ntf-15@NTF-15:~$ ls
Print List of Directory
14
history -c
ntf-22@NTF-22:/$ history -c
Clear history of open terminal.
15
cp -R source destination
ntf-22@NTF-22:~/Downloads$ cp -R /home/ntf-22/Downloads/testing /home/ntf-22/Desktop/
Copy and paste from terminal you can also copy and paste your file
16
zip -r folder.zip folder
ntf-22@NTF-22:~/Downloads$ zip -r testing.zip /home/ntf-22/Downloads/testing
Create zip file using terminal
17
pathwhereyouwanttoxtract$ unzip folder.zip
ntf-22@NTF-22:~/Downloads$ unzip drupal8.zip

Extract folder using terminal
18
$ passwd
ntf-22@NTF-22:~$ passwd

Change password for
system
19
$ scp source_path  user@domain:/destinationpath
ntf-22@NTF-22:~$ scp /home/ntf-22/Downloads/test.php ntf-15@192.168.1.101:/home/ntf-15/Desktop

Put file in other system
20
$ scp user@domain:/path yourpath
ntf-22@NTF-22:~$ scp ntf-15@192.168.1.101:/home/ntf-15/Desktop/t.png /home/ntf-22/Desktop/
Get from other system
21
php -m
ntf-22@NTF-22:~$ php -m
it shows the list of enable module in php
22
php -m | grep <name of extention>

ntf-15@NTF-15:/$ php -m | grep ctype

Checking extension enable or not in your php server
23
sudo apt-get install php7.0- <name of extention>
ntf-15@NTF-15:/$ sudo apt-get install php7.0-dom
To install php extension in server