A Beginner's Guide to the Linux Command Line

HardOCP News

[H] News
Joined
Dec 31, 1969
Messages
0
The crew at TechSpot have put together a beginner's guide to the Linux command line that is rather useful for those of you using Linux.

Do you think of the command line as an antiquated leftover from the past, or an old fashioned way of interacting with a computer? Think again. In Linux, it is the most flexible and powerful way to perform tasks. In this article, we will explore the basics of the Linux command line, including directory navigation, file/directory operations, and more.
 
On linux or windows I am not sure how I would function without the shell/command line. Its a rare occasion when on either that I do not have at least a few console windows open.
 
It's called the terminal. "Command line" is more DOS/Windows speak.

Well, if they learn to swim... swell.
Might be easier to simply keep them away from the technical bits. Make it all "blue boxes" with "green connecting lines"... click-'n-drag.
 
It's called the terminal. "Command line" is more DOS/Windows speak.

Don't be nitpicky. If Linux is gonna take off, people jumping into it are gonna want familiar terms as they ease into the different OS and get out from under Microsoft's OSes. It's okay if they're calling something a command line, a terminal, or a foogoo fish as long as they're getting comfy with using it and not growled at by the existing community. Help with hugs, not spankings.
 
What greatly improved my skills in CLI was setting up and configuring a Xen server for some software of ours which requires direct access (PCIe pass-through) to the video card.
 
Don't be nitpicky. If Linux is gonna take off,

Linux people don't want linux to take of. If so they would have implemented install wizards forever ago. I know I know, default repositories makes it easy! blah blah blah.

Fact is if linux used install wizards it would could be close enough to windows for non tech people to use without much hassle.
 
It's called the terminal. "Command line" is more DOS/Windows speak.

In the Linux class I took (focused on SuSe), the instructor and textbook referred to terminal as the default program which allows access to the CLI (Command Line Interface)
This is the textbook we used Getting Started With Linux

about the author.
Jason W. Eckert is an experienced technical trainer, consultant and best-selling author in the Information Technology (IT) industry. With over 20 IT certifications, 20 years of IT experience, and 18 published textbooks covering topics such as UNIX, Linux, Apache, MySQL, Windows Server, Security, Microsoft Exchange, and BlackBerry Enterprise Server, Mr. Eckert brings his expertise to every class that he teaches at triOS College. He is also the triOS College Technology Faculty Head, where he continues to refine and improve college technology programs.

You have every right to contact him or the publisher to claim that they got it all wrong.
 
As an Amazon Associate, HardForum may earn from qualifying purchases.
Linux people don't want linux to take of. If so they would have implemented install wizards forever ago. I know I know, default repositories makes it easy! blah blah blah.

Fact is if linux used install wizards it would could be close enough to windows for non tech people to use without much hassle.

I agree that there are some people in the Linux community that want to keep their playground private, but I don't at all think that's true of everyone. It seems like the larger majority are really happy about the idea of Linux becoming more widespread and there are corporate interests working in that direction as well.

You are right though. Installing things outside of the package tools that figure out dependencies for you can be kinda a pain. For instance, it took me a lot of messing around and trial and error before I could get my printer to work with Mint. Install instructions on the manufacturer's website didn't factor in a missing thing I should have had already and it was sorta time consuming to figure out what was missing as the drivers installed just fine without caring that something more fundamental wasn't there, but the printer just didn't work. I messed with it for like a good hour (maybe a little more) before I finally got it to print things.
 
In the Linux class I took (focused on SuSe), the instructor and textbook referred to terminal as the default program which allows access to the CLI (Command Line Interface)
This is the textbook we used Getting Started With Linux

about the author.
Jason W. Eckert is an experienced technical trainer, consultant and best-selling author in the Information Technology (IT) industry. With over 20 IT certifications, 20 years of IT experience, and 18 published textbooks covering topics such as UNIX, Linux, Apache, MySQL, Windows Server, Security, Microsoft Exchange, and BlackBerry Enterprise Server, Mr. Eckert brings his expertise to every class that he teaches at triOS College.

