UpFront

The UpFront Section

UpFront

Tech Tip

If you do much work on remote servers and have ever lost your connection at an inconvenient moment, using screen can help avoid losing work. Screen is, according to the man page, “a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells)”. Window manager may be a bit misleading, as it's not a window manager in the GUI sense, but rather it manages a number of full-screen console/shell sessions within a single console/shell.

Screen is simple to use; after you connect to the remote server, type:

$ screen -D -RR

This creates a new screen session if there isn't one or attaches to a previously created one if one exists. Now if your connection drops, you simply reconnect and enter the above command to reconnect and return to the exact point you were at when your connection was lost.

Screen has many keyboard commands for starting and controlling additional sessions; see the man page for more info.

Screen also is useful when you want to execute a long-running process and don't want to stay connected while it runs. Simply start the command, and then switch to a different session and type ~. to disconnect your SSH connection. When you return later, you can reconnect to the screen session and see the output.

You even may want to put the screen command in your .profile file so that it is started automatically when you log in. I like to have the option of not starting screen, so I have my .profile ask whether I want to start it:

read -p "Start screen? " ans
ans=$(echo $ans | tr A-Z a-z)

if [[ "$ans" = y || "$ans" = yes ]]; then
  screen -D -RR
fi

Tech Tip

The shell has a maximum length for command-line arguments. If you try to pass more than the maximum, you will receive an error:

Argument list too long

For example, to find which files contain a particular string, you normally would do the following:

grep -l STRING

But, if there are too many files, you may get the “Argument list too long” error. In that case, you could do:

ls | xargs grep -l STRING

Tech Tip

You may have wondered how to determine certain X attributes using simple shell commands, such as the refresh rate and display resolution. You can use xrandr for that purpose:

$ xrandr --verbose

SZ:    Pixels        Physical       Refresh
*0   1024 x 768   ( 333mm x 241mm )  *85
1    800 x 600    ( 333mm x 241mm )   85
2    640 x 480    ( 333mm x 241mm )   85
Current rotation - normal
Current reflection - none
Rotations possible - normal
Reflections possible - none

You also can get a great deal of information with the xdpyinfo command, such as finding out what extensions are supported by the X server:

$ xdpyinfo | less

One very useful extension for video is the Xvideo extension, known as xv. The xvinfo command can give you information on this extension:

$ xvinfo

For 3-D, use the glxinfo command:

$ glxinfo

For more information about these commands see the respective man pages.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState