Calling people versed in Linux

Q&A, advice, reviews, and news about the computers, phones, TVs, stereos, and pretty much anything else that can't be easily whittled out of a stick or chipped out of stone.
User avatar
FireAza
Redshirt
Posts: 12806
Joined: Fri Feb 14, 2003 10:59 am
Gender: Male
Location: Hasuda City, Japan
Contact:

Calling people versed in Linux

Post by FireAza » Sun Nov 20, 2005 9:40 pm

Can someone who knows a thing or two about Linux help me with the following:
What similarities are there between Linux and DOS with regards to redirection and pipes?

What do the following commands do? "Cd /ect/re.d/rc0.d" and "Find . -name "K??*" -print | more"

Good and bad points about the Linux VI editor? What other editors are available?

Thanks!
Image
"For AUS$300, you get FireAza drawing your screen image." -MartinBlank "Oh shit. For once, FireAza is right." -Deacon
"FireAza, if you're really that sneaky and quiet then you can sleep in my bed anytime, mister." -kizba

User avatar
Deacon
Shining Adonis
Posts: 44234
Joined: Wed Jul 30, 2003 3:00 pm
Gender: Male
Location: Lakehills, TX

Post by Deacon » Sun Nov 20, 2005 9:49 pm

vi?? I hate it. Use nano or pico for editing configs until you get your GUI up and running.
The follies which a man regrets the most in his life are those which he didn't commit when he had the opportunity. - Helen Rowland, A Guide to Men, 1922

workmad3
Redshirt
Posts: 614
Joined: Mon Aug 22, 2005 6:51 pm

Post by workmad3 » Sun Nov 20, 2005 9:50 pm

good points in vi, you can do whatever you want. bad points, yau can do whatever you want, and its commands suck big time. the cd /etc.. command is a standard change directory cammond, starting from root(/). the find . -name "K??*" -print | more will, I believe, find in the current directory(.) files with a name beginning with a capital K with at least two more characters(??) followed by any characters(*). It will print out the output, and the _more will redirect the output to the program 'more' which is a basic text viewer. probably better to use less, as that allows better scrolling.

other editors depend on distro and type of install. you probably have nano, pico or some varient, which allow a bit more of an intuitive text editing(no insert modes etc., slightly easier to save and so on) and probably emacs as well. If you are using a desktop environment like KDE or gnome, you should have kedit, gedit or nedit, which are like(but much better than) windows notepad for editing in a windows environment.

hope that helps, also for how to use commands and such, there is always the man function. just type in man followed by the cammond (or with -k to do a search) and you get a normally fairly informative page of information
I'm still an atheist, thank god.
Christianity: The belief in an invisible santa
RLHLC
Image

User avatar
FireAza
Redshirt
Posts: 12806
Joined: Fri Feb 14, 2003 10:59 am
Gender: Male
Location: Hasuda City, Japan
Contact:

Post by FireAza » Sun Nov 20, 2005 9:56 pm

good points in vi, you can do whatever you want. bad points, yau can do whatever you want
It's good point is it's bad point? Do you mean, like, that because you can do anything, it's easy to break something? Thanks for everything else though!
Image
"For AUS$300, you get FireAza drawing your screen image." -MartinBlank "Oh shit. For once, FireAza is right." -Deacon
"FireAza, if you're really that sneaky and quiet then you can sleep in my bed anytime, mister." -kizba

User avatar
Spongiform
Redshirt
Posts: 3220
Joined: Sun Aug 22, 2004 11:18 pm
Gender: Male
Location: Jersey

Post by Spongiform » Sun Nov 20, 2005 10:16 pm