The "human" interfaces via the keyboard and terminal. The terminal forwards commands to the CLI.

I'll send a note to Mr. Eckert to insure the correction gets into the "errata" (corrections).

:D

P.S. And... yes I did go over to my old-dusty library and reference an actual book (yes - the real thing printed with paper and ink). I'm not saying its copyright date 'cause it makes me feel sooooo old.
 
As an Amazon Associate, HardForum may earn from qualifying purchases.
Don't be nitpicky. If Linux is gonna take off, people jumping into it are gonna want familiar terms as they ease into the different OS and get out from under Microsoft's OSes. It's okay if they're calling something a command line, a terminal, or a foogoo fish as long as they're getting comfy with using it and not growled at by the existing community. Help with hugs, not spankings.

I agree...if Linux is to gain more notoriety, it needs to be easier to use for the average user.

Linux people don't want linux to take of. If so they would have implemented install wizards forever ago. I know I know, default repositories makes it easy! blah blah blah.

Fact is if linux used install wizards it would could be close enough to windows for non tech people to use without much hassle.

I get that some Linux people want it to be their own playground, but there is always slackware - so go have fun with it I say. Besides if these folks want to be purists drop back to Unix where Linux came from.
 
In Linux, it is the most flexible and powerful way to perform tasks.

No, in Linux, the command line is the best way for elitist jerks to ensure they can never be fired, because so few people know how to use it. It is intentionally made more esoteric specifically to keep people away, not to make it more flexible or more powerful. Anything done on the Linux command line can be done in Windows with a gui, and in most cases, more. Ever set up a DHCP or DNS server in Linux? It takes days and constant terminal work to set up the init scripts and the databases. How about NAT routing? It's all terminal commands to configure it. In Windows, I can have a server set up with routing, DNS, and DHCP in a matter of 2 hours, from base OS install to working on all those levels.

Linux is pitiful. It's intentionally held back so elitists can show how "special" they are and demand more money. I can save a company thousands with Windows Server, a little more spent on software and a lot less spent on personnel to support it.
 
No, in Linux, the command line is the best way for elitist jerks to ensure they can never be fired, because so few people know how to use it. It is intentionally made more esoteric specifically to keep people away, not to make it more flexible or more powerful. Anything done on the Linux command line can be done in Windows with a gui, and in most cases, more. Ever set up a DHCP or DNS server in Linux? It takes days and constant terminal work to set up the init scripts and the databases. How about NAT routing? It's all terminal commands to configure it. In Windows, I can have a server set up with routing, DNS, and DHCP in a matter of 2 hours, from base OS install to working on all those levels.

Linux is pitiful. It's intentionally held back so elitists can show how "special" they are and demand more money. I can save a company thousands with Windows Server, a little more spent on software and a lot less spent on personnel to support it.

Um...PowerShell and Server Core along with scripting out routine or repetitive tasks are really prominent in Windows Server administration nowadays. I'm not saying you're wrong when you say anything in Windows can be done via the GUI (well most things, but there are exceptions) but I'd hate to not have scripts and a CLI available on a Windows-based enterprise.
 
I get that some Linux people want it to be their own playground, but there is always slackware - so go have fun with it I say. Besides if these folks want to be purists drop back to Unix where Linux came from.

I'm an admin in a server software test lab, and I frequently have to help testers set things up or get a "driver" system up and running after a problem. I have, unfortunately, had to work with terminals in Linux, Solaris 10 and 11 (I swear this was designed by chimps throwing their leavings at walls,) HP-UX (I steadfastly believe Satan was the lead developer on this one,) and AIX (The guys behind this are lazy and totally incompetent, but at least they weren't actually trying to be evil, unlike HP.) Believe me, I have seen the worst of what engineers bring to the table. I am so thankful someone like Microsoft is out there actually looking after the users and how they work with things rather than arcanist engineering.
 
