Microsoft Windows Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, 18 April 2012

How to Multitask in the Linux Terminal: 3 Ways to Use Multiple Shells at Once

Posted on 01:49 by Unknown

How to Multitask in the Linux Terminal: 3 Ways to Use Multiple Shells at Once

The Linux terminal has rich multitasking capabilities. You can switch between the virtual consoles already running on your system, use Bash job control to run processes in the background, and take advantage of GNU screen, a terminal “window manager.”
You don’t have to stick to a single command at a time. Whether you want to run a process in the background and revisit it occasionally or run multiple time-consuming tasks at once, Linux offers several options.

Virtual Consoles

By default, most Linux systems have several virtual consoles running in the background. Switch between them by pressing Ctrl-Alt and hitting a key between F1 and F6. Ctrl-Alt-F7 will usually take you back to the graphical X server.
Pressing the key combination will take you to a login prompt. You can log in and run a command, then switch away – the command will continue running in the background, so you can have several different terminal sessions going at the same time.
The “tty1” text here indicates that this is the terminal located at Ctrl-Alt-F1, tty2 would be at F2.
These are just the most common settings – different Linux distributions could have less virtual consoles running and have the X server located at a different place.

Bash Job Control

The Bash shell provides its own features for handling multiple processes. Job control lets you run processes and attach and detach from them. An attached process is known as a foreground process, while a detached one is known as a background process.
To start a process in the background, add the & character after its command. For example, to open the Nano text editor as a background job, type the following command:
nano &
The [1] indicates that our new job’s job ID is 1. The 3751 is its process ID.
Every job we start gets its own job ID. Run the jobs command to view the list of currently running jobs. The + sign indicates the job that was last associated with the shell, while the – sign indicates the job that was second-to-last associated with the shell.
The fg command allows you to bring a background job to the foreground, attaching it to the current shell. Running fg or another job-related command without specifying a job will use the last-associated job – the one with a + sign in the jobs list. You can also specify a job number. For example, the following command will bring job 1 back to the foreground:
fg %1
End a process normally and it will vanish from the list of running jobs. If you want to detach a job from the current shell, use the ^Z – that is, Ctrl-Z – keyboard shortcut.

GNU Screen

GNU Screen is a “full-screen window manager” that lets you use multiple shells in a single terminal. It may not be installed by default – it isn’t on Ubuntu. On Ubuntu or Debian, use the following command to install Screen:
sudo apt-get install screen
Once it’s installed, run the screen command and you’ll see some information about Screen.
Press Space or Enter and you’ll see a normal-looking terminal.
It may not look special, but this shell is actually running within GNU Screen. Press Ctrl-aand then d to detach from Screen. You’ll be back to the normal terminal.
To reattach to screen, run the screen -r command. You’ll be back to the same terminal as before.
There’s a lot more you can do with screen. For example, create a new “window” (terminal) in screen by pressing Ctrl-a, then c. Once you have multiple windows, press Ctrl-a twice to switch between them. You can also press Ctrl-a, then “ to see a list of windows.
Select a window in the list and press Enter to switch to it.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • how linux is built
  • Samsung Electronics has bought Boxee
    Samsung Electronics has confirmed its purchase of Boxee on Wednesday for its  smart TVs .  Samsung plans to use this acquisition as a way to...
  • Another Microsoft Guru Steps Down
    Microsoft announced on Monday that company veteran Craig Mundie has stepped down from his post as chief of research and will retire in th...
  • Dr. Dre Top As The New Hip-Hop’s Top Earner
    Six years ago Dr. Dre was walking   for more click here
  • Microsoft new Windows, tablet
    US computing giant Microsoft on Tuesday gave an early peek to the key Chinese market of its new tablet computer and Windows 8 software, pr...
  • Thought words
    “ Greatness lies not in being strong, but in the right using of strength. ” — Henry Ward Beecher
  • How to Move Your Email to Another Mac
    If you use Apple's Mail application, there will probably come a time when you'll want to move your email messages and email account...
  • How To SSH Hop With Key Forwarding from Windows
    In this guide we’ll explain how to SSH to a Linux machine from Windows with your public key, using Putty & Winscp. In addition, we wil...
  • Japan's largest solar and wind power project breaks ground
    Seven Japanese companies have been celebrating the ground breaking of their solar and wind power project at a ceremony held today at the ...
  • How to Recover a Deleted File
    It’s happened to most of us. You delete a file and realize you need it back. This guide will explain when you can get that file back and how...

Categories

  • 3 D printers
  • 360s
  • amazon
  • android
  • animation
  • apple
  • bing
  • book
  • boxee
  • browser
  • china
  • chrome
  • console
  • dicaprio
  • domain
  • ecommerce
  • facebook
  • ferrari
  • finland
  • gadget
  • galaxy
  • games
  • gmail
  • google
  • hosting
  • HTC
  • internet
  • ipad
  • iphone
  • iphoto
  • iwatch
  • japan
  • keyborad
  • lenovo
  • linux
  • lunar
  • microsoft
  • mobile
  • moon
  • movil
  • ms
  • names
  • new tech
  • Nokia
  • online
  • password
  • pc
  • phone
  • retails
  • samsung
  • search
  • smartphone
  • software
  • space
  • tablet
  • tech
  • text messages
  • track
  • trip
  • usres
  • web
  • whatsapp
  • whois
  • window
  • words
  • xbox

Blog Archive

  • ►  2013 (160)
    • ►  December (1)
    • ►  November (9)
    • ►  September (5)
    • ►  August (8)
    • ►  July (19)
    • ►  June (12)
    • ►  May (23)
    • ►  April (3)
    • ►  March (5)
    • ►  February (18)
    • ►  January (57)
  • ▼  2012 (340)
    • ►  December (25)
    • ►  November (34)
    • ►  October (24)
    • ►  September (27)
    • ►  August (26)
    • ►  July (46)
    • ►  June (83)
    • ►  May (42)
    • ▼  April (33)
      • facebook filed charges against yahoo
      • CISPA bill,:Internet company to handle all your da...
      • Do Cell Phone Causes Cancer
      • Samsung sued over Facebook app
      • Facebook new measures to protect its millions User
      • Facebook is set to become the biggest country in t...
      • A 26years Englishboy hacked facebook and stole fa...
      • sense of direction
      • How To Speed Up Safari browser
      • Online Video Game Grows on the
      • Apple has make new profit as iPhone-iPad sales inc...
      • IPhone 5
      • success vitamins
      • quotes of the day
      • words for motivation
      • Hip-Hop's Wealthiest Artists of 2012
      • Variety Browsers for Your Android Device
      • What would Facebook look like if it had been inven...
      • How To Use the Restore Partition to Break Into a M...
      • How to Back Up Your Linux System With Back In Time
      • How to Use the File History Feature in Windows 8 t...
      • Arthur C. Clarke: The Man who Predicted and Descr...
      • how linux is built
      • Starting Windows 8 with Zero Memory Usage
      • Stress Test the Hard Drives in Your PC or Server
      • How to Multitask in the Linux Terminal: 3 Ways to ...
      • Tweak: the New Multi-Monitor Taskbar in Windows 8
      • How to Lock Down Your Multi-User Computer
      • How to Disable Application Switching in Windows 8
      • computer&Startup:The 10-Minute Website Builder
      • computer&Economics: Argentina Nationalised its Oil
      • wisdom today
      • wisdoms of Life for your living
Powered by Blogger.

About Me

Unknown
View my complete profile