Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, February 26, 2013

Linux: The ‘|’ symbol


Hi Readers,

As many of the Linux users or to be precise UNIX users use combination of UNIX commands on shell to get a desired output. This is done by using ‘|’ symbol called as ‘PIPE’, but I am quite sure that most of you won’t know about this symbol and what it actually is and how it works. So let me tell you all what it is and what it does when you write some command like below-

ls –lrt | tail -3

The pipe symbol is an inter-process communication mechanism in UNIX which is known as ‘PIPE’. This pipe works only for inter process communication between two or more child process having a common parent process and not when there are two different parent processes for two child process separately. The basic functioning of pipe is shown in below diagram-
 
You need to remember that pipes are unidirectional in nature and therefore if one side (or descriptor) is taken for writing it will be fixed and other side is used for reading. When two different processes communicate that is to say parent process writes to pipe and child process reads from pipe then the diagrammatic representation is as below-


In the similar way the two way communication can be achieved where child also writes and parent reads but to achieve this you need to use two pipes, here one will not work. So the above diagram can be modified as below-
Now you are aware of communication using pipe and therefore there are two question which comes forth-
1-      How these UNIX command work using pipes?
2-      Since pipes does not work for two different parent process criteria then how this command actually gets executed?

So the answer for the first question is that when we write command like ls –lrt | tail -3, two separate process are created as you all may know that each command is created as a process. Here the two processes are P1=> ls –lrt and P2=> tail -3. So what happens is that output from P1 is stored in pipe which is read by P2 and P2 uses it as an input to its command and displays the output. Not only these two processes are present when this command is executed but also parent process is available which is called as ‘shell’. Since shell is common parent process the pipe works properly in this scenario and this answers the second question. To explain you the overall process below diagram will help-


Now I am sure that this may clarify your concepts on pipe and if you still have any queries, you are most welcome to ask them. I hope to receive your comments.

Thanks
Nakul

Monday, February 25, 2013

Linux: Downloading


Hi Readers,

Before I begin with anything, for your ease and proper navigation, I would let you all know that you can identify any topic on Linux by following the below syntax-
Linux: <topic_name>

Well the topic today we will discuss is on how to perform Download operation in Linux operating system. There are two kinds of downloading we perform-
  • Download using torrents
  • Direct downloading (means we download anything from a link available on website and not like we download a file and then again download using that file)
Download using Torrents

Like Windows has many torrent download applications in similar way Linux has application called as “Transmission”. You can try it for your Linux version whether its available or not. It works like uTorrent and supports mostly all features available in uTorrent.

Direct Downloading

This is a hard part since Linux lacks in download managers and mostly all available download managers for Linux are bunch of craps. If you are a windows user then you would know about IDM, FDM, and other download managers. Well Linux has nothing like this here and most download managers in Linux just claim resume support but none can do that as far as I have checked them. But there are few techniques to follow and get this resuming of task completed in Linux. You can try using command prompt in Linux and you can try a command called as “wget” in Linux.

Wget supports tons of features but the best one is how to use it for resuming a download. You only need to know one command always and that is “wget -c <download_link>”. Copy a download_link and paste it in the command line in the above format and press enter. If you have stopped the download and want to resume the download then run the same command again and you will see it resumes. Well there are also other functions of wget in accordance to internet and if you wish to learn it all then open your Linux command prompt and type “man wget” to know more.

There is one other type of downloading that you might be doing mostly and that is capturing online videos and songs. To get this thing done in Linux use “Mozilla Firefox” as your web browser and download a addon named as “Flashgot”. It is helpful in capturing online videos and songs. Once you have downloaded it, you would see it blinking on the status bar of your browser as soon as you open a webpage with videos, just click on the blinking icon and start the download you want and even you can chose the download manager for the download using flashgot. (Note:- This same task works for Mozilla Firefox on Windows Operating System).

Well I hope this downloading tutorial will help you all. You can send in your comments and suggestions or may be any question regarding this topic.

Thanks
Nakul