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 .
Nano is used to write the content in the file
nano filename which takes to writing screen
write then press ctrl+x then press Y+enter to save and come out
Cat command is used to check the content in the file
cat filename
echo is a print command in Linux
echo "hello world"
output is : hello world
cd is change directory
mkdir is used to make directory
pwd present directory
ls is list of files
clear is to clear the screen
history to check the list of commands run on terminal
ls -la is used to check the details of the file
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
sudo apt-get update is the command to update the system
sudo apt-get install docker to install docker on system
man-db is helper database its like a helper
ex:
man ssh
cp is used to copy file
from source to destination
ubuntu@ip-172-31-3-108:~$ cp tws/merifile.txt newfolder/
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
$ 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