Getting files through a terminal window

This is a technique I had to use numerous times for a previous job where I would need to transfer files from servers that could not be connected to directly. In the majority of companies there will be numerous networks, where “jump boxes” are required to get across various networks and get to the server in question.

The usual approach of moving files to servers would be through a variety of means (FTP/SCP/NFS/CIFS etc.), however in the case of numerous jump boxes and networks would mean that having to transfer the file between each jump/network. It is possible to use copy and paste however this would only work in the case of text files, trying to display or copy binary data can cause all manner of issue and really mess up your terminal window. So for me the best solution is to UUEncode the binary data into ansi text which can be safely copied out of the terminal window, pasted into a file on your local machine and UUDecoded back to binary data again.

To do this simply UUEncode a file, and the output will be presented to STDOUT i.e. the terminal window.

$ uuencode test.rpm test.rpm

Note: the double typing of the name is required as the first argument is the file to uuencode, whilst the second argument is the name of the file that will be outputted. The output will be presented to STDOUT as shown in an example :

begin 644 test.rpm
M"GP]+2TM+2TM+2T]6R!796(@=G5L;F5R86)I;&ET:65S('1O(&=A:6X@86-C
M97-S('1O('1H92!S>7-T96T@73TM+2TM+2TM+2T]?`I\/2TM+2TM+2TM+2TM

The next step is simply to copy everything from the word “begin” to the word “end” out from the terminal window and then paste it into a text editor of your choice on your local machine under a temporary name. This will then need opening with uudecode, which will then process the text and spit out the file under the filename specified with the encoder.

$ uudecode temporary.uua

In the same location will be the decoded file.

Console/text based applications

Spending my days logging into systems remotely i’ve spent a good many years using many various text based applications that would under most circumstances completely depend upon a GUI. Also the fact that the display is based upon 80×25 characters, makes for multitasking applications that have text based user interfaces nigh on impossible without some help. I think i’ve pretty much gotten all of my configuration files sorted, and my set up is pretty much rock solid.

I’ve thrown together of scripts as well which make my life a heck of a lot more easier. I intend to comment through my configuration files and upload them, hopefully i’ll make someone else’s life a little bit easier.

Reclaiming space and expanding metadevices

example scenario:

/home is at 100%

/pointless is 0%

Both of which are meta softpartitions e.g. d10 for /home and d20 for /pointless. In our example we are going to increase the size of /home using the space utilised in /pointless (as it’s pointless and not needed 🙂 )

1. unmount /pointless

2. metaclear d20 (remove the meta partition)

3. metattach d10 10g   (g = gig, m =meg) (also 10g was the size occupied by d20)

4. growfs -M /home /dev/md/rdsk/d10

A df -h on /home now will show you that it has grown by the 10Gb, also no downtime is required for this operation.