Um...PowerShell and Server Core along with scripting out routine or repetitive tasks are really prominent in Windows Server administration nowadays. I'm not saying you're wrong when you say anything in Windows can be done via the GUI (well most things, but there are exceptions) but I'd hate to not have scripts and a CLI available on a Windows-based enterprise.

Yeah, I've seen it, and worked with it. I built a replacement DNS server using it. I had over 4000 DNS entries I had to move over from a 9 year old 32-bit Linux box. That is one place where scripting saved me a ton of work. I don't knock it when it is useful. Also, much of Windows scripting actually uses commands that make sense. (Seriously, "touch" to create a file?? "ls" to list directory contents?? Who made these things up? "find" sort of makes sense, but the way the command is used it totally inconsistent with other things in Linux.)

However, much of it is pushed by the same attitude that is keeping Linux in the command line world, and keeping software that actually makes things easy to work with out of Linux. Did you know RHEL5 had a gui for the DNS server, and they took it out in version 6? These same guys are also pushing for "saving memory and CPU overhead" by pushing Microsoft to making the installer default to not having a gui. Guys who think like this should not be allowed in IT.

At least MS has made Server 2012 remote administration through gui a high priority. They recommend installing the version without a gui and then actually administering it remotely through a machine that uses the gui. This actually works pretty well in their Hyper-V server. I've been using it a lot lately.
 
In WIndows 8, you're spose to just remember where everything is or use a cheat sheet. Same as the good old DOS command line days. So this should be no problem.
 
Linux is pitiful. It's intentionally held back so elitists can show how "special" they are and demand more money. I can save a company thousands with Windows Server, a little more spent on software and a lot less spent on personnel to support it.

For a fun analogy, take the relationship between a car with a manual transmission and an automatic.

There is a huge element of control you absolutely cannot get with 99% of GUI functions. CLI scripting or high-level programming can do far more than a cursor manipulating icons on a screen. Beyond that, the wizard you use to setup DHCP is a higher-level setup with far, FAR more programming going on in the back-end to handle all that work for you. But SOMEONE had to program that wizard.

So, the people with deeper needs for a particular job or just more technical ability will naturally gravitate towards something that gives them more control. If that means they have to write their own code in assembly, they'll do it. If you don't give a damn about such a level of minutiae and it isn't required for the job at hand, a wizard is all you need.

At the end of the day, both sides get back home from work thanks to their cars. But along the way, the guy with the 6-speed manual had a lot more to say in HOW he got there (and a lot more fun) in the process.

If you're only caught up on the subset of assholes that think they're better than you because they can write a few bash scripts, then you need to re-evaluate your understanding of the platform.
 
I agree...if Linux is to gain more notoriety, it needs to be easier to use for the average user.

Yup, it does need some work still. I'm very happy with modern distros of Linux that are aimed at new users or at people who have "typical" desktop/laptop computing needs, but they're not at all perfect and there's still a lot of work that has to be done. I really wish I could help develop stuff like that, but I suck at programming. Intro to Programming was so painful to struggle through so I think coding improvements should be left to people better at that stuff. :)

Yeah, I've seen it, and worked with it. I built a replacement DNS server using it. I had over 4000 DNS entries I had to move over from a 9 year old 32-bit Linux box. That is one place where scripting saved me a ton of work. I don't knock it when it is useful. Also, much of Windows scripting actually uses commands that make sense. (Seriously, "touch" to create a file?? "ls" to list directory contents?? Who made these things up? "find" sort of makes sense, but the way the command is used it totally inconsistent with other things in Linux.)

