Table of Contents

Shell Tips and Tricks

Requirements

To apply the fallowing patches you need to access the device throw SSH and to have root privileges

  1. Start SSH server – Access the Admin web interface to enable the SSH support.
  2. Connect to the device using a ssh client (Putty) and log as a normal user.
  3. Change the user in root.
$ su -

<note warning>The author and the development team do not assume responsability for any harm or loss you may suffer if you execute the fallowing code. The information provided is considered experimental and if you don't know what you are doing you may crash your device for good.</note>

Configure Optware

  1. Start SSH server – Access the Admin web interface to enable the SSH support.
  2. Configure Optware – Install software package repositories support
  3. Add optware binaries to system path.
export PATH=\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/bin/X11:\
/usr/local/bin:\
/opt/bin
export PATH=\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/bin/X11:\
/usr/local/bin:\
/opt/bin

Install Midnight Commander

# ipkg update
# ipkg list mc
mc - 4.6.1-3 - Midnight Commander File Manager
Successfully terminated.
# ipkg list mc

Edit Files with mc

# mc

Edit Files with vi

vi is a text editor (program) that can be used to create and modify text files.

# vi new_file
# vi existing_file
Command Description
h move cursor one character to left
j move cursor one line down
k move cursor one line up
l move cursor one character to right
w move cursor one word to right
b move cursor one word to left
0 move cursor to beginning of line
$ move cursor to end of line
nG move cursor to line n
CTRL-f scroll forward one screen
CTRL-b scroll backward one screen
i insert to left of current cursor position (end with ESC)
a append to right of current cursor position (end with ESC)
dw delete current word (end with ESC)
cw change current word (end with ESC)
r change current character
~ change case (upper-, lower-) of current character
dd delete current line
D delete portion of current line to right of the cursor
x delete current character
ma mark currrent position
d`a delete everything from the marked position to here
`a go back to the marked position
p dump out at current place your last deletion (paste)
u undo the last command
. repeat the last command
J combine (join) next line with this one
:w write file to disk, stay in vi
:q! quit VI, do not write file to disk,
ZZ write file to disk, quit vi
:r filename read in a copy of the specified file to the current buffer
/string search forward for string (end with Enter)
?string search backward for string (end with Enter)
n repeat the last search (``next search'')
:s/s1/s2 replace (substitute) (the first) s1 in this line by s2
:lr/s/s1/s2/g replace all instances of s1 in the line range lr by s2
:map k s map the key k to a string of vi commands s (see below)
:abb s1 s2 expand the string s1 in append/insert mode to a string s2

An advanced tutorial can be found at: An Extremely Quick and Simple Introduction to the Vi Text by Norm Matloff

Manage Files with WinSCP

WinSCP is an open source SFTP client and FTP client for Windows. Its main function is the secure file transfer between a local and a remote computer. Beyond this, WinSCP offers basic file manager functionality. It uses Secure Shell (SSH) and supports, in addition to Secure FTP, also legacy SCP protocol.

Features

<blockquote>

<cite>Official website, Introducing WinSCP</cite> </blockquote>

Configuration

WinSCP login
Host Name: DEVICE_NAME Port Number: 22
Username: USERNAME Password: PASSWORD
Private Key File:
File Protocol: SCP

(where DEVICE_NAME may by the IP or the NAME of your MYBOOK).

<note tip>To ensure security do not specify any USERNAME or PASSWORD. They will be asked later.</note>

Server and Protocol Information
Protocol
Item Value Description
Remote System Linux DEVICE_NAME 2.6.17.14 #1 … Device signature
Session Protocol SSH-2 Secure Shell
SSH Implementation OpenSSH_3.9p1 OpenSSH
Encryption algorithm aes Advanced Encryption Standard
Compression No Data compression
File transfer protocol SCP SCP
Capabilities
Item Value
Can change permissions Yes Linux file permissions
Can change owner/group Yes Change a file's owner and group
Can execute arbitrary command Yes Learning the shell
Can create symlink/hardlink Yes/Yes Hardlinks and Symlinks
Can lookup user groups Yes Linux Command: groups
Can duplicate remote files Yes linux Command: cp
Can check available space No
Can calculate file checksum No
Native text (ASCII) mode transfers No