My friend was doing stuff in root and talking to someone he knew on the phone - His friend told him to type in (I don't remember exactly) something along the lines of rm-rf/.... he did, and linux deleted everything on both his hard disks. He flipped out and his friend was laughing hysterically.

User avatar
Deacon
Shining Adonis
Posts: 44234
Joined: Wed Jul 30, 2003 3:00 pm
Gender: Male
Location: Lakehills, TX

Post by Deacon » Sun Nov 20, 2005 10:20 pm

Spongiform, yes, that reminiscent of the ol' "type 'format c: /y'!! haha!" or, more accurately, using deltree and such.

rm -rf is the command to force the recursive removal of all files and folders under a certain starting point, in this case /, or root (much like c:\ would be).
The follies which a man regrets the most in his life are those which he didn't commit when he had the opportunity. - Helen Rowland, A Guide to Men, 1922

User avatar
Martin Blank
Knower of Things
Knower of Things
Posts: 12709
Joined: Fri Feb 07, 2003 4:11 am
Real Name: Jarrod Frates
Gender: Male
Location: Dallas, TX
Contact:

Post by Martin Blank » Mon Nov 21, 2005 3:00 am

[quote="FireAza";p="564779"]
good points in vi, you can do whatever you want. bad points, yau can do whatever you want
It's good point is it's bad point? Do you mean, like, that because you can do anything, it's easy to break something? Thanks for everything else though![/quote]
If you're going to get into Linux, it's a really, really good idea to learn either vi or emacs, as you'll almost always find one or the other on a Linux distro, and nano/pico aren't always available. Because I don't like people committing suicide, I recommend vi.

If you're going to go down this road, I highly recommend getting a cheat-sheet until you're familiar with it. (I've been using vi for three years and I still need cheat-sheets for some things.) Here are some of the more useful ones (all are PDFs, so consider yourself warned).

http://www.kcomputing.com/kcvi.pdf (Best for beginners, the non-Unix people at work love this)

http://www.cs.uidaho.edu/~rinker/ed03.pdf (More comprehensive, less organized)

http://www.ensyncsolutions.com/library/ ... _sheet.pdf (Similar to last, but more readable)

http://ploug.eu.org/doc/l-vi-a4.pdf (Tutorial cheat sheet)
If I show up at your door, chances are you did something to bring me there.

User avatar
Deacon
Shining Adonis
Posts: 44234
Joined: Wed Jul 30, 2003 3:00 pm
Gender: Male
Location: Lakehills, TX

Post by Deacon » Mon Nov 21, 2005 3:23 am

[quote="Martin Blank";p="564852"]Because I don't like people committing suicide, I recommend vi.[/quote]
You prefer for them to starve to death, tangled in a web of lies, lost in a maze of ridiculous commands, drowning in a horrible quicksand of anti-intuitiveness?
The follies which a man regrets the most in his life are those which he didn't commit when he had the opportunity. - Helen Rowland, A Guide to Men, 1922

workmad3
Redshirt
Posts: 614
Joined: Mon Aug 22, 2005 6:51 pm

Post by workmad3 » Mon Nov 21, 2005 9:01 am

im pretty much the same with vi. Hate hate hate it. I taught myself how to use emacs(i was bored at work. VERY bored). And I can do some basic editing in vi, with a great deal of struggling.

And fireaza, that is exactly the point. With programs that let you do anything you want, it is very very easy to break something. Admittedly, that quote is more commonly applied to sendmail(do not look at its config files if you value your sanity) and such.

Also, on a comparison of emacs and vi. vi can do everything except make the coffee. Emacs can even do that.

So yeah. possibly learn emacs or vi at some point. but start off with something that wont leave you screaming and running in the opposite direction, like pico or nano. Also, avoid logging in as the root user as much as possible, as then you won't be able to run commands like rm -rf / (root user again is blessed and cursed with the ability to do anything and everything it wants... generally without linux complaining)
I'm still an atheist, thank god.
Christianity: The belief in an invisible santa
RLHLC
Image

User avatar
FireAza
Redshirt
Posts: 12806
Joined: Fri Feb 14, 2003 10:59 am
Gender: Male
Location: Hasuda City, Japan
Contact:

Post by FireAza » Mon Nov 21, 2005 10:48 am

Just for reference, I'm not planning to switch to Linux at home, but we're doing a lot of Linux-related stuff at collage, so there's some stuff I need to know. Also, does anyone know what similarities are there between Linux and DOS with regards to redirection and pipes?
Image
"For AUS$300, you get FireAza drawing your screen image." -MartinBlank "Oh shit. For once, FireAza is right." -Deacon
"FireAza, if you're really that sneaky and quiet then you can sleep in my bed anytime, mister." -kizba

User avatar
edge
Redshirt
Posts: 3376
Joined: Mon Jun 02, 2003 9:43 pm
Gender: Male
Location: Pittsburgh, PA
Contact:

Post by edge » Mon Nov 21, 2005 2:17 pm

[quote="Deacon";p="564775"]vi?? I hate it. Use nano or pico for editing configs until you get your GUI up and running.[/quote]

Agreed.

Momma always said vi was the debil!

It's a good idea to learn vi and be familliar with it (When I started this job, I regretted barely ever using it, as our unix systems only had vi, and in a time critical situation, going to download and install nano or pico was not an option).

It drives me absolutly insane though....no text editor should ever be so difficult to use.

Edit:

Redirection and pipes work *basically* the same in Linux. Piping a command to another basically feeds the output of one command to another. A rather common one might be: ps aux |grep emacs

That would give the process listing with the a, u, and x options, and pipe the output into grep, which would filter out any lines containing emacs.

Redirection is basically the same. You can use > to redirect output to a file, or you can use >> to append the output to a file.

If you have a file that already contains something, redirecting to it (>) would overwrite the contents of the file, where as appending (>>) would add to the end.

For example: echo "ls -la" > myscript.sh

Assuming myscript.sh doesn't exist, that file would be created, and the text ls -la would be put in it.

User avatar
Deacon
Shining Adonis
Posts: 44234
Joined: Wed Jul 30, 2003 3:00 pm
Gender: Male
Location: Lakehills, TX

Post by Deacon » Mon Nov 21, 2005 3:00 pm

And if myscript.sh did work, it would overwrite it, no? Whereas using ">>" would append to the end, yes?
The follies which a man regrets the most in his life are those which he didn't commit when he had the opportunity. - Helen Rowland, A Guide to Men, 1922

dmpotter
Redshirt
Posts: 4057
Joined: Tue Apr 01, 2003 7:10 pm
Location: Massachusetts, US
Contact:

Post by dmpotter » Mon Nov 21, 2005 3:29 pm

Correct, Deacon. ">>" will append to the end of the file if it exists or create it if it doesn't.

Essentially, everything that works in DOS regarding redirection ALSO works in Linux. Some things that work in Linux, however, won't work in DOS.

User avatar
edge
Redshirt
Posts: 3376
Joined: Mon Jun 02, 2003 9:43 pm
Gender: Male
Location: Pittsburgh, PA
Contact:

Post by edge » Mon Nov 21, 2005 3:52 pm

[quote="Deacon";p="564957"]And if myscript.sh did work, it would overwrite it, no? Whereas using ">>" would append to the end, yes?[/quote]

Exactly. If the file already exists and contain data, using > would overwrite it completely (so instead of what was in there before, you'd just have whatever was redirected to it, ls -la, in this example).

And >> would ofcourse just add to what's already in that file.

So if the file didn't already exist, you could do:

echo "ls -la" > myscript.sh
echo "echo Directory Listing complete" >> myscript.sh

You would end up with this in the file myscript.sh:

ls -la
echo Directory Listing complete

DOS works the same way.

User avatar
FireAza
Redshirt
Posts: 12806
Joined: Fri Feb 14, 2003 10:59 am
Gender: Male
Location: Hasuda City, Japan
Contact:

Re: Calling people versed in Linux

Post by FireAza » Mon Nov 21, 2005 10:40 pm

Ah, thanks for that edge.
Image
"For AUS$300, you get FireAza drawing your screen image." -MartinBlank "Oh shit. For once, FireAza is right." -Deacon
"FireAza, if you're really that sneaky and quiet then you can sleep in my bed anytime, mister." -kizba

Locked

Who is online

Users browsing this forum: No registered users and 1 guest