However, much of it is pushed by the same attitude that is keeping Linux in the command line world, and keeping software that actually makes things easy to work with out of Linux. Did you know RHEL5 had a gui for the DNS server, and they took it out in version 6? These same guys are also pushing for "saving memory and CPU overhead" by pushing Microsoft to making the installer default to not having a gui. Guys who think like this should not be allowed in IT.

At least MS has made Server 2012 remote administration through gui a high priority. They recommend installing the version without a gui and then actually administering it remotely through a machine that uses the gui. This actually works pretty well in their Hyper-V server. I've been using it a lot lately.

It's really odd that they pulled the GUI DNS config tools out between versions in the name of performance when there's so little overhead associated with GUI tools compared to the amount of compute power we have available in current generation hardware. :( So yeah, people who are insisting on forcing CLI at the expense of making functions more accessible and a system more broadly useful are holding back the things they sometimes advocate as better.

I mean, I've got nothing at all against any sort of interface and I think that mixing the GUI and CLI in whatever way gets something done the best for the situation and person at the keyboard is really the way to go. Haha, I guess that means I swing both ways or something, but really why not just pick the right thingey to get what you wanna do done? What frustrates me a little is that people try to make the CLI and the GUI into mutually exclusive things that can't coexist together in a happy place where everyone roasts marshmallows over the same HVAC waste heat vents outside the data center.
 
For a fun analogy, take the relationship between a car with a manual transmission and an automatic.

There is a huge element of control you absolutely cannot get with 99% of GUI functions. CLI scripting or high-level programming can do far more than a cursor manipulating icons on a screen. Beyond that, the wizard you use to setup DHCP is a higher-level setup with far, FAR more programming going on in the back-end to handle all that work for you. But SOMEONE had to program that wizard.

So, the people with deeper needs for a particular job or just more technical ability will naturally gravitate towards something that gives them more control. If that means they have to write their own code in assembly, they'll do it. If you don't give a damn about such a level of minutiae and it isn't required for the job at hand, a wizard is all you need.

At the end of the day, both sides get back home from work thanks to their cars. But along the way, the guy with the 6-speed manual had a lot more to say in HOW he got there (and a lot more fun) in the process.

If you're only caught up on the subset of assholes that think they're better than you because they can write a few bash scripts, then you need to re-evaluate your understanding of the platform.

The way I think of it is this: the gui narrows down the path you take and what you can do, yes, but a gui can be written to do anything a command line can. That narrowing down actually helps, not hurts. It makes it so that a person doesn't have to remember specific commands (many of which don't make any sense in Unix or Linux, either in the command name itself or in the usage) and can just remember to open a specific gui element. Everything else just makes sense in a decently written gui. The data fields are labeled so you know what goes where. A single miskey doesn't force you to retype the whole command (this is rather specific to AIX and some text only, esoteric versions of Linux, but they do exist.) It brings logical grouping to the table, and people can just fill in blanks or select items from a list instead of having to type out the whole command with a specific order to the switches and specific formats for each.

If you want to change the IP address, you just open the gui for that specific function and change all the settings in one place, rather than using a command line to edit multiple files to change the IP and netmask in one place, DNS server in another, DNS domain in another, and gateway in another.

Setting up a DNS server is just telling the machine to load the role, then add the domain, then add the records, instead of having to go to a specific folder, writing the header and footer of a master file, making subdirectories for different child domains and reverse lookup domains, and then building an init file to tell the BIND server where to look for the domain files.

In my work with Linux, I am grateful for autocomplete, considering my typing skills and how often I mistype things, but that is too little to really make it easily usable.
 
At the end of the day, both sides get back home from work thanks to their cars. But along the way, the guy with the 6-speed manual had a lot more to say in HOW he got there (and a lot more fun) in the process.

