Thursday, January 31, 2013

Screen: Multitasking in the command line

Multitasking Octave and Python with Screen. (Don't ask why, it's an example)

"Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells." - definition from GNU Screen website.

As the definition says Screen allows you to run multiple processes/shells in one terminal, this is priceless when you are sshing a remote server. However you can use the powers of Screen to do some command line multitask in your everyday life.

I'll cover how I use both Screen and the the Gnome Drop Down Terminal (alternatively Guake can also be used). If you use Guake, you might say: "but I already have tabs in Guake, I don't need Screen". That's as debatable as the topic of Buffers vs Tabs in Vim, but everybody knows that Buffers beat Tabs everyday (OK, that's just my opinion).

Basics of Screen


Install Screen from your distro repository if you haven't already. And let's see what Screen can do.
# Try this command
screen
Notice the gnome-terminal screen now says "screen" in the title.

Some splash screen appears, you press enter and then looks like nothing happened... But something did happen, you are now in a Screen session!
# Try this command on your current window
top
You'll now see your running processes order by CPU usage. Now type: 'C-a c' (press both Ctrl and A, release both keys and then press the C key).

Creating a new window in a Screen session.

You have just created a new window and you watching this second window. The command top is still running in the first window, just that is not visible. You can switch between these two windows using 'C-a n' or 'C-a p'.

Finally, you can "kill" a window using the command 'C-a k'. You'll see a prompt at the bottom, asking if you really want to kill window. Killing a window also terminates the process contained in it.

Killing a window an a Screen session.

There are other commands, you can learn more about them using the help command 'C-a h'. There is another important feature of Screen named attaching/detaching, which is extremely useful for ssh connections, but I won't cover that here as it's not necessary to do the multitasking, as you'll see soon.

How do I know if I'm in a Screen session?


I can't visually tell whether I'm in a Screen session or not.

If you run screen inside a a GUI terminal like the gnome-terminal, is easy to notice that you are in a Screen session because the title changes to "screen". On Guake is also easy to notice, as the tab name changes to "screen" accordingly.

But on the Gnome Drop Down Terminal you've got no way to tell. You can't tell either if you are on an X-less login session. At less not visually, but you can always test if 'C-a h' displays the Screen help.

A better way of telling Screen session apart is adding a status line, this line can also display other important information. Before adding that feature, we need to lean about the screenrc file.

screenrc


As with many other applications, Screen has a rc file that executes certain commands at every startup, you can think of it as a configuration file. We'll work with the .screenrc file found in your home folder, that rc file only works with your current user account.
# Creating/editing the screenrc file
vim ~/.screenrc
To turn off the startup message you can add this line to your .screenrc file:

Screen status


To add a nice status line to Screen, you must append the following lines to your .screenrc file. (Source: Arch Linux Forums)
The Screen status line displays the hostname, a list of windows, the date and the time.

Launching a set of applications on every Screen call


To start Screen with multiple windows and each window containing an application, add the following lines to your .screenrc file.
On Screen the windows are numbered starting from 0. The final command selects which window will be active at startup.

For example, to start Screen with two windows, the first containing octave and the second containing the shell; and start with the shell window active, you'll need the following lines:
Start Screen with Octave and a shell (zsh in this example)

Keybindings


Remember the command we tested at the beggining of this post? Well, we can map them to single keys for faster accessing. The following lines do just that, append them to your .screenrc:
Each keybinding has a description right next to it, for your reference.

Drop-down Multitasker Terminal


As a final step let's integrate Screen to a drop down terminal for the ultimate command line multitasking experience.

Gnome Drop Down Terminal


For the Gnome Drop Down Terminal, the process is straightforward: Simply head to the preferences of the extension and select screen as the custom command to run instead of the shell.

Use Screen instead of the default shell in the Gnome Drop Down Terminal

Gnome Drop Down Terminal + Screen

Guake


You can start Guake with some applications in it at startup as I explained in an old post (I used Octave as an example in that post). But using Screen and the .screenrc file is way simpler!

You'll need to run 'guake -e screen' instead of just guake, and the screenrc file will take care of launching your apps.

The easiest way is to configure Guake as a startup application.

Launch Guake with Screen inside it at startup.

Screened Guake

