Here's the deal with Linux Command Line. Nowadays, we're very close to the point where you don't need the command line at all to operate your typical desktop Linux distro, and some distros (SUSE, possibly Ubuntu) you may not need it at all. That's a very very good thing,
BUT...
My anecdotal experience is that, unless they're extremely motivated, most new users are going to need the command line to successfully migrate to Linux. Why? If you've never used the Linux command line, the answer may suprise you. The Linux command line gives you more control. The Linux Command Line saves you work. The Linux Command Line is fun. Ask around, and you'll find that for many of us, the Linux Command Line is a big reason why we love Linux. You may be assuming that we love the command line because we're freaks and mutants, but we're not only saving time, we're cutting through the most boring and awful tasks.
Detractors will tell you that Linux is a poor substitute for Windows, and it's true, just as it's true that a violin is poor substitute for a harmonica. If you try to use Linux as if it were Windows, you're not going to experience the advantages of the Linux Desktop -- and that's when the undeniable disadvantages are going to start to work on you. Most of the disadvantages with Linux have to do with support. No games, no commercial software, you have to install it and configure it and fix it yourself. And the end of all this work, most of the people who don't claim the real power of the Linux Desktop eventually drift back to Windows. The command line is a big part of that power.
The old GUI vs. Command Line controversies longer apply. The command line is now a part of the desktop. Learning the command line does not mean sacrificing the Graphic User interface, because the command line has been reshaped into a powerful, versatile desktop tool. The command line is integrated into the GUI in ways that allow the experienced user to move back and forth at will. This means that you don't have to use the Command Line for everything in order to use it. The user gets to decide which to use on a task by task basis, according to her abilities and mood. I keep a computer next to my bed, and so, sometimes, I choose which interface to use based on whether I'm sitting up or lying down. The choice is always mine, and that means that the command line is always the servant, never the master.
There are even some old school Linux gurus who don't get that the eighties are over, and the command line and the GUI are partners, not adversaries. These are the guys who boast that they don't own a mouse. That's actually kind of impressive, but the Command Line has plenty to offer mouse owners.
It's not that hard to learn. You don't memorize the commands; you just learn how to look them up, and resolve to use them. At first, it slows you down, but the important commands for interactive use are only a handful. Look it up twice, maybe three times, and you know it. And then it starts to speed you up. I haven't begun to explain how that works, but I hope to get to that.
To be continued
paj12
01-30-2008, 12:12 AM
One of the most useful features of the command line is the ability to automate repitive tasks. Since I run the testing branch of Debian, I upgrade my software evey day to recieve the latest bug fixes and security updates. To do this by clicking in a graphical interface requires about 5 minutes, which is not much. However, I've written a script that will do all this for me. I simply start the script and continue with my work while it runs in the background. Here it is:
#!/bin/bash
apt-get update ;
apt-get dist-upgrade ;
apt-get autoremove `deborphan --guess-all` ;
apt-get clean ;
exit 0
A power user of the command line may scoff at the lack of complexity in my script, but the fact of the matter is that this simple, six-line text file saves me five minutes every time I run it. Since I run it every day, it saves me more than 30 hours over the course of the year. This is what people mean when they say that the command line is powerful.
blackbelt_jones
01-30-2008, 01:08 AM
Oh my god, "Lack Of Complexity in My Scripts" is my middle name!
Actually, it's Ronald... but I love writing dumb scripts! Eventually, I'll learn how to write a script that isn't essentially a compound command, but those compound commands are a sweet time-saver.
Any command can be a script.
saikee
01-30-2008, 04:45 AM
If one uses the command line interface or the terminal one given the absolute control of the computer. This is especially true for those commands that require root privilege.
In the old days, say 25 to 35 years ago, there were such thing called the mainframe computer that serve the entire university of a company. Everybody is a user and the computer is controlled by the dedicated "operators". Only the operators were privileged to use the full command line interface as the graphic desktop has not been invented.
Thus the command line is the true power of the computer. The desktop is just a partial implementation of some of the command line interface.
I would go as far as saying if one uses only the desktop then one is not using at least the other half of Linux. This is especially true for distros that disallow a root login to the desktop (which can be changed if you know how to use the command line interface).
ph34r
01-30-2008, 09:23 AM
In my intro to Linux class that I teach I barely cover desktop use. We use Ubuntu desktops, but the class is focused on the command line. I figure that a GUI desktop is a GUI desktop and with few exceptions most folks with any computer experience can figure out basic use in a few minutes. Heck, I don't cover any part of the installation except for how to make the machines boot from CD and installing the specific printer in the classroom/lab...
JohnT
01-30-2008, 07:01 PM
I keep a computer next to my bed, and so, sometimes, I choose which interface to use based on whether I'm sitting up or lying down.
My imagination is running wild!!!!:p
folkert
01-30-2008, 07:51 PM
which interface to use based on whether I'm sitting up or lying down.
Wat software do you use to rotate teh command line 90 degrees?
I simply start the script and continue with my work
I have put the same commands in /etc/acpi/powerbtn-acpi-support.sh, and it happens automagicaly when I push the powerbutton to turn of the machine.
the Linux Command Line is a big reason why we love Linux
The true fun is that you can turn 30 minutes of repeating stupid actions in 25 minutes of scripting, to safe 5 minutes to enjoy your victory (or to document your script for future use:).
psych-major
01-31-2008, 02:21 PM
In the old days, say 25 to 35 years ago, there were such thing called the mainframe computer that serve the entire university of a company. Everybody is a user and the computer is controlled by the dedicated "operators". Only the operators were privileged to use the full command line interface as the graphic desktop has not been invented.The 'old days' to which you refer are still around. I got my start in IT 6 years ago as a mainframe operator, and nearly every financial institution, as well as a number of municipalities and some colleges still use mainframes.
At the user level, green screen serial-attached terminals have been replaced with cute web interfaces, but walk back to the operations center and you will still find command-capable operators with (emulated) green screen terminals running batch jobs outlined on a (paper) checklist.
The 'old days' are alive and well...
E1PHOTON
01-31-2008, 02:40 PM
I do a lot of work on internet2 routers and servers, and much to no surprise, it's all command line based. I have a pretty mactel that lets me open up a fancy looking, transparent terminal. But it's still just a terminal >:}
trilarian
02-01-2008, 12:13 PM
Guess I'll chime in...
In fairness, Winblows does have a scripting utility - remember good ole batch scripts? However, batch scripting is limited to basic file maniplation(copy, move, rename, etc.), basic logic structure(if [%_temp%]==[f] f: && set _pass=1), and automation of any programs that offer a command line run of its EXE file(Acrobat can be giving a /t switch to print a file without prompting the user).
Then there is the Linux command line... Putting aesthetics aside for now(yes, I love borderless, transparent shells too...), the major difference is that you can run uncompiled, high level code at the command line! And if you desire to compile some C code from the command line, its as simple as running gcc. M$ wishes for you to purchase a programming license from one of their programming language distributions to do the same thing. On top of that, you have to load up the design software and compile to an EXE before you can run the code. While this is not a big deal for a large program setup, it does kill the convenience of being able to type a one-liner command and see instant results like the Linux command line.
One more advantage that is often over looked, is the bin/sbin structure. Having all commands and program names in bin/sbin allows any user to type in the name or series of names of programs they want to start without navigating menus or cluttering your desktop with icons! This, for me at least, is huge. With windows, you have to either navigate a menu, create an icon, or type in the path to the EXE(or modify your path variable EVERY time you install a program). So if I want to browse the Internet, load and start playing my music, and update and install updates(in the background) all at the same time, I just type:
Oh, did I mention I love borderless, transparent shells? :D Old, but good example... 3435
blackbelt_jones
02-01-2008, 12:17 PM
This is all true about servers and whatnot, but I put this thread in the newbie corner for a reason, and it has more to do with the desktop.
First off, I wanted to make a point, which is this: nowadays, you don't need a lot of command line to run a linux desktop, but you do need the command line to fully understand what it is about Linux that turns its users into crazed fanboys. It took me two years to get around to learning the command line, but that was when I really get hooked into Linux for Linux. Before that time, I was running on pure Microsoft hate. When I learned the command line, it all made sense.
And to make a beginning with the command line was much easier than I ever expected. It took maybe a couple of hours.
Migrating to Linux was difficult for me. It was frustrating. You may want to give up. Don't don't give up until you've really used the command line, because until you have, you haven't really tried Linux.
Having made that point, I want to use this thread as a clearinghouse for information, and a place where newbies can ask questions.
psych-major
02-01-2008, 12:30 PM
So you never used the command line in Windows before you switched to Linux?
blackbelt_jones
02-01-2008, 06:58 PM
So you never used the command line in Windows before you switched to Linux?
Almost never, frankly. Like most Windows users.
I know that Windows has a command line, but I''ve read that the Linux command line can do more. In fact, I think I read it most recently in this very thread. Above all, based on my experience, I don't believe that the Windows Desktop GUI has been integrated with the CLI, the way that the most Linux Desktop GUIs have been. I'm talking about things like the way you can open Konsole to the pwd from Konqueror, and the way you can program line commands into desktop launchers and even key bindings with some Desktop environments and Window Managers.
I believe that the command line is the special strength of the Linux desktop, and if it's not true, someone should tell me so that I can stop going around saying that.
trilarian
02-01-2008, 07:13 PM
Almost never, frankly. Like most Windows users.
Heh, and I remember a time when DOS 6.0 was the OS of kings... I still have to use windows at work(though I have a Debian box too :)) and keep a DOS window open at all times. The main difference, though, is that on the windows machine I keep the DOS window open because I move many files around all day and it is easier for me to type partials with wild cards( copy *.dbf c:\some\dir ) than to navigate with explorer. Then on the Debian box, I still use the GUI often, but almost every new task begins with me typing something into the command line instead of just for moving files.
Windows 98 was the last true DOS integrated system from M$. Since it hasn't really been updated in almost a decade and is emulated at best on modern machines, it simply can't compete.
blackbelt_jones
02-02-2008, 08:42 AM
Then there is the Linux command line... Putting aesthetics aside for now(yes, I love borderless, transparent shells too...), the major difference is that you can run uncompiled, high level code at the command line! And if you desire to compile some C code from the command line, its as simple as running gcc. M$ wishes for you to purchase a programming license from one of their programming language distributions to do the same thing. On top of that, you have to load up the design software and compile to an EXE before you can run the code. While this is not a big deal for a large program setup, it does kill the convenience of being able to type a one-liner command and see instant results like the Linux command line.
One more advantage that is often over looked, is the bin/sbin structure. Having all commands and program names in bin/sbin allows any user to type in the name or series of names of programs they want to start without navigating menus or cluttering your desktop with icons! This, for me at least, is huge. With windows, you have to either navigate a menu, create an icon, or type in the path to the EXE(or modify your path variable EVERY time you install a program). So if I want to browse the Internet, load and start playing my music, and update and install updates(in the background) all at the same time, I just type:
Oh, did I mention I love borderless, transparent shells? :D Old, but good example... 3435
It's starting to look like the newbie in this corner is me.
I don't know anything about programming languages, and your command baffles me. As I sometimes mention, I was almost 40 when I learned what a hard drive does (I'll be fifty next month) and I was the last person in my family (including both parents) to get an online Windows computer (I used a C64 in College.)
I almost never used the command line with Windows, but I've always believed that the Windows command line lacks the applications that the Linux command line has. For example, can I use the command line to operate Windows media player the way I can use it with mplayer? Running mplayer from the command line means that I can program a playlist to do things that a gui could never do. I can play one song three times, then a run through a playlist, then play all of my songs at random. I don't know why I'd want to do that, but it's just an example.
paj12
02-02-2008, 12:45 PM
It's starting to look like the newbie in this corner is me.
I don't know anything about programming languages, and your command baffles me.
It does exactly what trilarian said it does. It opens mozilla, starts amarok playing the specified playlist, and starts apt-get upgrading in the background. The ampersands serve the same role as a semicolon would, except the ampersand tells bash to start each command in the background, so they start simultaneously instead of waiting for each command to finish before the next one is started.
blackbelt_jones
02-02-2008, 02:25 PM
Well, anyways, servers and C programming languages aside, I started this thread in the newbie corner to talk about the Command Line from the point of view of a desktop nonguru such as myself. When it comes to Linux I am only an expert in what it's like to not be an expert-- but frankly, that's exactly the kind of expertise that most Linux documentation lacks.
For purposes of this discussion, I'm talking about the Desktop command line, not the big black console screen which, I'm told, used to be the only interface available for Linux. Now the command line is a window in the Linux desktop, and, ideally, that means that you only need to use it when it is to your advantage. No one is asking you to give up your familiar, and intuitive point and click. Certainly not me.
Sometimes, when I am processing files in the command line, I like to open a window with Konqueror to the present working directory, so I can see what I'm doing to the files in the command line represented graphically. Sup[pose, for example, I am renaming files. I type it here, and it pops up there, and I find that helpful.
Some old school Linux mutant-geeks will tell you that the Command Line is the superior tool, but not me. I'm here to tell you that two tools are better than one.
I'm going to start a list of reasons why an average desktop user would benefit from becoming familiar with the command line. I'm just going to keep adding to it until I run out of reasons. Please help me out if you like. This could take a few days, maybe a week.
blackbelt_jones
02-02-2008, 02:29 PM
It does exactly what trilarian said it does. It opens mozilla, starts amarok playing the specified playlist, and starts apt-get upgrading in the background. The ampersands serve the same role as a semicolon would, except the ampersand tells bash to start each command in the background, so they start simultaneously instead of waiting for each command to finish before the next one is started.
Woooo! Thanks for the explanation, especially about the whole ampersand thing, which I did not understand previously.:)
psych-major
02-02-2008, 04:14 PM
For example, can I use the command line to operate Windows media player the way I can use it with mplayer? Running mplayer from the command line means that I can program a playlist to do things that a gui could never do. I can play one song three times, then a run through a playlist, then play all of my songs at random. I don't know why I'd want to do that, but it's just an example.no, but it does mean that you can install the Windows version of mplayer and use it from the windows command line...
(some of us are forced to use Windows at work, you learn to make the most of it.
For purposes of this discussion, I'm talking about the Desktop command line, not the big black console screen which, I'm told, used to be the only interface available for Linux. Now the command line is a window in the Linux desktop, and, ideally, that means that you only need to use it when it is to your advantage.and the difference between the two would be...? The terminal in Linux/Unix IS the OS, the desktop terminal you refer to is nothing more than a window into it, the same terminal session you'd get if you were running from the cli alone. That is the very essence of what sets 'nix apart from Windows. The OS and the desktop are separate entities, whereas in Windows, "Internet explorer is an inegral part of the Operating System" The point being, with Windows, no GUI, no OS, with 'nix, the GUI is an add-on for convenience, but 100% optional for OS operation.
blackbelt_jones
02-02-2008, 07:52 PM
and the difference between the two would be...? The terminal in Linux/Unix IS the OS, the desktop terminal you refer to is nothing more than a window into it, the same terminal session you'd get if you were running from the cli alone. That is the very essence of what sets 'nix apart from Windows. The OS and the desktop are separate entities, whereas in Windows, "Internet explorer is an inegral part of the Operating System" The point being, with Windows, no GUI, no OS, with 'nix, the GUI is an add-on for convenience, but 100% optional for OS operation.
And this is why we have have such terrible documentation for new users.
This is the newbie's corner, and I am trying to explain the Linux Desktop to new users. There is a vast practical difference between the console and the desktop terminal from the perspective of the user. Above all, in order to use the command line, I don't have to use it for everything, which makes the command line a lot more approachable to someone trying to learn. That's the whole point I'm trying to make here.
Everything that you've said is literally true, (as far as I know) but you're looking at it from the perspective of the computer, which is what a programmer does. I'm trying to approach it from the perspective of the user... which we need a whole lot more of, imho.:p
retsaw
02-02-2008, 08:16 PM
The ampersands serve the same role as a semicolon would, except the ampersand tells bash to start each command in the background, so they start simultaneously instead of waiting for each command to finish before the next one is started.What you say is true for single ampersands, however the example referenced here uses double ampersands which wait for the command to complete and then execute the next command only if the previous command was completed successfully.
paj12
02-03-2008, 02:51 AM
What you say is true for single ampersands, however the example referenced here uses double ampersands which wait for the command to complete and then execute the next command only if the previous command was completed successfully.
A little experimentation bears this out. I didn't know there was a difference. Thanks for setting me straight. Of course, this raises another question in my mind: is there a difference between the semicolon and double ampersand, or do they have the same function?
mrrangerman43
02-03-2008, 08:40 AM
paj12
Of course, this raises another question in my mind: is there a difference between the semicolon and double ampersand, or do they have the same function?
Ok I'm going to step out on a limb a little here, I'm just learning programming so I hope I understand this right. In the Bash shell when you are command chaining and use the semicolon you're just telling the shell where each command ends and the next begins. You're not asking for any errors or should I say non-errors, but if you use the double ampersands, you are telling the Bash shell Only perform the next command if a zero/ non-error has been returned. The Bash shell may fail to perform one of the commands in the command chain, will return a one/error and move on to the next command with the semicolon. But will not continue with the next command if an one/error is returned using the double ampersand.
I hope I'm understanding this right, if not someone please correct me.
retsaw
02-03-2008, 08:41 AM
Yes there is a difference. The semicolon executes the next command when the previous command exits regardless of outcome. The double ampersand only executes the next command if the previous command completed successfully. There is also the double pipe "||" which is the opposite of the double ampersand and it will execute the next command only if the previous command exits with an error.
blackbelt_jones
02-03-2008, 01:58 PM
Cool things about the command line for desktop users #1: Copy and Paste
When you see an elaborate command in a tutorial, it can be pretty intimidating for a new user, but here's the good news: In order to use it, you don't have to understand it. You don't have to type it. You just have to copy and paste it into the terminal window. This can actually make command line instructions easier to follow. GUI-based instructions devote a lot of time and space to telling you how to find the button.
Here (http://justlinux.com/forum/showthread.php?t=142299&highlight=avi) is an excellent tutorial on how to convert avi files into DVDs that was posted in this forum a couple of years back. I've made dozens of DVDs by this method, and I still don't fully understand the elaborate line commands given; I just copy and paste.
As a matter of fact, thanks to copy and paste, I was able to take these commands which I don't understand, and create a script that allowed me to automate the process of making DVDs out of avis. I could let the computer run overnight, and I could create as many as 12 DVDs at a time. Copy and paste is all it takes.
It's a good idea to keep commands that you might want to use later someplace where you can find them. I use the "notepad" in my yahoo webmail account.
E1PHOTON
02-03-2008, 06:17 PM
As blackbelt has mentioned, one can simply paste a command into the terminal. However, it pays to know what the commands are doing. If you blindly copy and paste commands, it can lead to disastrous outcomes.
blackbelt_jones
02-03-2008, 08:27 PM
As blackbelt has mentioned, one can simply paste a command into the terminal. However, it pays to know what the commands are doing. If you blindly copy and paste commands, it can lead to disastrous outcomes.
Of course, E1PHOTON is right. You don't need to know the meaning of every subcommand and every option, but you should have a general idea what the point is... or why would you be doing it?
Also, when you get a command from someone, be sure you can trust the source. There have been rare occurrences of malevolent (destructive) commands being posted in forums, particularly in the Ubuntu forums. Be especially wary of anything that requires root access.
Still, there are a lot of smart people in these forums, and a malicious command isn't going to stand very long. Look to see how long someone has been posting in a forum. If they're not brand new members, if they have a posting history, you can probably trust them. Some comments from long-time members is a good way to know that what you're reading has been vetted by someone who should know whehter or not it's safe. I think it says a lot about Linux security that pranksters can't hose your system with a virus. They have to trick you into doing it yourself! Not a very efficient way to cause trouble, eh?
psych-major
02-04-2008, 11:59 AM
It's a good idea to keep commands that you might want to use later someplace where you can find them. I use the "notepad" in my yahoo webmail account.I store mine in the 'up' arrow key in my desktop console...
trilarian
02-04-2008, 12:02 PM
Ok I'm going to step out on a limb a little here, I'm just learning programming so I hope I understand this right. In the Bash shell when you are command chaining and use the semicolon you're just telling the shell where each command ends and the next begins. You're not asking for any errors or should I say non-errors, but if you use the double ampersands, you are telling the Bash shell Only perform the next command if a zero/ non-error has been returned. The Bash shell may fail to perform one of the commands in the command chain, will return a one/error and move on to the next command with the semicolon. But will not continue with the next command if an one/error is returned using the double ampersand.
I hope I'm understanding this right, if not someone please correct me.
Yes, my use of && was intentional as I want the series of commands to STOP if there is an error. In that example, amarok and mozilla shouldn't have problems starting unless I have broke something. However, if they do fail to load I'd like to have all of the CPU cycles to work on fixing it(updates use up a lot of CPU power once the files are downloaded). Also, if the resync to the repository fails (apt-get update), then I don't want to initiate an upgrade (apt-get upgrade) until I fix the resync problem.
For purposes of this discussion, I'm talking about the Desktop command line, not the big black console screen which, I'm told, used to be the only interface available for Linux. Now the command line is a window in the Linux desktop, and, ideally, that means that you only need to use it when it is to your advantage. No one is asking you to give up your familiar, and intuitive point and click. Certainly not me.
So you don't like my borderless, transparent terminals???:mad:
Haha, yes I see your point to an extent as I have known many people to act similar to a deer in headlights at the very sight(or thought) of a pure 100% CLI screen. It should be pointed out that always start out where you are comfortable, but try something new once you have a good foundation. There is a reason, other than being a freak, that people like to use a full screen CLI. It may not be for you, or it may turn out to be the best thing you ever do - just don't avoid it like the plague because you are not familiar with it. Also, everything mentioned so far in this thread can be done from either a full screen terminal or a small GUI terminal - as they both are the same as far as capabilities(it's a matter of preference which Linux gives you a lot of).
Anyway, so getting back to the original purpose of this thread - make three little characters your best friend - man. It is short for manual(as in guide not non-auto), and will give you help on any command you need either a refresher on or new help. For example, the command ls gives a directory listing similar to windows dir command. If you wanted help on that command, type man ls to open the manual page for that command. Once you are done reading, pressing q will return you to the terminal.
Another good thing to remember is don't bother remembering full command names or paths(unless you desire to), as you can hit tab at any time to either auto-complete a command/path or see the available options that match what you have typed so far.
blackbelt_jones
02-04-2008, 12:46 PM
I store mine in the 'up' arrow key in my desktop console...
But if it's something you haven't used in a while, don't you have to go through a hundred and fifty more recent commands to get to it?
These days I also use knotes to keep track of this information short term, but putting it in my yahoo account means that I can access it from my other machine, or if I decided to reinstall, or to try an other distro.
But the up arrow is also useful, and you may know ways of using it that I am not aware of.
I have a friend who was complaining recently that "I'll never be able to memorize all those commands.", and my point is that you don't learn the command line my "memorizing" anything. You learn how to find the information, you learn how to keep the information handy, and then you use it. The handful of commands that you use everyday, you learn them automatically before you realize it, no problem. And the rest you keep handy.
blackbelt_jones
02-04-2008, 12:47 PM
Haha, yes I see your point to an extent as I have known many people to act similar to a deer in headlights at the very sight(or thought) of a pure 100% CLI screen. It should be pointed out that always start out where you are comfortable, but try something new once you have a good foundation. There is a reason, other than being a freak, that people like to use a full screen CLI. It may not be for you, or it may turn out to be the best thing you ever do - just don't avoid it like the plague because you are not familiar with it.
Yes, you're right. That should be pointed out. Thanks for that.
Now that I'm familiar with it, I use the full-screen console myself from time to time. I always configure my Debian machine to bypass the desktop manager and open directly at the console, like Slackware does by default, and then I start the desktop gui by typing startx. In particular, I like to use it to run certain long-term processes (e.g., Folding at Home) below the desktop. Sometimes it's just nice, and simple, and needless to say it's really really fast, and great on old machines. I'd like to get a really old, really cheap cheap laptop sometime, install Slackware, run emacs from the console, and just use it as a portable word processor and, in the most literal sense, as a "notebook".
It's wonderful to have the console as an option. It's just not what I'm talking about here, and it's probably not the best place to start for a new Linux user on his own. Basically, I'm thinking of myself five years ago, and what would have prevented me from taking two years getting around to trying the command line. What took me so long was two things: I thought that it was much harder than it was, and I didn't understand how useful it would eventually be. And so I'm listing the arguments one by one.
psych-major
02-04-2008, 12:53 PM
On that note, it's nice to make "scripts" out of the commands. Using your avi-dvd example, you could paste the command into script and save it as avi-dvd.sh and then just change the input/output names at run time.
On a side note, for that particular activity, check out the program devede...
blackbelt_jones
02-04-2008, 04:32 PM
So you don't like my borderless, transparent terminals???:mad:
I do, actually.
Anyway, so getting back to the original purpose of this thread - make three little characters your best friend - man. It is short for manual(as in guide not non-auto), and will give you help on any command you need either a refresher on or new help. For example, the command ls gives a directory listing similar to windows dir command. If you wanted help on that command, type man ls to open the manual page for that command. Once you are done reading, pressing q will return you to the terminal.
And that brings me to:
Desktop Command Line Fact #2: How to read a manpage.
You have to learn how to use the command line, and it looks archaic to the uninitiated. But it's not. Your BASH shell is the product of almost 40 years of Unix development, all of it geared toward the refinement of convenience and power. You have to learn how to use it, but when you do, you'll be amazed at just how well thought out it's features are. Compared to the GUI, it's hard to learn, but easy to live with.
The manpage is a great example. Trilarian has told you how to open and close the manpage, now I'm going to tell you how to read it. The manpage is always right there. You don't need a book. You don't need an internet connection. If you have the command in your system, you almost always have the manpage.
You don't read a manpage like it's a piece of English prose. You read it like it's a map. It's a map of your command, which options allows the user to literally get the information (s)he needs in just a glance.
Most manpages is come in three parts.
1.
NAME - what the command is, and what it does.
cp - copy files and directories
2. SYNOPSIS - This is the "map" part of the man page. It's the map of the command syntax. This tells you how the command works, where all the options and arguments go.
cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...
3. DESCRIPTION - This is the "key" to the "map". It tells you what the possible options are, and what they mean.
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.
-a, --archive
same as -dpR
--backup[=CONTROL]
make a backup of each existing destination file
-b like --backup but does not accept an argument
--copy-contents
copy contents of special files when recursive
-d same as --no-dereference --preserve=link
-f, --force
if an existing destination file cannot be opened, remove it and try again
-i, --interactive
prompt before overwrite
-H follow command-line symbolic links
-l, --link
link files instead of copying
-L, --dereference
always follow symbolic links
after some practice, when I need to know how to use a command, I know enough to try the manpage first. Once again, it's all about convenience and power.
-P, --no-dereference
never follow symbolic links
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: links, all
...and so on (there's a lot of options for this particular command..)
After I'd had some experience reading manpages, I came to admire their structure, which usually allows me to find exactly the information I need to proceed, with the absolute minumum of reading... and that is the name of the game! Now, not every manpage is well put together, and sometimes a command is complex enough that I need some examples to help me understand. That's when I need to try other resources like this this (http://www.oreillynet.com/linux/cmd/), which is a list of commands from O'Reilly's but I always try the manpage first. Eighty to ninety per cent to the time, the manpage is going to give me the answer that I need, and fast. I scroll down the page, I find the option that I want, go to the synopsis, see where to put in relation to the command... and I am out of there, sometimes in less than a minute. That is convenience and power.
If I can't find the answer right away, I move on to the next resource, usually the link supplied above, without stopping to think about it.
NOTE: This needs considerable rewriting. But I need to do some housework.
bwkaz
02-04-2008, 07:45 PM
But if it's something you haven't used in a while, don't you have to go through a hundred and fifty more recent commands to get to it? No, actually you don't. That's why readline (and therefore bash, since bash uses readline to do its command input) has a ctrl-r shortcut that does a reverse incremental search. :p
(In other words: Just hit ctrl-r, then start typing any part of the command you're looking for. The shell will show you the most recent command that matches the string you've typed in so far; you can keep typing, to add more characters to the search, or you can hit ctrl-r again to find the next most recent command that matches the string you've put in so far. Ctrl-r is a sort of "find next" type shortcut when you're in the "reverse-i-search" mode. Note that once you hit ctrl-r a second time, I don't believe you can add more characters to the search string.)
blackbelt_jones
02-04-2008, 10:58 PM
No, actually you don't. That's why readline (and therefore bash, since bash uses readline to do its command input) has a ctrl-r shortcut that does a reverse incremental search. :p
(In other words: Just hit ctrl-r, then start typing any part of the command you're looking for. The shell will show you the most recent command that matches the string you've typed in so far; you can keep typing, to add more characters to the search, or you can hit ctrl-r again to find the next most recent command that matches the string you've put in so far. Ctrl-r is a sort of "find next" type shortcut when you're in the "reverse-i-search" mode. Note that once you hit ctrl-r a second time, I don't believe you can add more characters to the search string.)
Well, hello there!
paj12
02-04-2008, 11:51 PM
The manpage is a great example. Trilarian has told you how to open and close the manpage, now I'm going to tell you how to read it. The manpage is always right there. You don't need a book. You don't need an internet connection. If you have the command in your system, you almost always have the manpage.
For beautifully formatted and hyperlinked man pages, open up Konqueror and type:
man:/ls
I find these easier on the eyes. It also helps that you can put them in tabs with your files, web pages, and other stuff.
retsaw
02-05-2008, 10:37 AM
Now you're on the subject of man pages, wouldn't it be useful to let people know how to search within a man page? Well, since man, typically uses "less" to display man pages you'll do the same way as you would if you wanted to search a file you were viewing with less. That is, a "/" followed by the pattern you want to search for and less will find the next occurrence of that pattern, to move on to the next match just press "n" or press "N" to go back to the previous match. For a more detailed description of the search options check out the man page for less ("man less").
mrrangerman43
02-05-2008, 11:58 AM
Originally Posted by blackbelt_jones
But if it's something you haven't used in a while, don't you have to go through a hundred and fifty more recent commands to get to it?
You can also type history | grep known part of command and grep will return a list of commands using the keyword given.
bwkaz
No, actually you don't. That's why readline (and therefore bash, since bash uses readline to do its command input) has a ctrl-r shortcut that does a reverse incremental search.
Thanks.
blackbelt_jones
02-10-2008, 01:21 PM
No, actually you don't. That's why readline (and therefore bash, since bash uses readline to do its command input) has a ctrl-r shortcut that does a reverse incremental search. :p
(In other words: Just hit ctrl-r, then start typing any part of the command you're looking for. The shell will show you the most recent command that matches the string you've typed in so far; you can keep typing, to add more characters to the search, or you can hit ctrl-r again to find the next most recent command that matches the string you've put in so far. Ctrl-r is a sort of "find next" type shortcut when you're in the "reverse-i-search" mode. Note that once you hit ctrl-r a second time, I don't believe you can add more characters to the search string.)
WoW! I didn't know about this, and this is HUGE!:) I have to start practicing this particular trick.
I didn't know about this, but it's a great example of what I was talking about when I said that 40 years of development have gone into making the command line as powerful and convenient as possible. It looks like the dumbest, most archaic interface ever, but enormous ingenuity has gone into it. When you really start practicing these tricks, and getting to use them, you see how well they work.
LAT
02-10-2008, 02:30 PM
This is a wonderful thread!
Thank you
blackbelt_jones
02-10-2008, 06:51 PM
You're welcome. I think the idea ought to be to put down all the basic command line information we can think of. It'll be a great resource, and I might use it as the basis of something a little more organized. I've always felt like I'd be a good person to write a nice short user-oriented book on the command line, because I came to linux with almost zero technical knowledge, and this gives me some insight into the newcomer. I like to think that I'm an expert on not being an expert. Unfortunately, there's still so much that I dont know, like readline, so this is a chance for me to vette my knowledge.
We should just write this stuff down in the order in which we think of it. Next thing I want to talk about is relative and absolute paths. Maybe after I clean up my apartment.
Does anybody have any questions about the command line?
geekthattweaks
02-14-2008, 04:40 PM
What is the context of the grep command? By context i mean how would you use it.
JohnT
02-14-2008, 05:32 PM
Given a list of files or standard input to read, grep searches for lines of text that match one or many regular expressions, and outputs only the matching lines.
There are various command line switches available when using grep that modify this default behavior including printing lines which do not match, finding or excluding files to search, and annotating the output in various ways. There are also multiple modern implementations of the classic Unix grep, each with a unique feature set.
crebeck25
02-16-2008, 09:47 PM
OK I've got the command line. I have some experience with DOS etc.
But how do I use it to allow myself to use my CD (media) to read and WRITE?
I know what I need to do, but need help in the details of creating a group, and permitting it!!
More so !! where can the information that will let me use Linux, be found
I am a would be Linux user, If I could use it. My ISO DVD comes from Linux Magazine,
apparently geared for a professional with more Linux know how.
blackbelt_jones
02-17-2008, 01:31 AM
OK I've got the command line. I have some experience with DOS etc.
But how do I use it to allow myself to use my CD (media) to read and WRITE?
I know what I need to do, but need help in the details of creating a group, and permitting it!!
More so !! where can the information that will let me use Linux, be found
I am a would be Linux user, If I could use it. My ISO DVD comes from Linux Magazine,
apparently geared for a professional with more Linux know how.
Can you name the distribution and release number? That would make it easier to help you.
If you have access to a high speed connection, you can download a different distro if you prefer. Or you can order disks very inexpensively. Here's a site where I got started five years ago with my first CDs
http://www.cheapbytes.com/
Please be patient with yourself. You seem completely disoriented right now. I'm not sure I understand the questions you're asking. You need to learn the language.
Do you know how to use IRC? There's a nice chat room where people who post here like to chat about nothing in particular, although it is a Linux chat. Just go there wait for someone to show up and and talk about whatever. Favorite topics include hocky and getting drunk. If you a pump a guru for info, he's going to resent it, but if you hang out long enough, he'll eventually just start talking and answering questions cause they LIVE for this stuff!
mrrangerman43
02-17-2008, 10:17 AM
crebeck25
Here are a few helpful links to get you going. RUTE (http://rute.2038bug.com/index.html.gz)
For linux searching Google/Linux (www.google.com/linux)
When I started out, I used to have a hard time finding things in google, because I lacked the context and the experience. If you can't find what you're looking for in google, sometimes it's a good idea to ask people to suggest a google search. That could save them a lot of time, and make it easier for them to help you get to the information you need quicker.
OldAstrologer
02-18-2008, 01:54 PM
As far as Google goes, I find there are three problems:
You seldom know how up-to-date the stuff is
You never know how reliable the poster is
You only find what you're looking for
I don't think you can beat buying a good book: you know who wrote it and when, and you find stuff that you not only didn't know, but that you didn't even know you needed to know.
On the command line, I love all those utilities that are only available there. Anyone who doesn't know them should check out wget, convert, units.
justlinux.com
Copyright Internet.com Inc. All Rights Reserved.