Oh, and I forgot to mention, I do know how to drive a stick, and it cam be fun, but have you ever had to drive a stick in Chicago rush hour traffic? It downright hurts to let up on the clutch and hit the gas slightly to move forward another 5 feet on I-290 after doing it for an hour or so, just like it hurts to write a 16th reverse DNS lookup table after an hour of typing them up for a new server. A gui make the creation process so much easier on the fingers just like an automatic makes rush hour traffic so much easier on the legs and back. (That's the reason I will never own a stick again, despite moving away from Chicago to Denver. Denver traffic is easier, but I still don't want to relive the pain in my legs from that.)
 
Oh, and I forgot to mention, I do know how to drive a stick, and it cam be fun, but have you ever had to drive a stick in Chicago rush hour traffic? It downright hurts to let up on the clutch and hit the gas slightly to move forward another 5 feet on I-290 after doing it for an hour or so, just like it hurts to write a 16th reverse DNS lookup table after an hour of typing them up for a new server. A gui make the creation process so much easier on the fingers just like an automatic makes rush hour traffic so much easier on the legs and back. (That's the reason I will never own a stick again, despite moving away from Chicago to Denver. Denver traffic is easier, but I still don't want to relive the pain in my legs from that.)

Hah, my second car was a standard. I loved it at first. It got to be cumbersome though having to constantly keep a hand on the stick. I live in Dallas so 635 is our main traffic culprit. I can attest to poking along in a standard in heavy almost non moving traffic - what a pain.

I would agree Linus has it places and even more so that the CLI has it's place, but time is money. When something fails in the server room on a Linux box, I (or my administrator if I'm a manager) better to be able to get it back up and running as quickly as Microsoft support could help get a Server box up and running.
 
(Seriously, "touch" to create a file?? "ls" to list directory contents?? Who made these things up? "find" sort of makes sense, but the way the command is used it totally inconsistent with other things in Linux.)

Yea i just played with ubuntu for the first time, getting a webserver setup with nginx and wsgui. Talk about a pain, as i've never touched this stuff before.

Why do they have to name stuff so weird? lol
 
Don't be nitpicky. If Linux is gonna take off, people jumping into it are gonna want familiar terms as they ease into the different OS and get out from under Microsoft's OSes. It's okay if they're calling something a command line, a terminal, or a foogoo fish as long as they're getting comfy with using it and not growled at by the existing community. Help with hugs, not spankings.

This has been the Linux communities M.O. for some time now. Other than the Mint forums (which is a distro at least partially designed to ease the transition from Windows) most Linux forums have an ample supply of people ready to bite your head off for not having done enough research into a problem when it would have taken less effort to just provide the poor guy asking the question with the answer and a link to the documentation...

Also, the term "command line" is an acceptable term to refer to the command prompt in Windows, the terminal in Linux/Unix/OS X, or for things like managed routers/switches, etc. It simply denotes an interface where you are typing the commands in line by line as opposed to clicking buttons with your mouse...
 
This article just shows why Linux's Unix roots are making it difficult for Linux to take hold.

There really is no place at this time for geek commands like rm, grep, ls, pwd, ls, cat, touch, mv, rm, cp!

I've used Unix plenty and while the I used to love knowing at the commands and shit, it is time to move on. This also applie to naming variables i and j. WTF!
 
This article just shows why Linux's Unix roots are making it difficult for Linux to take hold.

There really is no place at this time for geek commands like rm, grep, ls, pwd, ls, cat, touch, mv, rm, cp!

I've used Unix plenty and while the I used to love knowing at the commands and shit, it is time to move on. This also applie to naming variables i and j. WTF!

not on the workstation i agree 100%. I think Linux is stupid to try to make mainstream workstation. That being said, and being a Linux user on the server side for 15 yrs, i couldnt imagine not having access to the CLI to manage clusters/servers/vms/etc/etc.
 
LOL. I can burn a CD or DVD from the command line much faster than you can fire up your app, click on stuff and arrange your burn.

Go in the dir wit the files and type 'burndir'. We are done.

It's true 'cdrecord -v dev=0,0,0 *.wav' is what burndir does but I am very lazy.

Stash a number from a whatever, bank etc:

