[General Topics] S0AndS0:
4:3:2 Command line commands for Linux (part 2)

4:3:2 Command line commands for Linux

Set password for root

# passwd

Add a normal user. This command will also start a chain of user input requests to set up the user's "profile" its easy and better than running round as root all day.

# add-user[new-user-name]

Or

# adduser[new-user-name]

Give normal user sudo permissions. Note depending on which environment you run this command you will need a password for root or the user's password for the sudo permissions or the password for the user, try'em all till one works and make a note of it.

# add-user sudo[user-name]

I've also used

# adduser [user-name] sudo

Login to new user. It will then request a password from you. Note when you type in your password there will be no indication on your display, this is a security feature.

# login[user-name]

Install packages to new user once logged in

#sudo apt-get install [package-name]

Get a list of installed packages

#dpkg --get-selections

Get some help with dpkg

#dpkg --help

4:3:3 Connectbot optimization guide

By this point I hope you've poked around in Connectbot and seen some things. We're going to use some of them here to make the boot and shutdown processes a bit easier. For theses steps you’ll want to follow steps 4:3:3-1 though 4:3:3-4 and then scroll down to the specific automation example and copy/paste it.

4:3:3-1. Linux Boot/Mount automation

Open Connectbot

Make a new local connection and title it 'linuxBoot' or something that will remind you not to open it more than once (if you do, don't worry, we can fix it)

Disconnect from 'linuxBoot' and then press and hold on it until a dialog pops up.

Select Edit Host, scroll down to ‘Post-login automation’ and select that too.

Past the following lines with the line breaks intact (you may have to go in with your finger and hit 'enter' in order to have the correct line breaks between commands) if your device took well to the system shortcut that the installer attempted to place for 'deb'.

su

deb s; deb x

Past the the following if you get errors saying that 'deb isn't recognized'. This is usually to do with not having full read/write permissions while your device is operating (sOff and sOn for example on some HTC devices)

su

export PATH=/data/local/deb:$PATH

deb s; deb x

The deb s causes linux to mount and start openssh-server so that you can connect to it from any ssh compatible device and get to the command line.

The deb x starts up lxde, which gives you a graphical user interface to interface with.

The export path command is kinda like a short cut. You can use that one for many things and is well worth experimenting with.

Save your settings by hitting 'ok' and backing out to connect bot's main screen.

Make a new local connection and title it something like 'linuxShutdown'

Repeat steps 3-5 or 6 and past one of the following

4:3:3-2 Linux Unmount/Kill automation

Paste the following lines into the separate new local connection’s ‘Post-login automation’ titled ‘linuxShutdown’ for a quick connection that you can use to safely shut down your connections, unmount the OS from where it hooks into the android system, and kill any remaining tasks.

su

deb S; deb X; deb u; deb k

Or

su

export PATH=/data/local/deb:$PATH

deb S; deb X; deb u; deb k

capitalizing the 's' and 'x' from the 'linuxBoot' example sends the shutdown command to those two services

Unmount from system is what 'deb u' does, sometimes you'll see some errors

And 'deb k' forcibly kills whatever's left (usually whatever was causing the errors from running the 'deb u' command

Save and back out yet again to the main connectbot screen.

4:3:3-3. Connectbot “Local” SSH setup

Make a new connection, this time select ssh, if its not already selected by default and title it something like 'debian@localhost' just change the debian part to the name of the user you want to login as, such as root perhaps.

1. If you've left ssh running then skip to step 4:3:3-2. If you haven't started it then start it by

Selecting your 'linuxBoot' let it do its thing for a sec or hit 'enter' on your keyboard and let it do its thing for a second.

2. Once you've got ssh server up you can connect to it one of two ways that I know of.

First to test and daily for quick command line access: click on the ssh connection that was made in step 4:3:3-3 of this mini-guide and type the password for that user... and your in.

Second way is to connect with a different device: see section 7:1:2-2

Once you're in you may interact with it like a terminal window and most linux commands will work here with little to no modification. So utilize linux specific sources of information as I'd exhaust myself enumerating and cataloging all the things you can do.

4:3:3-4. Other good combos to use after using 'linuxBoot’

these are connections that I set up with connectbot to quickly run other repetitive tasks that I've saved and used as their own separate local connections. These can also be copy/paste into the command line usually too.

upgrade, update, start a search for something new to install

apt-get upgrade; apt-get update

apt-cache search

Clean out temp and cached files, remove unnecessary junk

apt-get clean; apt-get autoremove; apt-get update

Displays the manual for displaying manuals and the "| less" should make it display a bit frienlyer.

man man | less

4:3:4 Remote RDP debian kit Guide

1. Open Remote RDP, Press menu, Tap add and input the following modifications to the options:

Host=localhost

User=[your-user-name]

Password=[please-don't] can be a security risk

Color=24-bit

Screen=800X600 (though try others based on the physical size of your device)

Compress=checked On

Name=[user-name@localhost] (think you can name it whatever you like)

2. Back out to main Remote RDP screen and tap on the new connection you've set up.

3. There you will be greeted by either an error prompt (in which case check your settings in step one of this mini guide or run the boot commands described in step 4:3:3-6, specifically deb x) or you will see part of a desktop, window, and or mouse cursor. At this point; verify the username is correct, input your password for that user name, and hit enter.

Note if when you tap or drag on the screen and the mouse cursor follows your finger and not the gesture:

Back out to the main screen on Remote RDP

Press menu, tap settings; or tap the gear icon

Scroll down to Touchpad mode and either enable or disable

Familiarize yourself with some of the other settings while you're here as there are many user interface tweaks you can use.

4. Once you've successfully made a connection, chill for a sec. You're going to at first see a grayish screen, maybe a window bar at the bottom, and then (depending on the speed and available memory of your device) all the sudden it'll paint in a desktop for you to poke around in.

5. On the desktop that Remote RDP has wonderfully supplied; let's get rid of one pesky thing, the screen saver, its a resource and battery drain.

Mouse over to the lower left corner of the screen

There you will see a little 'symbol' click it and in a second it'll pop up a dialog.

Mouse over to options, then screen saver settings, and tap it

In the upper right quadrant of the new window you'll find a drop down menu with disable screensaver being one of them.

Select your choice, then exit out.

Note if logged in as root in Remote RDP you'll receive an error pop up window. In which case instead of mousing over to screensaver settings; mouse over to disable x screensaver under the other directory of the 'start bar' menu and click it. That should resolve having the screen saver coming on in the background while the screen is off and in no need of saving. Other methods welcome.

4:4 Rom Tool Box user Tips

If you've got it then you know its the best; if not, then try the free version and see if it will meet your needs before making the plunge to pro version.

4:4:1 Scripts

Here I will document scripts that I use or am working on.

Boot script

#!/system/bin/sh

: '

starts the remote desktop protocol server and openssh server services and exits the bash automaticly

written for personal use by strangerthanbland 05182013 Use at own risk.

see guide for details on why this script is useful

____________________

https://docs.google.com/document/d/17rboS2kaTNtcd7O7PCSIrlXVud79MHkqUTYohYNIbNI/edit?usp=drive_web

____________________

Comments and suggestions can be directed to either of the above links

_set this to run at boot with rom tool box by copy/pasting in a new script file and tapping on it and selecting Run At Boot Option

_add a new script to rom tool box by opening the app on your device

__scrol down to scripter under the tools tab and tap it

___tap on add then create

____title it what you want and copy past this example from hash sine to the exit command

'

export PATH=/data/local/deb:$PATH

deb x; deb s

exit

ShutDown Script

#!/system/bin/sh

: '

Listens for the device's shutdown command and executes this as one of the shutdown processes

'

4:4:2 Perfomence Mods

The mods explained here are as always a "use at your own risk" sort of affair. What will be contained here? Governors, overclocking and undervolting, memory management, ad blocking, and many more when time permits.

4:4:3 General guide lines

The things that I suggest for ROM Tool Box are only from a user's perspective and are here for easy reference, documentation purposes, and to offer a different perspective. The guide lines for using the material found in sections 4:4:1 - 4:4:4 may be modified but are as follows:

Don't be foolish; this app can be dangerous

Understand your device(s) and my device(s) are different

Comments/problems about the app itself likely should be directed to the developer of that app

Comment/problems about the content here should be directed here to this document or one of it's mirrors

4:4:4 Useful tips