Quick Tip – Connecting to Another Machine (Linux to Linux)


In todays quick tip I will discuss methods of connecting to another computer. There are many different methods of doing this, even more if you want to mix and match between Windows, Mac OSX and Linux. Today I will just be looking at a Linux to Linux connection.

First off, for today I am going to be connecting to a system that I built for my parents (details of the build to come) to grab a few photographs that my dad took on his latest holiday. They have a central Linux system with a file server through port forwarding on port number 400.

The first method to connect is via a simple ssh shell command

ssh dad@X.X.X.X -p 400

Where dad is my dads username, X.X.X.X is his IPv4 address and -p 400 says that i want to connect on port 400 which will tell the router at my dads house that I actually want to talk to the file server. What I have now is a connection to file server and access to everything on that local machine, with the input output information sent to my machine.

So what can i do with this. Funnily enough, this simple command is powerful if you want to use the remote computer. You can run an update, run any command line program (cat /etc/passwd :P) or execute shell scripts to achieve tasks like backup or batch file manipulation. To copy files between computers we are going to need another command.

At this point we have three different options, two command line choices and one GUI, (the GUI only needs your computer to have the GUI not the remote computer.

scp dad@X.X.X.X:400/home/dad/image.jpg /home/me/image.jpg

or

sftp dad@X.X.X.X:400
get /home/dad/image.jpg

or

Places -> connect to server -> Fill out needed information -> connect
enter password -> navigate through window to file -> drag and drop to desired location

The first option is my favorite and the most simple command if you know exactly what you want and where you want to put it. The first part logs onto the ssh server and locates the file for copying, and the second part says where the file should be put. While it is simple, it has no margin of error, it either works or doesn’t, and can do some squiggly things.

The second option is the best for looking for and finding files without a GUI. You must first login to the ssh server in ftp mode and then find and “get” (download) the file. I don’t really use this option often, but it’s handy to know.

The third option is great if you want a graphical way of interacting file on an external server. This is very simple once you have seen what to do. Hopefully I will be able to do a quick video to show how to do this, which I will link at a later stage.

This outlines the way that you can connect to different Linux boxes on either you own subnet, or even over the internet. Stay tunned for more posts related to connecting computers, in particular mac and windows to linux connection.

Quick Tip – Man Pages


Linux Man pages are one of the most useful resources a Linux user has in his arsenal when it comes to learning about a command line functionality or just about anything you could need to know about Linux. For example, today I want to transfer some log files from my server to my main computer analysis but a small script I had written, I decided do this via ftp (just cause I could). So the first thing that I did was check the man page to ensure I used the correct commands, by using man ftp.

man ftp

This shows an interactive document. You can scroll down to read more, press q to exit.

There are many different sections to the man program, each containing a different subset of commands and programs. This allows for different documentation of similar or the same named programs. For example, the apt program has to expansions – annotation processing tool and advanced packaging tool. Usually typing in a command into man produces the output you want, sometimes though you have to go searching.

man apt

This gives the man page for annotation processing tool.

man 8 apt

This gives the man page for advanced packaging tool.

If you come across the someone else referencing a man page, or you yourself want to reference a man page you would write it man program(section) eg for advanced packaging tool you would use man apt(8)

Removing a file from the command line


In my last post I talked about the 3 main ways of creating files from the command line. Today I will look at how to remove a file. Generally, to remove anything you would use the following command.

rm myfile.text

This is a very simple command, although by using some flags we can make it both safer and easier to use. -I gives a prompt before removing three or more files or when removing recursively, -v (or –verbose) prints everything that has been removed. You can also use the sudo command to remove a file from a folder where you do not have permissions to write.
(more…)

Creating Files Using the Command Line


Trying to do a simple post a day can be quite difficult, I have found. Thinking up new and original content is nigh impossible everyday, and while I have a dozen or so major articles and tutorials in the works, today is going to be something simple.

To this end today I have decided to talk about creating files in the command line.

There are many options, although three come to mind, each with there specific purposes.
(more…)

Quick Tip – Fixing a Failed Apt-Get Update – Ubuntu


Woke up this morning, and as usually I had new software to download and install through updater on Ubuntu 10.04. So I click install updates and about halfway through updating it stops. No apparent reason, but the windows is frozen and cannot be closed.

After a quick search on the Ubuntu forums and a look at man apt-get, there appears to be a fix. (more…)

Creating and Using Symlinks


Often we want some files to be in two places at once. Perhaps you are working a website that has its files in you home folder and then you want them to be displayed in /var/www/. Or maybe the software that your working with requests specific files in one folder but another program wants the in their current one. Despite the difficulty that I have in describing why you would need such an ability, There is know denying that eventually you are going to need to know how to use symlinks.

At the most basic level a symlink (AKA the Symbolic Link or sometimes referred to as a soft link) is a pointer that points to the actually location of the files without the program knowing that the files are not actually there. It also allows for a there to be differences in group and ownership if the content of a file, but more of that another time. (more…)

%d bloggers like this: