Wednesday, 29 January 2014

Learning - I think every Linux user should know these three commands

Background

I was doing some downloading on a remote linux machine that I did not have a GUI for, I was only able to access the system through SSH. The problem with this was that I did not want to risk the download stopping if my connection to the server was lost. So my first problem, was learning screen.
After that I ran into another issue, how was I going to copy this file from the remote server to my local machine.

The Process

My First problem was how do I get a "extra" screen or terminal. The Solution was quite literally screen.
There are a number of really good tutorials out there, that can help one get to become a master with this application. I don't really want to become a master, but I wanted to know how to use this.
So firstly I installed it using yum.
yum install screen
wow ok, that was deceptively simple.
How do I use this,
screen -?
Cool
we want to create a new screen/ R seems to be ok.
screen -R
ok well, looks like nothing has changed. Lets test.
Opens another SSH Session and run
screen -list
Ok cool, there was a result and looks good.

Awesome
So lets go, download that file. (Making sure I was in the correct SSH Session, I closed the session that I used to check.) wget my file, the command is pretty simple wget -O '<From>' <to>
Not to sure if this was the best way to do this, but was the way I used and seemed to work.

Downloaded the file, completed, wanted to make sure the md5 was the same, md5sum the file. Once that was completed I got an output of the md5 and the file name.

Next problem, I need to get that file from the server. SCP to the rescue! Quick google search provided me with a solution, scp the file from server to my machine.

No problems, scp <user>@<computer>:<file> <toFile>.

Done!

To Long, Short Version

Basically the commands I think everyone should know are how to scp from one machine to another, md5 a file and screen.

scp

scp <user>@<computer>:<file> <toFile>

md5

md5sum <file>

screen

screen -R, either creates or resumes a screen session.
while in screen
ctrl + a
ctrl + d
"Closes" screen and resumes with normal terminal.

#bearMan saving mySelf.