echo "%$$^&*^" > name

We are done. It's often much faster to just type out the command than do the clicky thing.
 
original.0
 
I really like 17 using the Cinnamon desktop, I'm trying to learn it now for the second time.
 
I put my music in directories, one for each album. I play my music by surfing the Midnight Commander (recommended) to the dir, Ctrl-o, for a terminal in that dir and xmms . to play the dir.

It's just quicker. GUIs certainly make the whole thing easier but otherwise they are hardly an advance.
 
This article just shows why Linux's Unix roots are making it difficult for Linux to take hold.

There really is no place at this time for geek commands like rm, grep, ls, pwd, ls, cat, touch, mv, rm, cp!

I've used Unix plenty and while the I used to love knowing at the commands and shit, it is time to move on. This also applie to naming variables i and j. WTF!

Pretty much the above.

Do you think of the command line as an antiquated leftover from the past, or an old fashioned way of interacting with a computer? Think again.

If it's really a beginner's guide, there should be no need for a guide.
 
Oh, and I forgot to mention, I do know how to drive a stick, and it cam be fun, but have you ever had to drive a stick in Chicago rush hour traffic? It downright hurts to let up on the clutch and hit the gas slightly to move forward another 5 feet on I-290 after doing it for an hour or so, just like it hurts to write a 16th reverse DNS lookup table after an hour of typing them up for a new server. A gui make the creation process so much easier on the fingers just like an automatic makes rush hour traffic so much easier on the legs and back. (That's the reason I will never own a stick again, despite moving away from Chicago to Denver. Denver traffic is easier, but I still don't want to relive the pain in my legs from that.)

Far worse: Nashville traffic. That means plenty of small hills and less-organized streets, 3 different major interstates with at least four lanes each converging into a single location, bumper-to-bumper for miles. A native of just about anywhere can argue about idiotic drivers, but I have a hard time imagining drivers elsewhere in the country being worse. Except Atlanta, jesus.

And even then, stick every day. The control is an absolute necessity and even better in bumper to bumper because I can very quickly change from neutral to 1st and inch forward without having to touch the gas. Then when having to wait, I don't have to constantly push on a brake pedal because I just drop it back to neutral and hang out with the parking brake. Nothing happens that I don't want because all these different little parts require my direct input. I/O itself is simple and direct, even if there are more components for input. With automation, I/O becomes more ambiguous because you're never totally sure what's being done in the background. Something can (and will) be lost in translation.

One thing I also think you need to keep in mind is that GUIs are inherently harder to get 'right'. Command line, and especially the unforgiving CLI of UNIX and Linux are much easier to deal with than, say, pixel hunting a badly designed GUI or dealing with one that expects a nonexistent input method--SERVER 2012 I'M STARING AT YOU AND NUKING YOU FROM ORBIT. And that was from Microsoft with probably hundreds of millions spent on GUI R&D. With Linux you're lucky to have someone getting donations for their work.

The complaint about commands making sense, I'm sorry, just doesn't work... *NIX commands have been around far longer than anything DOS or P-Shell and make easily as much sense if not more. From one of your examples, ls (list) makes a much more sense than 'dir'. I understand being raised on DOS (I was) and when you think in a native language others with different constructs just don't make as much sense, which gives us fun translation errors between English and Chinese. But if you really want to talk about a confusing CLI, go play with DEC/VAX.

Beyond that, I can also type necessary commands and espouse (usually SQL at this point) logic via fingers into a keyboard without having to change input methods constantly or worrying about desktop space to move a mouse around. Hell, I can navigate Windows entirely without a mouse, period, and faster than worrying about clicking a big red X or hunting for something in the start menu. That's not to say a mouse is useless, but a keyboard is inherently more efficient because there is no 'travel time' for I/O, as in I don't have to move a cursor around and point it to a certain spot and far less visual I/O is required in that process in general.
 
Back
Top