LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-20-2011, 02:58 AM   #1
Syllinger
LQ Newbie
 
Registered: Sep 2011
Posts: 22

Rep: Reputation: 1
How do I do other tasks in the background, and transfer files with a progress bar?


Hello Gents,

Alright, so first and foremost I figured out (kinda) how to trasnfer files using rsync, and it provides me with the progress of each file as it transfers. That said, is there any way to have some kind of overall progress indicator with an ETA on the entire transfer as well as a transferred bytes/total bytes read-out?

The other thing I realized is that in Windows I am able to do multiple tasks at once. How am I able to do this in Linux?

Note that I'm running Ubuntu Server LTS 10.04 and I have no GUI installed. I use Putty to SSH admin the system in a Win 7 environment.
 
Old 10-20-2011, 03:16 AM   #2
elliott678
Member
 
Registered: Mar 2005
Location: North Carolina
Distribution: Arch
Posts: 977

Rep: Reputation: 72
Since you're working in terminal only, look into screen, it allows multitasking in a single virtual terminal.
 
1 members found this post helpful.
Old 10-20-2011, 03:28 AM   #3
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
You can start a process to the background by using an ampersand after the command, and you can bring it to the foreground with "fg"

ie:
Code:
~ $ dd if=/dev/zero of=/dev/null&
[1] 12213
~ $ fg
dd if=/dev/zero of=/dev/null
^C14008853+0 records in
14008852+0 records out
7172532224 bytes (7.2 GB) copied, 9.07019 s, 791 MB/s
~ $
You can also start a job normally, and then pause it, with ctrl+z and send it to the background or foreground using "fg" and "bg"
ie:
Code:
~ $ dd if=/dev/zero of=/dev/null
^Z
[1]+  Stopped                 dd if=/dev/zero of=/dev/null
~ $ fg
dd if=/dev/zero of=/dev/null
^Z
[1]+  Stopped                 dd if=/dev/zero of=/dev/null
~ $ bg
[1]+ dd if=/dev/zero of=/dev/null &
~ $ fg
dd if=/dev/zero of=/dev/null
^C12032378+0 records in
12032377+0 records out
6160577024 bytes (6.2 GB) copied, 17.2294 s, 358 MB/s

~ $
Or you can create another ssh session with putty, and work away in the new session..
 
2 members found this post helpful.
Old 10-20-2011, 04:13 AM   #4
Syllinger
LQ Newbie
 
Registered: Sep 2011
Posts: 22

Original Poster
Rep: Reputation: 1
Ahh, perfect. Thank you for the quick response. Just looked up the man pages/O'reilly entry on Job Control. The problem is that I didn't know what it was called, I assumed there was some kind of Windows Task Manager tool.

Thanks again!
 
Old 10-20-2011, 04:15 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by fukawi1 View Post
Or you can create another ssh session with putty, and work away in the new session..
This is unnecessary. You can just use Screen, as elliott678 pointed out.
 
1 members found this post helpful.
Old 10-20-2011, 04:38 AM   #6
16pide
Member
 
Registered: Jan 2010
Posts: 418

Rep: Reputation: 83
I personally use gnome-terminal for my command line activity.
I use tabs to separate my activities.
With this I haven't needed background processes. But yes, &, bg, fg are your friends if you want to do that.
I don't use background processes much because it messes up the display (stdout of the background process messes display of whatever else you're doing in the shell. You could always redirect output to a file, but that's another story
 
Old 10-20-2011, 04:40 AM   #7
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Apologies, my earlier post should have added "if you want to view both outputs at once" in the sense of tailing log files while generating log entries (iptables + hping for example).

I wasn't aware if this was possible with screen or not..
 
Old 10-20-2011, 02:38 PM   #8
inoculos
Member
 
Registered: Apr 2009
Location: Seattle
Distribution: Arch, Crunchbang, Fedora
Posts: 38

Rep: Reputation: 6
there is a terminal called terminator. It is a very good multitasking terminal.


http://www.tenshu.net/p/terminator.html
 
Old 10-20-2011, 10:00 PM   #9
Syllinger
LQ Newbie
 
Registered: Sep 2011
Posts: 22

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Nylex View Post
This is unnecessary. You can just use Screen, as elliott678 pointed out.
Well, if I were logging directly into the server, I don't think it would be unnecessary. I would only have one command prompt, so I figure that using Job Managment would be useful in that instance.

Also, I don't understand how to use screen with Putty. It seems very complicated when compared to Job Managment, and it does the exact same thing. You are still able to monitor silence and output with Job Managment, or at least, that's what the man pages suggest.
 
