Code
Here is the code I'm suppose to type
ps ax / (see note) grep dnrd My question is the line between the ax and grep is actually a straight up and down line. How do I type it on the keyboard or does it mean type enter and then grep dnrd Thanks, Steve I typed the grep dnrd and nothing happens I type logout nothing happens how to I get out of this screen. As you probably figured out from the dnrd I'm having problem with DNS or at least I think I am. Once I type the ps ax how to i scroll up to see the rest of the items in the list? |
Like this:
Code:
ps ax|grep |
It should be a straight-up down line called "pipe". It lets you take output of one program and give it as input to another program.
Code:
ps ax | grep dnrd Quote:
Code:
ps ax | less Tux, |
You can scroll up with shift+pageup
|
it's a 'pipe' . its location varies depending on the keyboard. it's a shifted backslash on the keyboard i'm using now.looks like two dashes standing on end.
|
The vertical bar that you type is on the \| key (usually around the backspace key). It actually looks like two stacked bars on most US keyboards. When you see that in a commandline (ex: ls |fgrep jpg), what it tells the shell is to pipe the output (not the errors) from the first command, and feed them as input to the second command.
Here's another example. Say you want a sorted list of jpg files in your home directory (and all subdirectories below), sorted by directory/name: find ~ -name "*.jpg" |sort Now, let's assume you also want the file size (but not the date/time, owner, and permissions info): find ~ -name "*.jpg" -exec ls -lh {} \; | sort | awk '{print $5"\t" $9}' The first command, find looks in the current users home directory (~) for files that match *.jpg in the name, then fore each file, executes an ls -lh (long ls format with filesize in human readable form) on each file. This output is then passed to sort, and then to awk, which parses each line into space delimited fields (by default), printing out the 9th field (size), a tab (\t), and the path. The vertical bar can be quite powerful on the command line. There are a lot of other uses that could be scripted on the fly. For example, I use the pipe in a for loop to rename mp3's or convert filenames from all uppercase to lower case. For more examples of shell scripting, check out the online manuals for bash or tcsh Gruemaster |
Re: Code
Quote:
Oh, your keyboard layout usually changes when you change languages, so you might also specify the language you're using. (I.e., the value of LANG displayed by the set command.) |
Code
Thanks Very, Very helpful I'm using CensorNet which runs on Debain. I work for a small High School and it's the best firewall/web content solution on the market and it's free.
Our DNS is getting hammered and we lose Internet after awhile. It was every 30 min or so but it seems to now go for a day or so. The CensorNet folks are great but I though I'd run it pass you guys as well. I'm still stuck after running grep dnrd I can't seem to get out of this screen, unless I restart. This probably doesn't belong in newbie but I thought the | ? had to have a simple answer Doh! |
out of what screen?? the command should just return the lines containing dnrd and return you to a prompt.
This isn't happening? ctrl-C kills most things in a terminal :) |
It didn't run at all. no command prompt. I could type a command but nothing happened. I had to restart because the Internet went down but thanks for the info.
Steve |
Quote:
|
All times are GMT -5. The time now is 02:07 PM. |