Thursday, December 30, 2010

Screen

Using command SCREEN

After you login to your machine via SSH run the 'screen' program. I can't remember if its installed by default but "sudo apt-get install screen" should work if it isn't. With screen running the shell looks like normal and you can use it like normal. When it comes time to logout, hit 'Ctrl a' followed by 'Ctrl d'. Thats the control key with lower case a, followed by the control key and lower case d. You should then see a message saying "[detached]". What ever program(s) you were running before are still running, only you can't see them at the moment.

To reconnect to the programs run "screen -r". Everything should now be back where you left it.

So you can...

1) SSH into machine
2) Run 'screen'
3) Do stuff (e.g. start long running command)
4) 'Ctrl a' 'Ctrl d' (detach)
5) Logout
...
6) SSH into machine
7) Run 'screen -r'
8) See if command from 3) is finished, do more stuff

If you are fully finished with screen, use 'exit' to get yourself back to a plain shell.


The screen program can also let you run multiple programs at the same time from within one shell. Whilst running screen, if you hit 'Ctrl a' then 'Ctrl c' you get a fresh prompt. You can use this prompt as normal. If you want to go back to the first command prompt, which is still doing what ever you left it doing, hit 'Ctrl a' then Ctrl a'. To get back to the second prompt again hit 'Ctrl a' then Ctrl a' a second time.

Ctrl a, Ctrl a jumps between the last two command prompts that you used. However you can have more than two running at the same time and so you can also use 'Ctrl a' then N (e.g. 0, 1, 2 etc) to jump to a prompt directly. So to get back to the first prompt hit 'Ctrl a' then 0. The second is 'Ctrl a' then 1 and so forth.

If you have more than one 'screen' prompt open, then typing exit only quits the current prompt, not 'screen' itself. So you have to exit multiple times before screen itself will quit.

Hope that helps. Check out the screen man page to get more detail.

Sunday, November 7, 2010

Grub 2 bash resolution

In /etc/default/grub
all i did was change and uncomment
Code:
set gfxmode=1024x768
then run update-grub (to be sure)

And

In /etc/grub.d/00_header
All I did was add the BOLD piece where it is in this code
Code:
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
set gfxmode=${GRUB_GFXMODE}
set gfxpayload=keep
IT HAS TO GO UNDER "set gfxmode..." to work!!!!


Keyboard Shortcuts for Bash ( Command Shell for Ubuntu, Debian, Suse, Redhat, Linux, etc)

Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + T Swap the last two characters before the cursor
Esc + T Swap the last two words before the cursor
Alt + F Move cursor forward one word on the current line
Alt + B Move cursor backward one word on the current line
Tab Auto-complete files and folder name