Old 10-20-2011, 10:52 PM   #10
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Quote:
Originally Posted by Syllinger View Post
Well, if I were logging directly into the server, I don't think it would be unnecessary. I would only have one command prompt, so I figure that using Job Managment would be useful in that instance.
If by "directly" you mean, physically sitting at the machine, you can generally switch between console by pressing ctrl + F[1-8].
 
Old 10-21-2011, 02:12 AM   #11
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by Syllinger View Post
Also, I don't understand how to use screen with Putty. It seems very complicated when compared to Job Managment, and it does the exact same thing.
Screen has nothing to do with PuTTY. You just run "screen" at the command prompt. It isn't any more complicated than if you had a graphical terminal window with multiple tabs (or even a web browser with multiple tabs). Ctrl-a c will create new windows and you can cycle through them with Ctrl-a n (to go forwards) and Ctrl-a p (to go backwards). Each window has an associated number (starting from 0), so you can access it directly with Ctrl-a x, where x is the number. You can also get the list of windows with Ctrl-a ".

Last edited by Nylex; 10-21-2011 at 02:13 AM.
 
Old 10-21-2011, 02:39 AM   #12
Syllinger
LQ Newbie
 
Registered: Sep 2011
Posts: 22

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Nylex View Post
Screen has nothing to do with PuTTY. You just run "screen" at the command prompt. It isn't any more complicated than if you had a graphical terminal window with multiple tabs (or even a web browser with multiple tabs). Ctrl-a c will create new windows and you can cycle through them with Ctrl-a n (to go forwards) and Ctrl-a p (to go backwards). Each window has an associated number (starting from 0), so you can access it directly with Ctrl-a x, where x is the number. You can also get the list of windows with Ctrl-a ".
Well, that's a much better explanation than most of the man pages, and even guides, have given. Thanks.

Still, I'm always hearing about Linux security, and why would you want to install something like screen when you can simply use Job Management?

I'm not trying to be argumentative, I'm just saying that when it comes to Linux there are several ways to solve a problem, and you choose the one that you find the simplest and most convenient. Just trying to understand why someone would choose something like that over Job Management, which seems easy enough to use.

Still, I'll give screen a look. Definitely sounds promising, but it sounds like it would use a decent chunk of memory as well.

Thanks for the help guys. As always, it's very much appreciated.
 
Old 10-21-2011, 03:15 AM   #13
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I find the manual (on the GNU website, not the man page) for Screen quite good.

Your question is a sensible one. Say one of the things you wanted to do at the terminal was to log into another machine with ssh. You can't send Ctrl-Z to suspend the ssh process (so you can e.g. run "bg"), as it will be sent to the shell that's running remotely.

Another reason for using Screen is that you can detach your session. OK, this has nothing to do with job management, but it's a useful feature. Say you wanted to log into another machine and run some long running program there. If your connection to that machine dies, then your program may die too (I'm not sure exactly what determines whether it does or not. I did a quick (and very unscientific) test and a program I was running didn't die. Odd.). With Screen, detaching the session and logging out won't kill your program.

I'm sure there are other good reasons, too, but those are the (important) ones that I use Screen for.
 
1 members found this post helpful.
Old 10-21-2011, 03:47 AM   #14
Syllinger
LQ Newbie
 
Registered: Sep 2011
Posts: 22

Original Poster
Rep: Reputation: 1
So how do I try this out?

sudo apt-get install screen?

Or do I need to add any repos?

I'm using Ubuntu Server LTS 10.04.

Also, I still very much feel like a beginner when it comes to Linux. I'm sure there's a lot of use for it. I just find that amongst the server folk, adding additional (especially memory intensive) software packages is frowned upon.

There is really no reason to use best practices in my situation. But, it's always nice to know how to do something with a stock install, rather than relying on software tools.

I'm sure there are other applications for screen that will become readily apparent as I continue to dabble within the OS.

That said, you mentioned that you can't open a new SSH session using Job Managment, but there would be little reason if you are connected locally. Also, using Job Managment remotely, a SSH connection would already be established, you're just arranging which jobs are running in the foreground/background.

Still, I imagine things would get dicey if you were looking to log in as different users.

Last edited by Syllinger; 10-21-2011 at 03:57 AM.
 
Old 01-21-2012, 01:26 AM   #15
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Sorry, haven't been at LQ that much recently. Screen should be in the standard repository.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mv with progress bar gbowden Linux - General 28 08-14-2013 05:42 AM
cp progress bar edwardsiow Linux - General 26 09-04-2011 09:53 AM
Sony PSP file transfer inaccurate transfer progress stratotak Linux - Newbie 3 01-02-2010 04:49 AM
Is it possible to see a progress bar when I move files with the command line? baldurpet Linux - Software 2 01-22-2009 09:49 AM
Does evolution 2 have a progress bar on email transfer. Brian1 Linux - Software 0 12-09-2004 06:47 PM


All times are GMT -5. The time now is 02:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration