Devops Basic Linux commands with ssh and scp(scp is nothing but coping files from local to server and vice versa)

Linux commands

1.Copying or move is same is used to move one folder to another uses the command:

mv ../filename.txt .

or

cp../filename.txt .

ubuntu@ip-172-31-3-108:~/tws$ mv ../merifile.txt .

  1. Nano is used to write the content in the file

  2. nano filename which takes to writing screen

    write then press ctrl+x then press Y+enter to save and come out

  3. Cat command is used to check the content in the file

    cat filename

  4. echo is a print command in Linux

    echo "hello world"

    output is : hello world

  5. cd is change directory

  6. mkdir is used to make directory

  7. pwd present directory

  8. ls is list of files

  9. clear is to clear the screen

  10. history to check the list of commands run on terminal

  11. ls -la is used to check the details of the file

  12. rm to remove

    ubuntu@ip-172-31-3-108:~/tws$ rm merifile.txt

Once the file is removed it is permanaetly deleted.

SSH in Linux:

ssh is secured shell protocol

Its is already installed for ec2 user

For window you'll need to go to the following link to install:

https://winbuzzer.com/2021/08/25/how-to-enable-and-use-ssh-commands-on-windows-10-xcxwbt/

ssh on window terminal then

cd downloads/keys

sudo ssh -i command from ec2

  1. sudo apt-get update is the command to update the system

  2. sudo apt-get install docker to install docker on system

    man-db is helper database its like a helper

    ex:

    man ssh

    1. cp is used to copy file

      from source to destination

      ubuntu@ip-172-31-3-108:~$ cp tws/merifile.txt newfolder/

      1. now to copy server(scp)

        First create a file then write some content the copy to server using following commands

        touch local_file.txt

        nano local_file.txt

        cat local_file.txt

        scp -i ubuntu1.pem local_file.txt ubuntu@ec2-18-116-12-51.us-east-2.compute.amazonaws.com:/home/ubuntu/newfolder

      2. $ sudo scp -i ubuntu1.pem local_file.txt ubuntu@ec2-18-116-12-51.us-east-2.compute.amazonaws.com:/home/ubuntu/newfolder/merifile.txt .

        from server to local