Book Image

Linux Utilities Cookbook

By : James Kent Lewis
Book Image

Linux Utilities Cookbook

By: James Kent Lewis

Overview of this book

<p>Linux is a stable, reliable and extremely powerful operating system. It has been around for many years, however, most people still don't know what it can do and the ways it is superior to other operating systems. Many people want to get started with Linux for greater control and security, but getting started can be time consuming and complicated. <br /><br />A practical, hands-on guide that provides you with a number of clear step-by-step examples to help you solve many of the questions that crop up when using an operating system you may not be familiar with.</p> <p>Presenting solutions to the most common Linux problems in a clear and concise way, this helpful guide starts with spicing up the terminal sessions by command retrieval and line editing, and shell prompt variables. We will then get to know the different desktops (GUIs) available for Linux systems and which is the best fit for you. We will then explore the world of managing files and directories, connectivity, and what to do when it goes wrong. We will also learn a range of skills, from creating and managing user accounts to securing your system, managing and limiting processes, and letting information flow from one process to another using pipes. Later, we will master disk management, working with scripts and automating tasks quickly, and finally, understand the need for a custom kernel and tips on how to build one.</p> <p><br />Based on the author's extensive experience, there is a section on best practices that every Linux user should be familiar with.</p>
Table of Contents (19 chapters)
Linux Utilities Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the Screen program


Screen is a full-screen window manager that shares a physical terminal with other processes (which are usually other terminals/shells). It is normally used when no other manager or desktop is available, such as on a server. It has a scroll-back history buffer and also allows for copy and paste of text between windows.

Getting ready

The following is a brief list of some of the many key bindings available with Screen:

  • Ctrl + A + ?: It displays a list of commands and their key bindings

  • Ctrl + A + C: It brings up a new window

  • Ctrl + A + D: It detaches a window

  • Ctrl + A + N: It is used to go to the next window in the sequence

  • Ctrl + A + P: It is used to go to the previous window in the sequence

  • Ctrl + A + # (where # is a number): It is used to go directly to that window

  • Ctrl + A + ": It shows the list of windows; user can select any one by the number

The following is a list of frequently used commands:

  • screen -list: It shows all of the windows

  • screen <program>: It creates a new window and run that program in it

How to do it...

An example of running the Screen utility is as follows:

  1. In a terminal run the screen -L command.

  2. Now press Ctrl + A and then press C. This will create another window.

  3. Do this two more times.

  4. Try typing Ctrl + A + 0.

  5. Try Ctrl + A + 3.

How it works...

In the previous section, step 1 will create a new window, window 0. If you are running inside a window manager you may notice the title change showing which window it is.

Step 2 will create another window. After step 3, you will have 4 windows in total.

When you perform the actions in step 4, you should be in window 0. Typing Ctrl + a + 3 will take you to window 3.

There's more...

Here is a helpful hint, if you are running only a command line with no desktop, you may want to change your PS1 variable to something like the following in your .bashrc file:

export PS1="screen$WINDOW \h \u \w \$ "

Now the prompt will always show which window you are in.

This describes only a small part of what Screen can do. Consult the man page for more information.