Login
Forgot Password?

OR

Login with Google Login with Twitter Login with Facebook
  • Join
  • Profiles
  • Groups
  • SuicideGirls
  • Photos
  • Videos
  • Shop
Vital Stats

baudot

Oakland, CA

Member Since 2004

Followers 451 Following 294

  • Everything
  • Photos
  • Video
  • Blogs
  • Groups
  • From Others

Wednesday Nov 02, 2011

Nov 1, 2011
0
  • Facebook
  • Tweet
  • Email
I <3 2> /dev/null

SPOILERS! (Click to view)
.
What language is this?

This is a phrase in bash. Bash is the command language under the hood of macs and most web servers. Specifically, this is a suffix you'd tack on after another command.

What does it say?

">" redirects output from that command somewhere else. Adding the 2 on front only grabs part 2 of the output - the errors.

/dev/null is nowhere. It's a black hole.

So this is a phase we tack onto a mac command under the hood to ignore error messages. (Literally, to redirect error messages into the void.)

Tacking this onto the end of a command strips out the crap error messages flooding your results and leaves the success lines you were searching for. And I <3 that.

Tonight I'm searching a stranger's code to figure out why an event that I want to happen isn't happening. So I'm running a lot of commands like this:

grep -n "FROM LoginInfo" `find ./ -name "*.j*"` 2> /dev/null



grep is the "Global Regular Expression Parser". It's an all purpose search command. I'm using it to look for the text "FROM LoginInfo". The -n bit tells it that I also want to know the line number whenever it finds that text in a file.

The next part is telling it where to look. grep commands normally look like:
grep <what> <where>
In this case, I've got another command within backticks in the where slot:
`find ./ -name "*.j*"`

The backticks say, take this command, and use it's output in this spot.

I'm using the find command to list every file that has a 'j' in the last part of it's name, from this directory on down.

So, in full, the command:

grep -n "FROM LoginInfo" `find ./ -name "*.j*"` 2> /dev/null


translates to:

Find everywhere that "FROM LoginInfo" appears in any file with a j in its name from this directory on down. Tell me what line number you found it on, too, and don't bother me with all the places you couldn't find it.



Why is that awesome?
Screw the haystack. Here's the needle I'm looking for, in 0.2 seconds.

More Blogs

  • 06.17.13
    8

    Monday Jun 17, 2013

    Read More
  • 06.03.13
    16

    Monday Jun 03, 2013

    For folks who haven't read the Game of Thrones books, and just saw la…
  • 05.31.13
    1

    Friday May 31, 2013

    A couple videos by folks who have something to say worth hearing. For…
  • 05.23.13
    15

    Thursday May 23, 2013

    Read More
  • 05.20.13
    2

    Monday May 20, 2013

    Read More
  • 05.10.13
    6

    Friday May 10, 2013

    "Monaco: What's Yours Is Mine" just landed on XBox. This game has be…
  • 05.09.13
    0

    Thursday May 09, 2013

    Adventures in Synthetic Reasoning Fact #1: Cards Against Humanity i…
  • 05.06.13
    4

    Monday May 06, 2013

    Today is the 3rd Anniversary of the "Flash Crash of 2:45", a stock ma…
  • 05.05.13
    9

    Sunday May 05, 2013

    Read More
  • 05.02.13
    5

    Thursday May 02, 2013

    Read More

We at SuicideGirls have been celebrating alternative pin-up girls for:

23
years
10
months
29
days
  • 5,509,826 fans
  • 41,393 fans
  • 10,327,617 followers
  • 4,600 SuicideGirls
  • 1,115,555 followers
  • 14,951,127 photos
  • 321,315 followers
  • 61,470,704 comments
  • Join
  • Profiles
  • Groups
  • Photos
  • Videos
  • Shop
  • Help
  • About
  • Press
  • LIVE

Legal/Tos | DMCA | Privacy Policy | 18 U.S.C. 2257 Record-Keeping Requirements Compliance Statement | Contact Us | Vendo Payment Support
©SuicideGirls 2001-2025

Press enter to search
Fast Hi-res

Click here to join & see it all...

Crop your photo