I hope this post was useful to the heavy users of the command line and also pushes the casual users to get into it.

17 comments:

  1. This is very informative posting, it will helpful for us. Thanks for sharing it with us.

    For more related information you can also visit here: www.emblogic.com

    ReplyDelete
    Replies
    1. Hello Everyone

      I'm providing fresh & legit Fullz & Tools with Tutorials

      For Contact
      //> 752-822-040 -> I C Q
      //> peeterhacks -> Skype/Wickr
      //> @killhacks -> Tel.Gram

      All types of Tools & Fullz Available
      CC FULLZ WITH CVV
      SSN DOB DL FULLZ
      HIGH CS FULLZ
      DUMPS WITH PIN CODES

      -----752-822-040 -> I C Q-----
      -----peeterhacks -> Skype/Wickr-----
      -----@leadsupplier -> Tel.Gram-----

      TOOLS FOR Hac-king
      Spa-mming Stuff With Commplete Guide
      Carding Methods with Cash out Process
      FB/WA Hac-king Tips & Tricks
      BTC Cracker/Flasher
      Kali-Linux Master Class
      Fr**d Bi*le 2021/2022
      D-e-e-p W-eb Complete Course with video Tutorials
      Combos
      Shells/C-panels/Mailers/Brutes
      SMS Spoofer/Boomber
      Smtp's/Rdp's
      ETC

      *Fast Reply
      *Cheap Prices
      *No Refund, only replacement
      *Special discount for bulk order

      Delete
    2. Good Day Guys !

      We are offering fresh & Valid Fullz, Tools & Tutorials.
      All stuff will be genuine, Guaranteed & verified.
      Stuff will be provided in Mins.
      Very cheap prices & easy to get.

      For more details :
      TG/ICQ - @killhacks
      Wickr/Skype - @peeterhacks
      WA - +92 317 2721122
      Email - exploit(dot)tools4u at Gmail(dot)com

      Feel Free to contact for any query
      Many other stuff we are offering too

      CC Fullz with CVV+SSN
      SSN+DOB+DL Fullz with Complete Info
      High Credit Scores Fullz
      Dumps With Pins Track 101&202
      Business EIN Fullz
      Hacking Tools & Tutorials
      Spamming complete package with all stuff
      Carding & Loan Methods/Tutorials
      Fr**D Bi**e 2021/2022 updated
      BTC Cracking/Flashing
      RDP's/SMTP's/C-panels/Shells
      Web-mailers/Brutes/Crackers
      SQLi Injector/Server Penetration
      Kali Linux Master Class Complete
      Premium Logs (Amazon, E-bay, Coinbase, Netflix)
      I.P's/Proxies/Server I.P's

      We are a team of hackers & serving many good clients.
      You can try us as well
      Just contact us :

      WA - +92 317 2721122
      Email - exploit(dot)tools4u at Gmail(dot)com
      TG/ICQ - @killhacks
      Wickr/Skype - @peeterhacks

      Delete
  2. This article is unique and interesting. thanks for your share. I have been meaning to write something like this on my website and you have given me an idea.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Selling USA FRESH SPAMMED SSN Leads/Fullz, along with Driving License/ID Number with EXCELLENT connectivity.

    **PRICE**
    >>2$ FOR EACH LEAD/FULLZ/PROFILE
    >>5$ FOR EACH PREMIUM LEAD/FULLZ/PROFILE

    **DETAILS IN EACH LEAD/FULLZ**

    ->FULL NAME
    ->SSN
    ->DATE OF BIRTH
    ->DRIVING LICENSE NUMBER WITH EXPIRY DATE
    ->ADDRESS WITH ZIP
    ->PHONE NUMBER, EMAIL, I.P ADDRESS
    ->EMPLOYEE DETAILS
    ->REALTIONSHIP DETAILS
    ->MORTGAGE INFO
    ->BANK ACCOUNT DETAILS

    >All Leads are Tested & Verified.
    >Invalid info found, will be replaced.
    >Serious buyers will be welcome & I will give discounts for bulk orders.
    >Fresh spammed data of USA Credit Bureau
    >Good credit Scores, 700 minimum scores
    >Bulk order will be preferable
    >Minimum order 20 leads/fullz
    >Hope for the long term business
    >You can asked for samples, specific states & zips (if needed)
    >Payment mode BTC, PAYPAL & PERFECT MONEY

    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ''OTHER GADGETS PROVIDING''

    >SSN Fullz
    >Dead Fullz
    >Carding Tutorials
    >Hacking Tutorials
    >SMTP Linux Root
    >DUMPS with pins track 1 and 2
    >Sock Tools
    >Server I.P's
    >USA emails with passwords (bulk order preferable)

    **Contact 24/7**

    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ReplyDelete
  5. Hi, i believe that i saw you visited my website so i came to go back the desire?.I’m trying to find issues to improve my website!I suppose its good enough to use some of your ideas!! 경마사이트

    ReplyDelete
  6. Thank you for this brief explanation and very nice information. This post gives truly quality information. Hope to see you again.
    wordpress
    ufa88kh.blogspot
    youtube
    real money

    ReplyDelete
  7. I am really happy to say it’s an interesting post to read. I learn new information from your article , you are doing a great job.
    스포츠토토

    ReplyDelete
  8. I have been browsing online more than 3 hours today, yet I never found any interesting article like yours. It's pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did, the net will be a lot more useful than ever before 토토

    ReplyDelete
  9. Hello Everyone

    I'm providing fresh & legit Fullz & Tools with Tutorials

    For Contact
    //> 752-822-040 -> I C Q
    //> peeterhacks -> Skype/Wickr
    //> @killhacks -> Tel.Gram

    All types of Tools & Fullz Available
    CC FULLZ WITH CVV
    SSN DOB DL FULLZ
    HIGH CS FULLZ
    DUMPS WITH PIN CODES

    -----752-822-040 -> I C Q-----
    -----peeterhacks -> Skype/Wickr-----
    -----@leadsupplier -> Tel.Gram-----

    TOOLS FOR Hac-king
    Spa-mming Stuff With Commplete Guide
    Carding Methods with Cash out Process
    FB/WA Hac-king Tips & Tricks
    BTC Cracker/Flasher
    Kali-Linux Master Class
    Fr**d Bi*le 2021/2022
    D-e-e-p W-eb Complete Course with video Tutorials
    Combos
    Shells/C-panels/Mailers/Brutes
    SMS Spoofer/Boomber
    Smtp's/Rdp's
    ETC

    *Fast Reply
    *Cheap Prices
    *No Refund, only replacement
    *Special discount for bulk order

    ReplyDelete
  10. Good Day Guys !

    We are offering fresh & Valid Fullz, Tools & Tutorials.
    All stuff will be genuine, Guaranteed & verified.
    Stuff will be provided in Mins.
    Very cheap prices & easy to get.

    For more details :
    TG/ICQ - @killhacks
    Wickr/Skype - @peeterhacks
    WA - +92 317 2721122
    Email - exploit(dot)tools4u at Gmail(dot)com

    Feel Free to contact for any query
    Many other stuff we are offering too

    CC Fullz with CVV+SSN
    SSN+DOB+DL Fullz with Complete Info
    High Credit Scores Fullz
    Dumps With Pins Track 101&202
    Business EIN Fullz
    Hacking Tools & Tutorials
    Spamming complete package with all stuff
    Carding & Loan Methods/Tutorials
    Fr**D Bi**e 2021/2022 updated
    BTC Cracking/Flashing
    RDP's/SMTP's/C-panels/Shells
    Web-mailers/Brutes/Crackers
    SQLi Injector/Server Penetration
    Kali Linux Master Class Complete
    Premium Logs (Amazon, E-bay, Coinbase, Netflix)
    I.P's/Proxies/Server I.P's

    We are a team of hackers & serving many good clients.
    You can try us as well
    Just contact us :

    WA - +92 317 2721122
    Email - exploit(dot)tools4u at Gmail(dot)com
    TG/ICQ - @killhacks
    Wickr/Skype - @peeterhacks

    ReplyDelete
  11. ’ll be coming back to your website for more soon.

    ReplyDelete
  12. I am very impressed with your post because this post is very beneficial for me and provide a new knowledge.

    ReplyDelete
  13. This is incredible, I feel really happy to have seen your webpage.

    ReplyDelete